Are my data nested in groups? (multilevel model)
In brief
The people belong to groups: children to classes, students to seminars, several measurements to one person. People in the same group are often more alike; ordinary tests assume independent values and then come out too optimistic. The multilevel model (mixed model) takes the groups into account. Statable calculates it with R (lme4, lmerTest). R is loaded once the first time (about 40 MB), afterwards it takes about a second; the data stay on the device.
- Choose the measure (a number).
- Choose the column that names the group (class, seminar, or the person for repeated measurements).
- Optional: characteristics of the people that could explain the differences.
If the measure has only two values (yes/no), Statable calculates a mixed logit model: odds ratios and a latent ICC; the event is the larger value.
In "Do groups differ?" and "Can something be predicted?" Statable points this out when there is a column such as "class" or an identifier with repetitions, and then opens the question already filled in. It is also under "More methods".
Reading the result
- ICC (null model): share of the variation that lies between the groups. The design effect shows how much the grouping would distort the standard errors of ordinary tests.
- Fixed effects: b with 95% interval, Satterthwaite degrees of freedom and p; this is the effect of a characteristic with the groups taken into account.
- Random effects: variance between groups (τ₀₀) and within (σ²). Marginal R²: share due to the fixed effects; conditional R²: due to fixed and random effects together.
- Chart: deviation of each group from the grand mean with 95% interval, ordered (caterpillar plot). Filled dots: the interval excludes 0.
Requirements and limits
- Several groups with several cases each: very uncertain below 10 groups, reliable from about 30 (rule of thumb).
- A number as the measure, roughly normal residuals, groups independent of each other. For yes/no outcomes the logit model applies instead (see above).
- If R reports a boundary fit (singular fit) or no convergence, Statable turns that into a sentence; a simpler model usually helps.
Multilevel model: ICC (null model) = .16; SES: b = 2.61, 95% CI [1.97, 3.25], t(688.8) = 8.01, p < .001; R²m = .17, R²c = .22 (N = 720 in 40 groups)
Typical examples
- Pupils in classes: reading test by class, with pretest as predictor.
- Patients in practices, employees in companies, repeated measurements within people.
For specialists
lmerTest::lmer with REML (default as in jamovi and JASP), Satterthwaite degrees of freedom; the lmerTest package is shipped without its plotting functions (ggplot2), the calculation is unchanged. Random intercept per group; a random slope (number or column with two values) and centering at the grand mean are under "For specialists" in the result. R² after Nakagawa and Schielzeth (2013) with the extension for slopes after Johnson (2014), as performance::r2_nakagawa. Checked against R on the Mac: sleepstudy, MathAchieve (160 schools), class excerpt.