You can further improve a linear mixed model with random intercept and slope by specifying a structure in the residuals (for example AR(1)).

In SAS it is possible, but I hope this is also already possible in R. Does somebody knows how to do this?

I am using both packages lme4 and nlme.

Thank you, Kasper


After going through the book "Linear mixed effect models using R" by the authors Andrezej Galecki and Tomasz Burzykowski, I could not find a way to do it in R.

However, one example in the book Applied "Longitudinal Data Analysis" by Fitzmaurice, Laird and Ware apply this methodology, and on their website, they give the R code:

model2 <- lme(pbf ~ time + time0, random= ~ 1 | id, + corr=corCAR1(, form= ~ time | id))

The full script you can find on:


  • 1
    $\begingroup$ I would say the canonical reference on the nlme package is Pinheiro & Bates (2000). They are, after all, the authors of that package. And in that book, they give plenty of examples illustrating the use residual correlation structures. $\endgroup$ – Wolfgang Apr 3 '14 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.