If so, it probably doesn't matter, and if not you may want corCAR1 not corAR1.
On Thu, 10 Feb 2005, David Hugh-Jones wrote:
Assuming I have years in YEAR and state ids in ID, I guess the correlation ought to be
corAR1(form = ~ YEAR | ID)
?
Thanks a lot, David
On Thu, 10 Feb 2005 12:36:32 -0500, Doran, Harold <[EMAIL PROTECTED]> wrote:In the nlme package you can find the gls() function to account for autocorrelation over time using corAR1. Syntax might look something like this:
fm1 <- gls(response ~ IV, long, correlation=corAR1(form=~1|ID), method='ML')
You can also use weights() for heteroscedasticity.
-Harold
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Hugh-Jones Sent: Thursday, February 10, 2005 12:15 PM To: [email protected] Subject: [R] correcting for autocorrelation in models with panel data?
Hi
I have some panel data for the 50 US states over about 25 years, and I would like to test a simple model via OLS, using this data. I know how to run OLS in R, and I think I can see how to create Panel Corrected Standard Errors using
http://jackman.stanford.edu/classes/350C/pcse.r
What I can't figure out is how to correct for autocorrelation over time. I have found a lot of R stuff on time series models but they all seem focused on predicting a single variable from its previous values. Can anyone explain to me how to detect and get round autocorrelation? Is there a package for panel data that I have missed?
I appreciate that this is probably just as much about my ignorance of econometrics as about R itself!
Cheers David
-- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
