Linear mixed model (random intercept)
Regression · Method and input reference
Long-format Gaussian outcomes: outcome, numeric subject/group ID, then numeric fixed predictors. One random intercept per group, REML. At least five groups, two observations each. Encode factors and interactions explicitly. No random slopes, GLMM or omnibus mixed-ANOVA tests. Synthetic example: 20 simulated subjects at six occasions with subject intercept variation.
Open calculator · Compare methods in the decision matrix
When to consider it
- For a continuous repeated outcome with group/time predictors, consider a random-intercept linear mixed model.
- Model a Gaussian continuous outcome with one random intercept per subject or group.
Assumptions and scope
- Enter long-format outcome, subject ID and fixed predictors. Explicitly code time, treatment and their interactions.
- Assess random-intercept adequacy, residuals and within-subject covariance.
Partial coverage: this is a mixed model, not factorial repeated-measures ANOVA; no omnibus mixed-ANOVA F-tests, random slopes or sphericity corrections.
Required inputs
- Outcome, group, predictors — Numeric observations; preserve the row and column structure described above.
Review missing values and data coding before running. Sample inputs are synthetic teaching examples.
Implementation
Long-format Gaussian outcomes: outcome, numeric subject/group ID, then numeric fixed predictors. One random intercept per group, REML. At least five groups, two observations each. Encode factors and interactions explicitly. No random slopes, GLMM or omnibus mixed-ANOVA tests. Synthetic example: 20 simulated subjects at six occasions with subject intercept variation.
- statsmodels 0.14.4: statsmodels.api.MixedLM
These are pinned library versions; saved results record the versions actually used at runtime.