About this resource

    Type of resources
    Reading, R code
    Education level(s)
    Graduate / Professional
    Primary user(s)
    Student, Teacher, Researcher
    Subject area(s)
    Education, Life Science, Math & Statistics, Social Science
    Language(s)
    English
    Cluster
    Conceptual and Statistical Knowledge
    Last updated
    8 May 2020

    Using R and lme/lmer to fit different two- and three- level longitudinal models

    Open this resource

    Level Graduate / Professional · For Student, Teacher, Researcher · Language English

    Abstract

    I often get asked how to fit different multilevel models (or individual growth models, hierarchical linear models or linear mixed-models, etc.) in R. In this guide I have compiled some of the more common and/or useful models (at least common in clinical psychology), and how to fit them using nlme::lme() and lme4::lmer(). I will cover the common two-level random intercept-slope model, and three-level models when subjects are clustered due to some higher level grouping (such as therapists), partially nested models were there are clustering in one group but not the other, and different level 1 residual covariances (such as AR(1)). The point of this post is to show how to fit these longitudinal models in R, not to cover the statistical theory behind them, or how to interpret them.

    Keywords Blog · Tutorial