Mixed-effects models
What question does this help answer?
“How is an outcome associated with predictors when repeated measurements or hierarchical clustering make observations within a unit correlated?”
When to use it
Use mixed-effects models for repeated measurements, multilevel data, clustered studies, longitudinal trajectories, or settings where subject- or cluster-specific variation is scientifically meaningful.
When not to use it
Do not add random effects automatically. The hierarchy, number of clusters, outcome type, estimand, and covariance structure should justify the model.
How it works in plain language
Fixed effects estimate average relationships of interest. Random effects allow units such as patients or clinics to have their own intercepts and, when appropriate, slopes. This accounts for correlation among observations from the same unit.
What random intercepts look like
Why Mallard may recommend it
Mallard may recommend a mixed model when measurements repeat within the same person, patients are nested within clinicians or sites, or a cluster-randomized design is used.
Key assumptions
- The random-effects structure is scientifically and statistically defensible.
- The conditional outcome distribution and link are appropriate.
- The number and size of clusters support the intended model.
- Missingness assumptions are considered for longitudinal data.
- Model convergence and singular fits are evaluated.
What to watch out for
More complex random-effects structures are not always better. Interpretation differs from population-average models such as GEE.
Clinical example
Model repeated blood-pressure measurements over 12 months using fixed effects for treatment and time and random intercepts for participants.
How to interpret it
A treatment coefficient describes the modeled conditional difference after accounting for the random-effects structure. Random-effect estimates describe unexplained between-unit variability.
- Real longitudinal data analysis for real people: building a good enough mixed model (opens in a new tab) · Stat Med · doi 10.1002/sim.3775
- Repeated Measures Designs and Analysis of Longitudinal Data (opens in a new tab) · Anesth Analg · doi 10.1213/ANE.0000000000003511