0
$\begingroup$

I put up a fixed effects regression using panel data with a time lag of the dependant variable, so somthing like this:

library(plm)
library(lmtest)
attach(data)
panel_data <- pdata.frame(data, index = c("country","time"))

model1 <- plm(Y~Y_l1+A+B+C, data = panel_data, model = "within",  effect = "twoway")

Where Y_l1 is the time lag of the dependant variable and A,B,C are other explanatory variables. I am using robust st. err. as well

robmodel <- coeftest(model1, vcov.=vcovHC(model1, method = c("arellano")))

My advisor now told me that as my number of time periods is rather small (its about 15) I should include GMM estimators for dynamic panels. He said it is fairly simple to include them in Stata, I however use R, therefore, I wanted to know if there is a simple way to include them in R as well? Is it possible to do it with one line of code?

$\endgroup$

closed as off-topic by Peter Flom - Reinstate Monica Jul 13 at 13:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Peter Flom - Reinstate Monica
If this question can be reworded to fit the rules in the help center, please edit the question.

1
$\begingroup$

Dynamic panels are usually dealt with using GMM. Check pgmm in plm. It should be quite straightforward to follow.

https://www.jstatsoft.org/article/view/v027i02/v27i02.pdf

$\endgroup$
  • $\begingroup$ Thanks, I am getting: error in terms.default(formula) : no terms component nor attribute do you know why that could be? $\endgroup$ – ArOk Oct 15 '18 at 14:56
  • $\begingroup$ What did you run? $\endgroup$ – bellmaneqn Oct 15 '18 at 15:04
  • $\begingroup$ attach(data) panel_data <- pdata.frame(data, index = c("country","time")) GMMmodel <- pgmm(A~lag(A_l1)+B,effect="twoways",model="twosteps") $\endgroup$ – ArOk Oct 15 '18 at 15:24
  • 1
    $\begingroup$ See the document for section 5.4 on page 16. You need dynformula to define your lag structure. $\endgroup$ – bellmaneqn Oct 15 '18 at 15:27
  • 1
    $\begingroup$ Please, do not use dynformula as it is deprecated. Also, please use the package's vignette which is an updated version of the cited article. $\endgroup$ – Helix123 Oct 15 '18 at 21:09
0
$\begingroup$

there is a "pgmm" option: estimation of generalized method of moments models for panel data in "plm" package. It should be a corresponding function in R to xtabond2 from Stata (see CRAN and Author's description)

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.