Repeated measures ANOVA
When the same people are measured on three or more occasions, the measurements aren’t independent, so a one-way ANOVA is the wrong tool. Repeated measures ANOVA extends the paired t-test to more than two measurements, accounting for the fact that scores from the same person are related.
How it works
Total variation is split into three parts: differences between people (removed from the error term), differences between occasions (the effect being tested), and what’s left (error). Taking out person-to-person differences shrinks the error, which is why within-subject designs need fewer participants.
- H₀: the population means are equal on every occasion.
- H₁: at least one occasion’s mean differs.
Assumptions
- Participants are independent of each other.
- The outcome is continuous.
- The residuals are approximately normal, after removing each person’s and each occasion’s mean.
- Sphericity: the variances of the differences between every pair of occasions are equal.
Sphericity and its corrections
Sphericity is often violated, especially when measurements close in time correlate more than distant ones. Violations make the F test too liberal. Mauchly’s test checks it (p < .05 suggests a violation), although it has low power in small samples. The fix is to shrink the degrees of freedom by an epsilon (ε):
- Greenhouse-Geisser: the standard correction, slightly conservative.
- Huynh-Feldt: less conservative, sometimes preferred when ε is above about .75.
With only two occasions, sphericity always holds. With non-normal residuals, use the non-parametric Friedman test.
Worked example: reaction time under sleep restriction
In a sleep-deprivation study (Belenky et al., 2003; R’s lme4::sleepstudy), 18 participants were restricted to three hours of sleep a night, and their average reaction time was measured daily. We compare day 0 (baseline), day 4 and day 8.
Step 1: check the assumptions
The residuals pass Analytika’s normality check, so it chooses repeated measures ANOVA rather than the Friedman test. Mauchly’s test gives W = 0.72, p = .069, so there’s no significant violation of sphericity and no correction is needed. Analytika reports the Greenhouse-Geisser result as well (ε = .78).
Step 2: run the test
day0: mean=256.6518, n=18, sd=32.1295 day4: mean=288.6494, n=18, sd=42.5379 day8: mean=336.6295, n=18, sd=60.1997 N: 18 Conditions: 3 F-statistic: 26.4423 df: 2, 34 P-value: 1.183e-07 Sphericity correction: none Mauchly's W: 0.7153, p=0.0685 Greenhouse-Geisser epsilon: 0.7784 Huynh-Feldt epsilon: 0.8425 Greenhouse-Geisser p: 2.115e-06 Partial eta-squared: 0.6087 95% CI: [0.3771, 0.7383] Method used: paired_t_holm day0 vs day4: p_adj=0.003572, significant=yes, diff=-31.9976, ci=[-51.9813, -12.0140] day0 vs day8: p_adj=5.982e-05, significant=yes, diff=-79.9777, ci=[-108.9030, -51.0524] day4 vs day8: p_adj=0.0001944, significant=yes, diff=-47.9801, ci=[-67.9964, -27.9638] Rows excluded for missing values: 0 of 18
> fit <- lm(cbind(day0, day4, day8) ~ 1, data = ss)
> mauchly.test(fit, X = ~1)
W = 0.71526, p-value = 0.0685
> anova(fit, X = ~1, test = "Spherical")
Greenhouse-Geisser epsilon: 0.7784
Huynh-Feldt epsilon: 0.8425
Df F num Df den Df Pr(>F) G-G Pr H-F Pr
(Intercept) 1 26.442 2 34 1.1833e-07 2.1146e-06 9.1676e-07The same F, df, Mauchly’s W, epsilons and p-values, both uncorrected and Greenhouse-Geisser.
Step 3: interpret
- F(2, 34) = 26.44, p < .001: reaction time changed over the study. Even with the Greenhouse-Geisser correction, p < .001.
- Partial η² = .61, 95% CI [.38, .74]: a very large effect.
- Means rose from 256.7 ms at baseline to 288.6 ms on day 4 and 336.6 ms on day 8.
- Pairwise paired t-tests (Holm-corrected): every pair differs. Day 4 was 32.0 ms slower than baseline (95% CI 12.0 to 52.0, p = .004), and day 8 was 48.0 ms slower than day 4 (28.0 to 68.0, p < .001).
Step 4: report it (APA 7)
A one-way repeated measures ANOVA showed that reaction time changed across days of sleep restriction, F(2, 34) = 26.44, p < .001, η²p = .61, 95% CI [.38, .74]. Mauchly’s test did not indicate a violation of sphericity, W = 0.72, p = .069. Holm-corrected pairwise comparisons showed slower reaction times on day 4 (M = 288.6 ms) than at baseline (M = 256.7 ms), and on day 8 (M = 336.6 ms) than on day 4, all ps ≤ .004.
If sphericity had been violated, you would report the corrected values, for example F(1.56, 26.47) = 26.44, p < .001, ε = .78, with the df multiplied by ε.
Alternatives
- Friedman test: the rank-based version, for non-normal or ordinal data.
- Mixed-effects models: handle missing occasions without dropping participants, unequal spacing, and continuous time. They’re increasingly preferred for longitudinal data.
- Mixed ANOVA: when you also have a between-subjects factor (such as treatment vs control).
How to run it
- SPSS: Analyze → General Linear Model → Repeated Measures. Define the within-subject factor, then read the “Tests of Within-Subjects Effects” table.
- R:
afex::aov_ez()orrstatix::anova_test(). Both report Mauchly’s test and corrections. - Analytika: with data in wide format (one column per occasion), ask whether the measure changes across the columns. It checks normality, chooses RM-ANOVA or Friedman, and applies the Greenhouse-Geisser correction when sphericity fails.
References
- Belenky, G., Wesensten, N. J., Thorne, D. R., Thomas, M. L., Sing, H. C., Redmond, D. P., Russo, M. B., & Balkin, T. J. (2003). Patterns of performance degradation and restoration during sleep restriction and subsequent recovery: A sleep dose-response study. Journal of Sleep Research, 12(1), 1–12.
More in Comparing groups
Run this on your own data
Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.