[R] corARMA and ACF in nlme

Jeff Jorgensen jcjorgensen at wisc.edu
Wed Mar 10 00:13:07 CET 2004


Hi R-sters,

Just wondering what I might be doing wrong.  I'm trying to fit a multiple 
linear regression model, and being ever mindful about the possibilities of 
autocorrelation in the errors (it's a time series), the errors appear to 
follow an AR1 process (ar(ts(glsfit$residuals)) selected order 1).  So, 
when I go back and try to do the simultaneous regression and error fit with 
gls, the acf and pacf plots of residuals from the old model (glsfit) and 
those plots of the new model (glsAR1fit, below)  look exactly the same (a 
significant autocorrelation at lag of 1).

Any ideas out there as to what I may be doing wrong?  Is there an error in 
my code?

Here's my R code for the simultaneous model fit (taking a phi estimate=0.6 
from a previous step <ACF(glsfit)>):

glsAR1fit<-gls(y~x1+x2+x3+x4, na.action = na.omit, subset=12:54,
                 correlation = corARMA(0.6, p=1, q=0, fixed = FALSE))

Thanks much,

Jeff

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Jeff Jorgensen

Center for Limnology
University of Wisconsin Madison           ph (608) 263-2304
680 North Park Street                           fx (608) 265-2340
Madison, Wisconsin 53706                http://limnology.wisc.edu

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




More information about the R-help mailing list