[R-sig-ME] acf() and lme

David Villegas Ríos chirleu at gmail.com
Mon Aug 31 09:06:40 CEST 2015

Dear list,

I'm running a model like this using lme (nlme):


where "res" is the response variable, "t1", "t2" and "month" are
explanatory variables and "ID" is individual identity.

If I extract the normalized residuals and run acf(residuals), there is
evidence for strong autocorrelation (in this case, temporal
autocorrelation, since data were collected in a monthly basis over 3 years).

So I can run the same model incorporating the autocorrelation structure.


where "tim" is a time dummy variable.

This model is much better according to AIC and anova, and if I run
acf(residuals) now, the plot seems ok.

However, my questions are:

1. How does acf know which observations are potentionally correlated
(because they share the same ID in this case) and which are not if I only
pass the residuals?

2. How does acf know which is the correct time order of the observations?

Thanks in advance,


	[[alternative HTML version deleted]]

More information about the R-sig-mixed-models mailing list