[R] pgmm - how to properly specify lag term?

Striessnig, Erich Erich.Striessnig at wu.ac.at
Mon Aug 8 10:08:19 CEST 2016

Dear R-users,

I want to reproduce "a dynamic panel data model, autoregressive of order 1, with fixed effects" that was originally estimated with 2-step GMM in STATA. Reproducing the model in R shouldn't be a big deal, however, unfortunately I don't have the original STATA code and the lagged dependent variable is not "free-standing", but rather subtracted from another independent variable like this:

Y(t) - Y(t-1) = b1 * [X(t) - X(t-1)] + b2 * [X(t-1)-Y(t-1)]

So my question is on how to specify the instruments. The model I am trying to reproduce is instrumenting the endogenous lagged term by its 4th and the 5th lag. Do I need dynformula() for that or does one of the following specifications work as well?

form1 <- diff(value.y) ~ diff(value.x) + lag(I(value.x-value.y),1) | lag(value.y,4:5)
form2 <- diff(value.y) ~ diff(value.x) + lag(I(value.x-value.y),4:5) | lag(value.y,4:5)
form3 <- diff(value.y) ~ diff(value.x) + diff.xy | lag(diff.xy,4:5)
form4 <- diff(value.y) ~ diff(value.x) + lag(diff.xy,1) | lag(diff.xy,4:5)
form5 <- diff(value.y) ~ diff(value.x) + lag(diff.xy,1) | lag(I(value.x-value.y),4:5)


value.x <- rnorm(336)
value.y <- rnorm(336)
diff.xy <- value.x - value.y
my.data <- data.frame(expand.grid(ids=1:28,times=1:12),value.x,value.y,diff.xy)

mod1 <- pgmm(formula=form1,data=my.data,index=c('ids','times'),
             effect="individual", model="twosteps")

Kind regards,

	[[alternative HTML version deleted]]

More information about the R-help mailing list