[R] corARMA and ACF in nlme

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Mar 10 09:37:14 CET 2004


Jeff Jorgensen <jcjorgensen at wisc.edu> writes:

> 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?

This is one of the dangers of accessing model fit structures directly:
There is more than one way to define residuals for correlated data. Try
looking at help(residuals.gls).

(It's been a while, but as far as I remember, you can plot the
Variogram of the raw residuals and overlay the theoretical Variogram
of the fitted model, so raw residuals are useful too. Also,
standardized residuals are not uniquely defined since matrix square
roots aren't.)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list