[R-sig-ME] acf() and lme
David Villegas Ríos
chirleu at gmail.com
Mon Aug 31 10:49:02 CEST 2015
Thanks Thierry, very helpful.
David
2015-08-31 9:31 GMT+02:00 Thierry Onkelinx <thierry.onkelinx at inbo.be>:
> Dear David,
>
> 1) It is safer to use ACF(model) because ACF() was created to handle
> nlme objects. And thus can take the correct design structure into
> account. acf() probably worked because the data was sorted first along
> ID and then along time.
> 2) acf() doesn't. It uses the current order in the data.
>
> Best regards,
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek / Research Institute for Nature
> and Forest
> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
> Kliniekstraat 25
> 1070 Anderlecht
> Belgium
>
> To call in the statistician after the experiment is done may be no
> more than asking him to perform a post-mortem examination: he may be
> able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher
> The plural of anecdote is not data. ~ Roger Brinner
> The combination of some data and an aching desire for an answer does
> not ensure that a reasonable answer can be extracted from a given body
> of data. ~ John Tukey
>
>
> 2015-08-31 9:06 GMT+02:00 David Villegas Ríos <chirleu at gmail.com>:
> > Dear list,
> >
> > I'm running a model like this using lme (nlme):
> >
> >
> model=lme(res~t1+t2+poly(month,3)+location,random=~1|ID,data=dataset,method="REML")
> >
> > 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.
> >
> >
> model=lme(res~t1+t2+poly(t3,3)+location,random=~1|ID,correlation=corAR1(form=~tim),data=dataset,method="REML")
> >
> > 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,
> >
> > David
> >
> > [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-mixed-models at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list