How to run the pgmm command?

3.1k views Asked by At

Please see a sample of my data, and my pgmm code, and let me know if I am using the correct syntax.

Y1 is my dependent variable, and X* with C* variables are my independent and control variables. I am trying to run the dynamic GMM model with 2 year lags, but this is the first time that I am using PGMM and I am not sure if this is the correct syntax.

Sample Data

I am trying to run the pgmm command below:

country <- pdata.frame(country, index = c('Co_Code', 'YEAR'))

model.gmm <- Y1 ~ lag(X1, 2) + lag(X2, 2) + lag(X3, 2) + lag(X7, 2) + 
lag(X6, 2) + lag(X4, 2) + lag(X5, 2) + lag(X8, 2) + lag(X9, 2) + 
lag(X10, 2) + lag(C1, 2) + lag(C2, 2) + lag(C3, 2) + lag(C6, 2) + lag(C7, 2)
gmm.form = update.formula(model.gmm, . ~ . | lag(Y1, 2))
gmm.form[[3]] <- gmm.form[[3]][[2]]


gmm.fit <- pgmm(gmm.form, data = country, effect = "twoways", model = 
"twosteps") 
 summary(gmm.fit)

Edit: I've also generated the code below:

 gmm.fit <- pgmm(Y1 ~ X1 + X2 + X3 + X6 + X7 + X4 + X5 + X8 + X9 + X10 +    
 C1 + C2 + C3 + C6 |lag(X1, 2) + lag(X2, 2) + lag(X3, 2) + lag(X7, 2) + 
 lag(X6, 2) + lag(X4, 2) + lag(X5, 2) + lag(X8, 2) + lag(X9, 2) + 
 lag(X10, 2) + lag(C1, 2) + lag(C2, 2) + lag(C3, 2) + lag(C6, 2), data = 
 country, effect = "twoways", model = "twosteps")
1

There are 1 answers

0
tomcat On

Yes, your updated version appears correct for what you say. You may prefer using dynformula, the basic structure is:

gmm.form <- dynformula(Y1~ X + C, lag.form=list(2,2,2))

And this easily generalises for multiple X and C:

gmm.form <- dynformula(Y1~ X1 + X2 + X3 + X4 + X5 + X6 + X7 + X8 + X9 +X10 + C1 + C2
+ C3 + C4 + C5 +C6, lag.form=list(rep(2,17)))

This command means you will be including up to and including 2 lags for all the variables (noting that the first in the lag.form list above is Y1 - dynformula will automatically put the lags of Y1 on the right hand side of the equation).

[Edit: I note you haven't specified instruments. Seeing your data, for standard dynamic panel approach of lagged Y, I'd put gmm.inst=~Y1,gmm.lag=list(c(3,99))]