Linear Mixed Models (LMM)#
If you would use RM-ANOVA but have missing data, unequal time intervals, or nested structures β then linear mixed models (LMM) are your tool. They are not a complicated specialist method but the natural evolution of ANOVA. In fact, RM-ANOVA is a special case of the LMM.
When to Use#
- You have repeated measures but some data are missing β LMM can handle missing values without excluding entire participants
- Your measurements have unequal time intervals (e.g., assessments at 1, 3, and 12 months)
- Your data are nested (e.g., students in classrooms, patients in clinics)
- You need more flexibility than a traditional ANOVA provides β such as different covariance structures
- You want to model individual trajectories (each person can have their own starting point and rate of change)
Fixed and Random Effects β Simply Explained#
Imagine you are studying learning progress of students across different classrooms:
- Fixed effects answer your research question: "Does the new teaching method improve performance?" β these are the effects you want to generalize to the population.
- Random effects model the structure of your data: "Students in the same classroom are more similar to each other than students from different classrooms." β they capture variation between clusters (e.g., classrooms).
Key insight: Fixed effects = what you care about scientifically. Random effects = the nesting in your data.
Assumptions#
- Linearity β the relationship between predictors and outcome is linear
- Normality of residuals (not the raw data!)
- Normality of random effects
- Independence of observations at the highest level (e.g., between classrooms)
Tip: LMM are robust to mild violations of normality, especially with larger samples. Check residuals with a QQ plot. Unlike RM-ANOVA, no sphericity assumption is needed.
Formula#
The core idea is simple β just add a random component:
Where:
- = fixed intercept (overall mean, fixed effect)
- = random deviation of the intercept for group (random intercept)
- = fixed effect of the predictor (e.g., time)
- = random deviation of the slope for group (random slope)
- = residual
In plain language: Each person (or cluster) gets their own starting point and their own rate of change, but all are drawn from a shared distribution.
RM-ANOVA is a special case of the LMM β with a balanced design, complete data, and compound symmetry covariance structure, both yield identical results.
Example#
Practical Example: Stress Reduction With Missing Data
60 patients participate in an 8-week stress reduction program. Stress levels are measured at 4 time points (weeks 0, 2, 5, and 8 β unequal intervals). 12 patients miss at least one appointment.
With RM-ANOVA: 12 patients are excluded entirely β only 48 patients β loss of information and potential bias.
With LMM: All 60 patients are included. The model uses whatever data each person provides.
Model: Stress ~ Time + (1 + Time | Person)
Results:
- Fixed effect of time: , , β stress decreases by an average of 2.34 points per measurement occasion
- Random intercept SD: 4.12 β individuals start at different stress levels
- Random slope SD: 1.08 β the rate of stress reduction varies across individuals
Effect Size#
For LMM, two measures are reported (following Nakagawa & Schielzeth):
- Marginal : Variance explained by fixed effects alone
- Conditional : Variance explained by fixed + random effects
| Measure | Interpretation |
|---|---|
| = 0.13, = 0.55 | Fixed effects explain 13%, with random effects 55% β cluster structure matters a lot |
| Little variation between clusters β a simpler model may suffice |
Tip: When and diverge strongly, the random effects are important and a simple regression model would be inadequate.
Further Reading
- Winter, B. (2020). Statistics for Linguists: An Introduction Using R. Routledge. (Very accessible introduction to LMM)
- Nakagawa, S. & Schielzeth, H. (2013). A general and simple method for obtaining from generalized linear mixed-effects models. Methods in Ecology and Evolution, 4(2), 133β142.
- Baayen, R. H., Davidson, D. J. & Bates, D. M. (2008). Mixed-effects modeling with crossed random effects for subjects and items. Journal of Memory and Language, 59(4), 390β412.