Mixed models

Linear mixed models with random intercepts without lme4 syntax

A mixed model is the honest way to analyse data whose rows are not independent — repeated measurements, students within schools, plots within sites. Magic Stat fits the random-intercept model from your spreadsheet and reports the fixed effects, the variance components and a forest plot, without a formula you have to type.

The honest part

What this mixed model does — and what it deliberately does not

A linear mixed model separates the variation into a fixed part (the effects you want to report — slopes and intercepts) and a random part (the grouping structure: each group gets its own random shift of the intercept). Modelling that grouping is what makes the standard errors correct; running an ordinary regression on clustered data instead understates uncertainty and inflates significance.

The fit here uses REML, the standard for variance components, and is a random-intercepts model: one grouping factor, a random offset per level. Guards are enforced rather than silent — at least 3 groups, at least 20 complete rows, no constant predictor and no constant outcome. A singular design is reported as an error, never dressed up as a result.

It is not everything a mixed model can be. Random slopes, crossed or multiple random effects, non-Gaussian outcomes and categorical fixed effects are outside this dialog. If your design needs those, lme4 in R (or a GLMM package) is the right tool, and saying so is more useful than pretending otherwise.

What it does

What Magic Stat gives you for mixed models

How it works

From clustered rows to a forest plot

  1. Load the data. one row per observation, with a column identifying the group each row belongs to.
  2. Choose the outcome. a continuous response.
  3. Pick the fixed effects. the numeric predictors whose effects you want to report.
  4. Pick the random-intercept column. the grouping factor; the dialog reports how many groups and their sizes before you run.
  5. Read and export. fixed effects, variance components and the forest plot go into the report.
Options

The settings, in the dialog

Model: linear mixed model with a random intercept per level of one grouping factor.

Estimation: REML.

Fixed effects: numeric predictors only, entered as a design matrix.

Requirements checked up front: ≥ 3 groups · ≥ 20 complete rows · no constant predictor · no constant outcome.

Frequently asked

Mixed model questions, answered honestly

Mixed model or ordinary regression?

If every row is independent, ordinary regression is simpler and sufficient. Use a mixed model when rows are grouped — repeated measures, nested units — because the grouping is real and ignoring it biases the standard errors. A mixed model is not a way to add complexity for its own sake.

Why only random intercepts?

That is what this dialog fits, and it covers the common nested design. Random slopes, crossed effects and multiple grouping factors are genuinely possible but belong in lme4; Magic Stat does not claim to do them here.

Can my fixed effects be categorical?

No — fixed predictors must be numeric in this model. A categorical predictor would need dummy coding and a different reading of the terms; if that is your design, R or JASP handle it.

Why REML, and why report AIC/BIC?

REML gives less biased variance components. The AIC/BIC are computed on the REML criterion (as lme4 reports them) so the numbers are comparable; comparing models that differ in their fixed effects under REML is not valid, and the app does not pretend otherwise.

Does my data leave the machine?

No. The model is fitted locally; the only automatic signal is an anonymous installation counter with no data in it.

GEE analysis → Repeated measures ANOVA → Linear regression →