Relate › Mixed effects

Mixed-effects model (LMM / GLMM)

A linear or generalized linear mixed-effects model fits random intercepts per grouping variable — and optionally random slopes — alongside the fixed effects.

What is Mixed-effects model (LMM / GLMM)?

When observations are clustered (patients within hospitals, repeated measurements per subject, plots within fields), treating them as independent under-estimates SEs. Mixed models add random intercepts (and optional random slopes) per grouping factor so the within-cluster correlation is modelled rather than assumed away.

vs GEE: mixed models estimate *subject-specific* effects (the β for a typical subject); GEE estimates *population-averaged* effects (the β for the typical observation in the population). Identical for linear models; for non-linear links (logistic, Poisson) the two differ and you should pick based on the scientific question.

vs rm-ANOVA: mixed models are more flexible — they handle unbalanced data, missing time points, arbitrary covariance structures, and continuous within-subject covariates. Rm-ANOVA needs balanced complete data and assumes sphericity.

When should I use Mixed-effects model (LMM / GLMM)?

  • Clustered or longitudinal data (repeated measurements per subject).
  • Multi-level data (students within schools within districts).
  • When you have continuous within-subject covariates that rm-ANOVA can't handle.

What data does it need?

Response + fixed-effect predictors + grouping variable; optional random-slope variable. Family: gaussian / binomial / poisson.

What does it report?

Fixed-effects table (β / SE / Wald z / approx p / 95% CI), random-effects variance + correlation, ICC = σ²_group / (σ²_group + σ²_residual), AIC / BIC / logLik, isSingular warning.

What does it assume?

  • Independent groups.
  • Linearity in the fixed predictors.
  • Random effects approximately normal.
  • Outcome conditionally distributed per the family (Gaussian, Bernoulli, Poisson).

How do I interpret the result?

ICC > 0.1 ⇒ clustering matters and you'd have been wrong to ignore it.

isSingular = TRUE means at least one variance component was estimated at the boundary (essentially 0). Simplify the random-effects structure or check whether the grouping factor actually has the structure you assumed.

Fixed-effect p-values aren't reported by default in linear mixed models (they require degrees of freedom that aren't well-defined); we show Wald z and a normal-approximation p instead. For small samples, a Satterthwaite degrees-of-freedom correction is more accurate.

See also

References

  • Bates et al. (2015). Fitting linear mixed-effects models. JSS 67(1).