Sphericity & Mauchly’s Test
Info sheet · Statistics for Psychology & Neuroscience
Warning✎ Editing notes — to do / to check
Working notes for the author — not shown to students once collapsed; remove before publishing.
- [ ]
What you’ll get from this sheet
Our last stop on ANOVA. There’s a lot here, so let’s get into it. By the end you should be able to:
- List the assumptions of independent, repeated-measures, and mixed ANOVAs.
- Define sphericity — the assumption unique to repeated-measures designs.
- Run Mauchly’s test for sphericity, and apply a correction when it’s violated.
Sphericity means the variances of all pairwise differences between conditions are equal. If it’s violated, your F-ratio is inflated (effects look stronger than they are). Mauchly’s test checks it; a Greenhouse–Geisser or Huynh–Feldt correction fixes it by shrinking the degrees of freedom.
The assumptions, side by side
For an independent-samples ANOVA we assume: (1) independence of observations — one group’s data tells us nothing about another’s; (2) normality of residuals, checked with the Shapiro–Wilk test; and (3) homogeneity of variance — roughly equal group variances, checked with Levene’s test.
For a repeated-measures ANOVA, things shift. Independence is no longer assumed — the whole point is that the same people provide data across conditions. We still assume normality of residuals. And we pick up a new assumption all our own: sphericity.
What is sphericity?
Sphericity means the variances of all pairwise differences between conditions are equal. Take every pair of conditions, compute each participant’s difference score (A − B, A − C, B − C, …), and find the variance of each set of differences. If those variances are about equal, sphericity holds. If they’re wildly different, it’s violated — and that matters because a violation inflates the F-ratio, making effects look more significant than they really are.
Drag the slider to pull the pairwise-difference variances apart and watch sphericity break — and watch the correction kick in.
With the slider at zero the three variances are equal, ε = 1, and sphericity holds exactly. Pull them apart and ε drops below 1 — that’s the violation. The fix is elegant: multiply the degrees of freedom by ε before looking up the p-value. Smaller ε → fewer effective df → a larger, more honest p, undoing the F-ratio’s inflation.
Testing and correcting
Mauchly’s test has the null hypothesis that sphericity holds — so a significant Mauchly’s test means sphericity is violated. You can run it the hard way (mauchly.test() on the fitted model) or the easy way — ezANOVA() and aov_ez() report it automatically. When it’s violated, correct the degrees of freedom by an amount ε (epsilon): ε = 1 is perfect sphericity, and smaller values mean worse violations.
- Greenhouse–Geisser (GG): more conservative; use when ε is small.
- Huynh–Feldt (HF): less conservative; use when ε > 0.75 (data fairly close to sphericity).
library(afex)
fit <- aov_ez("subject", "score", data = d, within = "cond")
fit # prints GG-corrected df and p by default
summary(fit) # full table incl. Mauchly's test and HFThe aov() and Python tabs run live; afex/pingouin give the sphericity test and corrections.
TipCheck your understanding
Your within-subjects factor has only two levels. Do you need to worry about sphericity?
No. With two levels there’s only one pairwise difference (A − B), so there’s nothing for its variance to be unequal to — sphericity is automatically satisfied and Mauchly’s test doesn’t apply. Sphericity only becomes an issue once a within-subjects factor has three or more levels.
Mauchly’s test is underpowered with small samples (it can miss real violations) and oversensitive with large ones (flagging trivial departures). Many methodologists now skip the test and simply apply a Greenhouse–Geisser correction by default for any within-subjects factor with 3+ levels — the cost when sphericity actually holds is tiny.
Where this shows up next
This closes the ANOVA chapters. See Chapter (Repeated Measures) for the full assumptions-and-reporting checklist, and the mixed-effects sheets for methods that sidestep sphericity altogether.