A study surveyed 800 pupils in 20 classes; 10 classes used a new teaching method and 10 did not. A t-test on the 800 pupils gave p = 0.001. Reanalysed with pupils nested in classes, p = 0.19. Nothing was faked; the first analysis simply treated 800 pupils as 800 independent trials, when only 20 classes had actually been assigned to a method.
Nested data appear everywhere in education, health and management: pupils in classes, patients in hospitals, employees in firms, repeated measurements within people. Multilevel models (also called mixed models or hierarchical models) are the standard tool for them.
Why observations in the same group are not independent
Pupils in one class share a teacher, a timetable and friends; their scores resemble each other more than scores from other classes. Ignoring that:
- Underestimates standard errors, shrinking p-values and confidence intervals artificially.
- Treats group-level predictors (teaching method, school size) as if there were hundreds of independent units.
- Misses an interesting question: how much variation lies between classes and how much within them.
ICC and the design effect: measuring clustering
The intraclass correlation (ICC) is the share of variance at the group level. An ICC of 0.10 means about 10% of the variation in scores lies between classes.
A small ICC does not mean you can ignore it. The design effect estimates variance inflation: roughly 1 + (m − 1) × ICC, where m is the average group size.
| ICC | Pupils per class | Design effect | Effective sample from 800 pupils |
|---|---|---|---|
| 0.02 | 40 | ≈ 1.8 | ≈ 450 |
| 0.10 | 40 | ≈ 4.9 | ≈ 160 |
| 0.20 | 40 | ≈ 8.8 | ≈ 90 |
With large classes, even a modest ICC shrinks the effective sample sharply. That is also why, when designing class- or school-level interventions, adding groups usually helps more than adding people per group.
Random intercepts and random slopes
- Random intercept: each class has its own average level, varying around the overall mean. This is the most common starting model.
- Random slope: the effect of an individual-level predictor (such as study hours) varies between classes. Use it when theory supports it and you have enough groups.
- Cross-level interaction: a class-level variable (teaching method) changes the effect of a pupil-level variable. This is often the most interesting question a multilevel model can answer.
How many groups do you need?
This is where many studies struggle. Group-level variance is estimated from the number of groups, not the number of people. With very few groups, say five schools, the group-level variance estimate is very unstable and a multilevel model adds little. Methodological studies commonly recommend several dozen groups or more when group-level estimates matter, though the exact figure depends on your aim. With few groups:
- Use REML estimation and small-sample degrees-of-freedom corrections (Kenward–Roger or Satterthwaite) for fixed effects.
- Or include groups as dummy variables (fixed effects) if you do not need to generalise to other groups.
- State plainly in the limitations that group-level effects rest on few units.
Centring: a small step with big consequences
Individual-level predictors can be centred in two ways. Grand-mean centring makes the intercept easier to read. Group-mean centring separates the within-group effect (a pupil who studies more than classmates) from the between-group effect (a class whose pupils study more than other classes). The two effects can differ, even in sign. If your question concerns either, centre within groups and add the group mean as a class-level predictor.
Repeated measures are nested data too
When each person is measured several times (monthly test scores, weekly blood pressure), measurements are nested within people. A multilevel model handles this more flexibly than repeated-measures ANOVA: it accepts different numbers of measurements per person and uneven intervals, and it keeps people with a few missing waves instead of dropping them entirely. Time becomes a level-one predictor, personal characteristics are level-two predictors, and a random slope for time shows how rates of change differ between people.
Fitting and checking the model
- Fit an empty model (random intercept only) to compute the ICC.
- Add individual-level predictors, then group-level predictors.
- Add random slopes only with a reason and if the model converges.
- Check residuals at both levels; look for groups with unusual residuals.
- If the model fails to converge or reports a variance of zero (a singular fit), simplify the random structure rather than forcing it.
In R, the lme4 package with lmer and glmer is the common choice; SPSS offers the MIXED procedure; jamovi has the GAMLj module for those who prefer menus.
In practice: reporting a multilevel model
- Describe the structure: number of groups, observations per group (mean and range).
- Report the ICC from the empty model.
- State the software, estimation method, centring and random-effects structure.
- Table: fixed effects with standard errors or confidence intervals; random-effect variances at each level.
- Where available, report marginal and conditional R² so readers can gauge explained variance.
Next step: if your data have any grouping structure (classes, schools, hospitals, regions, repeated measures), fit the empty model and compute the ICC before any other analysis. That one number tells you whether your current results are overconfident.
Câu hỏi thường gặp
When do I need a multilevel model?
When observations are nested within groups, such as pupils in classes, patients in hospitals or repeated measures within people, so observations in the same group are not independent.
What is the ICC and when should I worry?
The ICC is the share of variance at the group level. Even a small ICC can seriously underestimate standard errors when each group contains many observations.
How many groups does a multilevel model need?
There is no single number, but stable group-level estimates generally need several dozen groups or more. With very few groups, use small-sample corrections or consider fixed effects.
What is the difference between a random intercept and a random slope?
A random intercept gives each group its own average level; a random slope lets the effect of a predictor vary between groups.
Can I run multilevel models in SPSS?
Yes, using the MIXED procedure. R with lme4 and jamovi with the GAMLj module are also popular options.