Linear Mixed Effects (LMM) — clustered / repeated data (ICC, BLUPs)
VerifiedAdvanced & specialized
Run this test straight away on a free built-in teaching dataset — no data of your own needed — or bring your own. Either opens the guided workspace: variable setup, assumption diagnostics, results with effect sizes and confidence intervals, figures, and APA-ready reporting.
Loading teaching datasets…
Or use your own dataset
Loading your datasets…
Fits y = Xβ + Zu + ε with FIXED effects β (population-level) and RANDOM effects u (group-level deviations) — handles clustered, nested, and longitudinal data with proper accounting for the multi-level
dependence structure. Reports fixed-effect coefficients with SE + 95% CI + p, variance components per random effect, intraclass correlation (ICC), marginal and conditional R² (Nakagawa-Schielzeth), model fit (log-likelihood, AIC, BIC), group-level BLUPs, and an OLS comparison documenting the clustering motivation. Handles missing-at-random (MAR) data without listwise deletion.
Worked example
Does a therapy reduce symptoms over time, allowing for repeated visits per patient?
Symptom scores across multiple visits per patient were modelled with a linear mixed-effects model (random intercept per patient) — the right tool for clustered / repeated data.
Symptoms fell about 1.2 points per visit (fixed effect b = −1.23, p < .001); between-patient variation was substantial (ICC = .76).
A linear mixed-effects model showed symptoms decreased significantly over visits, b = −1.23, p < .001 (random intercept per patient, ICC = .76).
Try it yourself: Load this ready-made sample and follow the run above.
When to use it
- Nested / cross-sectional clustering (random intercept)Test score ~ ses + gender + (1 | school) (n = 5000 students × 100 schools).
- Longitudinal / repeated measures (random intercept per subject)Depression score ~ time + treatment + (1 | subject) (n = 100 patients × 5 visits).
- Random intercept + random slope (subject-specific trajectories)Depression ~ time + treatment + (time | subject) — each patient has own baseline AND own recovery rate.
When NOT to — use instead
- Independent observations (no clustering)Use linear regression — no random effects needed. → Linear Regression \u2014 OLS (continuous y + predictors)
- Population-average effects of interestLMM gives subject-specific (conditional) estimates. → GEE \u2014 population-averaged regression with robust SE
- Binary outcomeUse logistic mixed-effects model (GLMM binary). → GLMM (binary) \u2014 logistic mixed-effects (random intercept)
- Count outcomeUse Poisson mixed-effects model (GLMM Poisson). → GLMM (Poisson) \u2014 count mixed-effects (random intercept)
Hypotheses
Parameter tested: fixed-effect coefficients β + variance components (σ²_u, σ²_e)
Assumptions (and what to do if they fail)
Check: ICC value.
If violated: ICC ≈ 0 → no meaningful between-cluster variance → LMM and OLS give the same answer.
Check: Shapiro-Wilk p-value.
If violated: Non-normal residuals affect small-sample CIs.
Check: Shapiro-Wilk on BLUPs.
If violated: Non-normal BLUPs can indicate an unmodelled predictor driving between-cluster differences.
Check: Levene's test p.
If violated: Heteroscedasticity can be addressed via heteroscedastic LMMs (weights parameter).
Ready to run a Linear Mixed Effects (LMM) — clustered / repeated data (ICC, BLUPs) on your own data?
Guided setup, automatic assumption checks, effect sizes, figures and an APA write-up.
Run this test →