Dear Millo Thank you for the prompt and honest answer.
Please accept my appreciation for developing the 'plm' package and for the excellent documentation associated with it. It was a great place for me to start, and it made my initial forays into panel data analysis a lot easier. You have given me an example of a random effects model with MA(4) errors. I actually want to fit a fixed effects model with MA(4) errors. Could you advise on how the Grunfeld formula would be modified to make it into a fixed effects model? Or could you advise of any documentation that explains the 'nlme' package from an econometrician's perspective? -----Original Message----- From: Millo Giovanni [mailto:giovanni_mi...@generali.com] Sent: Wednesday, 23 February 2011 12:46 a.m. To: david....@ihug.co.nz Cc: R-help@r-project.org; Yves Croissant Subject: [R] Adjusting for autocorrelation in a panel model Cheers David Dear David, short answer: no. Although an MA(4) correlation structure makes perfect sense in an econometric panel model, the treatment of (relatively) rich covariance structures in a likelihood framework is done so well in the 'nlme' and 'lme4' packages that we decided not to duplicate functionality and specialize in OLS- and GLS-based semiparametric methods instead. If I am not mistaken, what you want may be done in 'nlme' along these lines (usual Grunfeld example, RE + MA(4) errors): > library(nlme) > mod <- lme(inv ~ value + capital, data = Grunfeld, + random = ~ 1 | firm, correlation = corARMA(q=4, form = ~ year | firm)) > summary(mod) Linear mixed-effects model fit by REML Data: Grunfeld AIC BIC logLik 2080.698 2110.247 -1031.349 Random effects: Formula: ~1 | firm (Intercept) Residual StdDev: 85.3411 61.4331 Correlation Structure: ARMA(0,4) Formula: ~year | firm Parameter estimate(s): Theta1 Theta2 Theta3 Theta4 1.02717687 0.72128293 0.20164003 0.03955776 Fixed effects: inv ~ value + capital Value Std.Error DF t-value p-value (Intercept) -30.417581 29.772699 188 -1.02166 0.3083 value 0.085603 0.007226 188 11.84669 0.0000 capital 0.304009 0.026718 188 11.37854 0.0000 Correlation: (Intr) value value -0.220 capital -0.219 -0.144 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.507368276 -0.308055815 0.006783496 0.236507068 4.513481803 Number of Observations: 200 Number of Groups: 10 > This is a quick modification of the example on top of page 38 in our paper here http://www.jstatsoft.org/v27/i02. Please refer to it for more on plm vs. nlme (but be aware: back then I wrote that nlme didn't support unbalanced panels, which was incorrect: it does!). Lastly, yu're perfectly right: the asymptotics of pggls is inappropriate in your case. Best wishes, Giovanni ------------- original message ----------------- Message: 107 Date: Tue, 22 Feb 2011 16:09:48 +1300 From: "David Kennedy" <david....@ihug.co.nz> To: <r-help@r-project.org> Subject: [R] Adjusting for autocorrelation in a panel model Message-ID: <00b701cbd23d$f7200560$e5601020$@d...@ihug.co.nz> Content-Type: text/plain I am working with panel data. I am using the plm package to do this. I would like to do be able to adjust for autocorrelation, as one does with glm models and correlation structures (eg corr=corARMA(q=4)) . In particular, I want to employ MA(4) error structure. Is there a way of doing this with the plm package? (Note: I do not really want to use the pggls function for various reasons. One of those reasons is that it will be rare for n >> T.) Thanks to anyone who can help. Cheers David [[alternative HTML version deleted]] ------------------------------ Giovanni Millo Research Dept., Assicurazioni Generali SpA Via Machiavelli 4, 34132 Trieste (Italy) tel. +39 040 671184 fax +39 040 671160 Ai sensi del D.Lgs. 196/2003 si precisa che le informazi...{{dropped:13}} ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.