Written and maintained by CASRAI Editorial Board
Last updated
The MIXED procedure is SPSS’s tool for fitting linear mixed models — models that combine fixed effects with random effects to handle data where observations are nested or repeated within a grouping variable, such as students within classrooms, patients within clinics, or repeated measurements within a person. It is a genuinely different engine from Repeated-Measures ANOVA and Multiple Regression: it estimates variance components for the random effects directly (via restricted maximum likelihood by default) rather than treating the grouping structure as a nuisance to be corrected for after the fact, and it does not require complete, balanced data or a wide-format layout. This guide covers what MIXED actually does, the menu path and full syntax, how to choose a covariance structure, and how to read the output.
What a linear mixed model adds over ordinary regression or ANOVA
Ordinary least-squares regression and factorial ANOVA both assume every observation is independent. That assumption breaks whenever observations are naturally grouped — repeated measurements on the same person, students in the same classroom, patients treated at the same clinic — because observations within a group tend to be more similar to each other than to observations in a different group. Ignoring that similarity inflates the apparent precision of estimates and produces standard errors, and therefore p-values, that are too small.
A linear mixed model addresses this directly by including two kinds of terms:
- Fixed effects — the predictors you want to draw conclusions about, exactly as in ordinary regression (a treatment condition, a continuous covariate, time).
- Random effects — terms that let the intercept, a slope, or both vary by group (e.g., by subject or by clinic), modeled as draws from a distribution rather than estimated as separate fixed parameters for every group.
This is the same logic as the Bayesian hierarchical model / partial-pooling approach — both let each group’s estimate borrow strength from the overall pattern rather than being estimated in complete isolation — but MIXED fits the model by (restricted) maximum likelihood rather than by sampling from a posterior distribution, and it reports the same kind of fixed-effect coefficient, standard error, and significance test that a researcher already gets from GLM or REGRESSION. For the underlying conceptual choice between treating a variable as fixed or random in the first place, see Mixed-Effects Models: Choosing Random vs. Fixed Effects for Nested Research Data; this guide picks up from that decision and covers the SPSS-specific implementation.
Where MIXED lives in the menus, and what it needs
The dialog is at Analyze > Mixed Models > Linear…. SPSS first prompts for the Subjects and, if relevant, Repeated variables — this is the identifier that defines which rows belong to the same group (a participant ID, a clinic ID) — before opening the main dialog where fixed effects, random effects, and the covariance structure are specified. This is a structural difference from GLM Repeated Measures: MIXED expects long-format data (one row per observation, with an explicit subject-identifier column), not the wide, one-row-per-subject layout GLM Repeated Measures requires. Long format is also why MIXED tolerates unbalanced designs and missing time points gracefully — a subject with 3 of 5 planned measurements still contributes those 3 rows to the model, rather than being dropped by listwise deletion the way an incomplete case is in GLM Repeated Measures.
MIXED command syntax
Pasting from the dialog (Paste button) produces syntax of this general shape:
MIXED outcome WITH covariate BY factor /FIXED = covariate factor covariate*factor | SSTYPE(3) /METHOD = REML /PRINT = SOLUTION TESTCOV /RANDOM INTERCEPT | SUBJECT(subject_id) COVTYPE(VC)
For a repeated-measures design (the same subject measured at several time points, without a separate random-slopes structure), the analogous form uses /REPEATED instead of, or alongside, /RANDOM:
MIXED outcome BY time treatment /FIXED = time treatment time*treatment /METHOD = REML /PRINT = SOLUTION /REPEATED = time | SUBJECT(subject_id) COVTYPE(UN)
Key subcommands:
- /FIXED — the fixed-effect predictors and their interactions (mandatory).
- /RANDOM — random effects (e.g.,
INTERCEPT, or a random slope) tied to aSUBJECT()clustering variable; can be repeated for multiple nested or crossed grouping factors. - /REPEATED — models the correlation among repeated observations on the same subject directly, an alternative (or complement) to /RANDOM for repeated-measures designs.
- /METHOD —
REML(default) orML. - /PRINT = SOLUTION — requests the fixed-effect coefficient table; omitted by default, so it is easy to run MIXED and get no coefficients printed at all.
- /SAVE — saves predicted values and residuals as new variables, useful for residual diagnostics.
Choosing a covariance structure
The COVTYPE() option on /RANDOM or /REPEATED controls how the variability among the random effects (or among repeated observations) is modeled:
- VC (Variance Components) — the default; assumes the random effects are independent of one another, each with its own variance. Appropriate for a simple random intercept.
- CS (Compound Symmetry) — assumes equal correlation between any two time points, with constant variance — the same assumption GLM Repeated Measures’ univariate approach makes by default.
- AR1 (First-Order Autoregressive) — correlation between time points decreases as the time gap increases; a natural choice for equally-spaced repeated measures.
- ARH1 — AR1 with a separate variance estimated at each time point, relaxing the constant-variance assumption.
- UN (Unstructured) — every variance and every pairwise covariance estimated separately, with no imposed pattern; the most flexible option but the most heavily parameterized, and can fail to converge with few time points or a small sample.
There is no single correct structure for every design — it is a genuine modeling decision, not a formality. A common workflow is to fit a small set of plausible candidates (e.g., VC, CS, AR1, UN) under ML — not REML — and compare them using Akaike’s Information Criterion (AIC) or the Bayesian Information Criterion (BIC), both printed in the Information Criteria table under Statistics options; the structure with the lower AIC/BIC is generally preferred, provided it is also substantively plausible for the data’s design. The ML requirement for structure comparison exists because REML’s likelihood is computed on a residual scale that is not directly comparable when the covariance structure itself changes — comparing REML likelihoods across structures is a genuine and common mistake, addressed further below.
REML vs. ML — which to use, and when it matters
MIXED defaults to REML (restricted maximum likelihood), which produces less biased variance-component estimates than full ML, particularly with a small number of groups — this is the estimator to leave in place for reporting a model’s final fixed-effect coefficients and their significance tests.
Switch to ML (/METHOD = ML) only when comparing two models that differ in their fixed effects, or comparing covariance structures, via a likelihood-ratio test or AIC/BIC — REML likelihoods are not valid for comparing models with different fixed-effects specifications, because REML partials out the fixed effects before estimating the variance components, which changes what is actually being compared as the fixed-effects specification changes. The standard workflow is therefore: build and compare candidate models under ML, then refit the chosen final model under REML for reporting.
Reading the output
- Fixed Effects table (from
/PRINT = SOLUTION) — coefficient (estimate), standard error, a t-test (with Satterthwaite- or Kenward-Roger–approximated degrees of freedom, not the simple n-k of ordinary regression — see Degrees of Freedom in Statistics for what df represents more generally), significance, and a confidence interval for each fixed effect. - Type III Tests of Fixed Effects — the omnibus significance test for each fixed effect and interaction, analogous to the ANOVA table in GLM.
- Estimates of Covariance Parameters — the variance component(s) for the random effect(s) and, for a repeated structure, the covariance parameters implied by the chosen COVTYPE. A near-zero random-intercept variance is a signal the grouping structure may not be adding much and a simpler model (ordinary regression) might fit comparably.
- Information Criteria (AIC, AICC, BIC) — used to compare covariance structures or non-nested fixed-effects specifications fitted under ML, as described above.
The proportion of variance attributable to the grouping structure itself — before adding any predictors — is the intraclass correlation coefficient; see Intraclass Correlation Coefficient (ICC) for how it is calculated from an “empty” (intercept-only) mixed model’s variance components and what it implies for design effects in clustered designs.
MIXED vs. GLM Repeated Measures vs. multiple regression
| Feature | GLM Repeated Measures | MIXED |
|---|---|---|
| Data layout | Wide, one row per subject | Long, one row per observation |
| Missing data | Listwise deletion drops the whole subject | Retains a subject’s available observations |
| Unbalanced designs | Requires a balanced, complete design | Handles unbalanced designs directly |
| Covariance structure | Fixed default (sphericity-corrected univariate, or multivariate); cannot customize | Fully customizable (VC, CS, AR1, ARH1, UN, and more) |
| Random slopes | Not available | Supported |
| Time-varying covariates | Not supported | Supported |
Against ordinary Multiple Regression: use MIXED whenever observations are grouped in a way that could plausibly make within-group observations more alike than between-group ones. If every observation genuinely comes from a different, unrelated case, MIXED’s random-effects machinery is unnecessary and a standard regression or ANOVA in Repeated-Measures ANOVA in SPSS or Two-Way ANOVA in SPSS is simpler and sufficient.
Common problems
- No coefficient table appears — SOLUTION is not printed by default; add
/PRINT = SOLUTION(or check the corresponding box in the Statistics dialog). - Model fails to converge with UN — an unstructured covariance matrix has the most parameters to estimate; with few time points or a small sample, try a more constrained structure (CS or AR1) first.
- Comparing REML fit statistics across models with different fixed effects — invalid; refit under ML for that comparison, as covered above.
- Treating a repeated within-subject factor as purely fixed — this collapses MIXED back into ordinary ANOVA logic and discards the reason for using MIXED in the first place; the grouping variable needs an explicit SUBJECT() specification on /RANDOM or /REPEATED.
Frequently asked questions
Is the MIXED procedure the same as multilevel modeling or hierarchical linear modeling?
Yes — “linear mixed model,” “multilevel model,” and “hierarchical linear model” describe the same underlying statistical approach (fixed effects plus group-varying random effects); MIXED is SPSS’s implementation of it. The Bayesian hierarchical model guide covers the same partial-pooling idea from a Bayesian estimation perspective rather than SPSS’s frequentist REML/ML approach.
Do I need equal group sizes or a complete dataset to use MIXED?
No. Unlike GLM Repeated Measures, MIXED handles unbalanced group sizes and missing observations (under the standard missing-at-random assumption) without discarding an entire subject’s data for one missing time point.
When should I add a random slope instead of just a random intercept?
Add a random slope when there is reason to believe the effect of a predictor (not just the baseline level) genuinely varies by group — for example, a treatment effect that differs by clinic, not just a different starting average per clinic. Specify it on /RANDOM alongside the intercept (e.g., /RANDOM = INTERCEPT time | SUBJECT(id) COVTYPE(UN)), and compare the fit against a random-intercept-only model under ML.
For related SPSS procedures, see Repeated-Measures ANOVA in SPSS, Multiple Regression in SPSS, Cluster Randomised Trials and the ICC, and SPSS Syntax: Writing Reproducible Analysis Files. For an overview of the software itself, see What Is SPSS? and, for alternatives that also fit mixed models, SPSS vs. R.








