[R] Adjusting for autocorrelation in a panel model
Millo Giovanni
Giovanni_Millo at Generali.com
Tue Feb 22 12:46:08 CET 2011
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.dmk at ihug.co.nz>
To: <r-help at r-project.org>
Subject: [R] Adjusting for autocorrelation in a panel model
Message-ID: <00b701cbd23d$f7200560$e5601020$@dmk at 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}}
More information about the R-help
mailing list