Striessnig, Erich
2016-Jul-27 15:18 UTC
[R] How to set up a dynamic panel data model with pgmm from plm pacakge?
\n<< Hi, I am trying to set up a dynamic panel data model using the pgmm function from the plm package. The formula that I want to estimate is something like this: [y(t) - y(t-1)] ~ [x(t) - x(t-1)] + [x(t-1) - y(t-1)] where the lagged value of the dependent variable should be instrumented by its 4th and 5th lag. Can anyone please tell me which one of the five formulas in the R-code below does that? ########################### library(plm) 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) 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) mod1 <- pgmm(formula=form1,data=my.data,index=c('ids','times'), effect="individual", model="twosteps") summary(mod1) ########################### Kind regards, Erich>>\n\n \n<<Write your query here, using your example code to illustrate>> \n<<End with your name and affiliation>>\n\n\n\n--please do not edit the information below-- R Version: platform = x86_64-w64-mingw32 arch = x86_64 os = mingw32 system = x86_64, mingw32 status major = 3 minor = 2.5 year = 2016 month = 04 day = 14 svn rev = 70478 language = R version.string = R version 3.2.5 (2016-04-14) nickname = Very, Very Secure Dishes Windows 7 x64 (build 7601) Service Pack 1 Locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 Search Path: .GlobalEnv, package:plm, package:TinnRcom, package:Hmisc, package:ggplot2, package:Formula, package:survival, package:lattice, package:grid, package:R2HTML, package:formatR, package:svSocket, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, package:methods, SciViews:TempEnv, Autoloads, package:base [[alternative HTML version deleted]]