Repeated-Measures ANOVA Sphericity Guide: Mauchly's W, GG vs HF, and LMM

When analyzing three or more repeated measurements, sphericity violations inflate Type I error rates. Here is how to navigate Mauchly's test, select Greenhouse-Geisser or Huynh-Feldt epsilon corrections, bypass Python statsmodels limitations, and handle longitudinal dropout via linear mixed models.

HumanPen Team

· 12 min read

Repeated-measures ANOVA sphericity: decision rules and correction workflow

To handle sphericity in repeated-measures ANOVA with three or more levels, bypass preliminary significance gates and routinely apply epsilon degrees-of-freedom corrections to protect Type I error rates. When estimated epsilon is below 0.75 under classical rules or below 0.60 under strict robustness criteria, report the Greenhouse–Geisser (`GG`) adjustment with fractional degrees of freedom; when epsilon meets or exceeds these thresholds, report the Huynh–Feldt (`HF`) correction. If longitudinal dropout exceeds 10%, transition from listwise-deleted ANOVA to a linear mixed-effects model.

In experimental psychology, neuroscience, kinesiology, and clinical trials, repeated-measures ANOVA evaluates within-subject trajectories across sequential experimental conditions or longitudinal evaluation waves. Because repeated assessments collected from the same participant naturally share individual-level variance, standard univariate F-tests depend strictly on the sphericity assumption—the requirement that the variances of all pairwise difference scores between repeated measures are equal. When this compound symmetry condition is violated, the empirical sampling distribution of the unadjusted F-statistic departs markedly from the theoretical central F distribution, inflating false-positive rates well above the nominal alpha level and generating spurious statistical significance.

Analytical StrategyTheoretical BasisPrimary StrengthsCritical LimitationsOptimal Empirical Use Case
Greenhouse–Geisser (`GG`)Multiplies numerator and denominator degrees of freedom by sample covariance matrix shrinkage factor `ε_GG`Strictly controls Type I error rates even under severe sphericity violationsTends to underestimate population epsilon, resulting in an overly conservative test in small samplesEstimated `ε < 0.75` (or strict `ε < 0.60`), exploratory experiments, highly correlated tasks
Huynh–Feldt (`HF`)Adjusts the `GG` epsilon formula by sample size `N` and condition count `K` to correct negative biasProvides higher statistical power than `GG` when departures from sphericity are moderateCan yield epsilon values exceeding `1.0` (requiring truncation), less protective under severe violationsEstimated `ε >= 0.75` (or strict `ε >= 0.60`), balanced designs with moderate sample sizes
Linear Mixed-Effects Model (`LMM`)Estimates fixed population trajectories alongside subject-level random intercepts and slopes via maximum likelihoodRetains all observed timepoints under Missing at Random (`MAR`), accommodating participant dropoutRelies on asymptotic theory, potential singular fit warnings when random slopes are overparameterizedLongitudinal attrition, unbalanced measurement schedules, multi-wave clinical follow-ups

Selecting between adjusted repeated-measures ANOVA and linear mixed modeling depends fundamentally on experimental balance and data completeness. While Greenhouse–Geisser and Huynh–Feldt adjustments reliably restore Type I error control for balanced laboratory datasets with zero missing values, traditional ANOVA algorithms discard incomplete participant trajectories entirely. Understanding the mathematical mechanics of variance-covariance structures allows investigators to choose the optimal estimation procedure and report reproducible results.

Sphericity mechanics: Mauchly's test fragility and empirical epsilon selection rules

Mathematically, sphericity requires that the variance of the difference between any two repeated-measures levels is constant across all possible condition pairs: `Var(Y_i - Y_j) = constant` for all `i != j`. This condition requires at least three measurement levels (`K >= 3`). When an experiment includes only two repeated measures (`K = 2`), there is only a single pairwise difference score, meaning sphericity holds trivially (`ε = 1.0`) and repeated-measures ANOVA simplifies directly to a two-sided paired t-test where `` `F(1, N - 1) = t^2` ``. When `K >= 3` and sphericity is violated, Box (1954) established that the true distribution of the test statistic is approximated by reducing numerator degrees of freedom to `df_num = ε(K - 1)` and denominator degrees of freedom to `df_den = ε(K - 1)(N - 1)`. The theoretical adjustment factor epsilon (`ε`) is bounded below by its minimum value `1 / (K - 1)` (representing maximal possible violation) and bounded above by `1.0` (representing perfect sphericity).

Historically, applied textbooks advised running Mauchly's test of sphericity (`W`) as a formal gatekeeper, applying corrections only when Mauchly's test yielded `p < 0.05`. However, methodological evaluations (e.g., Blanca et al., 2023) show that Mauchly's test suffers from a fatal pre-test dilemma: in small samples (`N < 30`), it lacks statistical power to detect substantial sphericity violations, leaving researchers vulnerable to inflated Type I errors; in large samples, it flags trivial departures that have negligible impact on inference; and it is hypersensitive to departures from multivariate normality. Modern biostatistical practice strongly favors routinely applying epsilon-adjusted degrees of freedom rather than conditioning corrections on Mauchly's p-value.

When selecting between epsilon estimators, researchers must distinguish between historical heuristics and modern simulation benchmarks. The classical textbook rule proposed by Girden (1992) recommends reporting the Greenhouse–Geisser correction whenever estimated epsilon is below `0.75` (`ε_GG < 0.75`) because Huynh–Feldt overestimates epsilon under severe departures; when `ε_GG >= 0.75`, researchers report the Huynh–Feldt correction to prevent excessive conservativeness. However, comprehensive Monte Carlo simulations by Blanca et al. (2023, Frontiers in Psychology, PMC10499170) evaluated both estimators against Bradley's strict robustness criterion (where empirical Type I error must fall within `[4.5%, 5.5%]` around `α = 0.05`). Their findings demonstrate that unadjusted F-tests fail to control Type I error even when epsilon reaches `0.90`. When statistical conclusions diverge between corrections, Blanca et al. recommend reporting Greenhouse–Geisser whenever estimated epsilon is below `0.60` (`ε_hat < 0.60`), and reporting Huynh–Feldt whenever epsilon is equal to or above `0.60` (`ε_hat >= 0.60`), or defaulting conservatively to Greenhouse–Geisser across all conditions.

Bypassing the statsmodels AnovaRM trap: reliable implementations in Pingouin and R

Researchers attempting to execute repeated-measures ANOVA in Python frequently rely on `statsmodels.stats.anova.AnovaRM`. However, official documentation for `statsmodels 0.15.0` explicitly states: `"Currently, only fully balanced within-subject designs are supported. Calculation of between-subject effects and corrections for violation of sphericity are not yet implemented."` `AnovaRM` crashes immediately upon encountering unbalanced data, cannot incorporate between-subject factors for mixed factorial ANOVA, and outputs only uncorrected F-statistics without Mauchly's W or epsilon estimates. Reporting raw `AnovaRM` output without external degree-of-freedom adjustments risks publishing uncorrected F-tests with inflated false-positive rates.

  • Python `pingouin.rm_anova`: In Python, calling `pingouin.rm_anova(data=df, dv='score', within='time', subject='subject_id')` automatically executes Mauchly's test via `pingouin.sphericity`, computes Greenhouse–Geisser and Huynh–Feldt epsilon via `pingouin.epsilon`, and returns both uncorrected and corrected p-values (`p-GG-corr`).
  • Python `pingouin.mixed_anova`: For mixed factorial designs with both between-subject groups and within-subject conditions, `pingouin.mixed_anova` provides sphericity checks for all within-subject main effects and interaction terms.
  • R `afex::aov_ez`: In R, executing `afex::aov_ez(id = "subject_id", dv = "score", data = df, within = "time")` automatically calculates Greenhouse–Geisser and Huynh–Feldt epsilon values and outputs formatted ANOVA tables with fractional degrees of freedom.
  • R `rstatix::anova_test`: Running `rstatix::anova_test(dv = score, wid = subject_id, within = time, data = df)` coupled with `get_anova_table(res, correction = "auto")` applies Greenhouse–Geisser corrections automatically when sphericity is violated.

Beyond reporting F-statistics with fractional degrees of freedom, journal standards require reporting standardized effect sizes with confidence intervals. While commercial software packages like SPSS historically popularized partial eta-squared (`η²_p = SS_effect / (SS_effect + SS_error)`), methodological literature (Bakeman, 2005; Olejnik & Algina, 2003) demonstrates that partial eta-squared is not comparable across experimental designs because the denominator changes depending on whether factors are manipulated between or within subjects. Instead, generalized eta-squared (`η²_G`, labeled as `ges` in R's `rstatix` and `ng2` in Python's `pingouin`) preserves a standardized variance denominator across between- and within-subject factors, enabling valid cross-study meta-analytic comparisons. Harmonizing software parameter defaults and sums-of-squares conventions is explored further in our guide to replicating SPSS and Stata analyses in Python and R.

Longitudinal attrition: why listwise deletion breaks RM-ANOVA and when to adopt LMM

Classical repeated-measures ANOVA requires a strictly balanced complete-case data matrix. If a study collects four longitudinal measurement waves and a participant misses a single follow-up wave, standard RM-ANOVA algorithms discard the participant's entire four-wave trajectory through listwise deletion. As demonstrated by Stellato et al. (2025, BMC Medical Research Methodology, PMC12004754) in a simulation study comparing five longitudinal analysis methods, this complete-case restriction introduces severe methodological defects when participant dropout follows a Missing at Random (`MAR`) mechanism. When dropout rates reach `10%` to `40%`, repeated-measures ANOVA produces increasing bias in estimated marginal means and mean differences, alongside degrading `95% CI` coverage that drops significantly below the nominal `95%` target. Discarding valid observed human data also incurs substantial statistical power loss and raises ethical concerns.

The standard methodological solution for longitudinal attrition is to transition to likelihood-based Linear Mixed-Effects Models (`LMM`), implemented via `statsmodels.regression.mixed_linear_model.MixedLM` in Python or `lme4::lmer` in R. Mixed models operate on long-format data where each row represents an individual observation wave; specifying `missing='drop'` in Python or omitting missing rows retains all observed waves for incomplete subjects. Under Missing Completely at Random (`MCAR`) and Missing at Random (`MAR`), restricted maximum likelihood (`REML`) yields unbiased parameter estimates and maintains empirical `95% CI` coverage near `95%`, as confirmed by Stellato et al. (2025). Missing data taxonomy and handling strategies are detailed in our missing data multiple imputation and complete-case analysis guide. Note that neither RM-ANOVA nor standard LMM corrects for Missing Not at Random (`MNAR`), where dropout depends on unobserved outcomes.

Following a statistically significant omnibus main effect or interaction in either repeated-measures ANOVA or linear mixed modeling, researchers must conduct planned pairwise contrasts. For repeated-measures designs, standard independent-samples tests are invalid; pairwise comparisons must use paired t-tests or estimated marginal means (`emmeans` in R, or `pingouin.pairwise_tests` in Python). To prevent family-wise error rate inflation across multiple comparisons, researchers should apply Holm–Bonferroni adjustments (`padjust='holm'`), which maintain strict Type I error control without the excessive conservativeness of classical Bonferroni corrections.

Automated sphericity diagnostics and reproducible modeling in HumanPen Start Project

Verifying repeated-measures ANOVA assumptions, calculating fractional degrees of freedom, rendering longitudinal trajectory plots, and comparing results against linear mixed models can demand substantial programming overhead across multiple software ecosystems. Within HumanPen Start Project, researchers can execute end-to-end repeated-measures pipelines with automated sphericity checks, APA-formatted ANOVA tables with fractional degrees of freedom, and parallel mixed-model sensitivity analyses. An example of dual-language empirical validation is demonstrated in the public International Stroke Trial secondary analysis project, where complex clinical trial records were processed through verified computational workflows. Attach your data and papers, describe what you need, approve the plan before work starts, and get the reviewed report, charts, and code ready to preview online or download.

The computational sandbox supports file uploads up to 2 GB across Excel, CSV, Word, PDF, zip archives, and structured folder hierarchies. Analyses run within isolated, containerized Python and R execution environments that output fully reproducible analysis scripts, APA summary tables, and high-resolution figures adhering to the standards outlined in our scientific chart formatting and colorblind design guide. Institutional databases such as CNKI or Wind must be exported locally prior to upload, and jobs run without GPU training overhead. All user data is secured via encrypted transit, isolated per-project sandboxes, 6-month retention with 3-day expiration notices, and immediate permanent deletion on demand.

Academic integrity and methodological rigor require clear delineation of research boundaries. Statistical reports, visualization figures, and code deliverables generated through reproducible project workflows serve as structured learning and methodological reference scaffolds. The primary investigator, doctoral student, or biostatistician remains responsible for verifying data integrity, inspecting estimated covariance parameters, declaring software tools in line with institutional and journal policies, and ensuring that analytical conclusions satisfy peer-review scrutiny.

Frequently asked questions

Can sphericity be violated when an experiment has only two repeated-measures timepoints? No. Sphericity is mathematically defined as the equality of variances of all pairwise difference scores across experimental conditions. With only two repeated measures (`K = 2`), there exists only a single pairwise difference score (`Y_1 - Y_2`), meaning there are no other difference variances to compare against. Sphericity holds trivially with epsilon equal to exactly `1.0`. In this two-level scenario, univariate repeated-measures ANOVA is mathematically equivalent to a two-sided paired t-test, yielding identical p-values and an F-statistic that equals the squared t-statistic (`` `F(1, N - 1) = t^2` ``). Sphericity diagnostics and epsilon adjustments become relevant only when a within-subject factor possesses three or more levels (`K >= 3`).

If Mauchly's test is not statistically significant (p > 0.05), is it safe to report unadjusted F-tests? Methodological research strongly cautions against relying solely on a non-significant Mauchly's test. In small to moderate sample sizes (`N < 30` to `50`), Mauchly's test has notoriously low statistical power, frequently failing to reject the null hypothesis of sphericity even when population epsilon is substantially below `1.0` (such as `ε = 0.70`). In such circumstances, reporting unadjusted F-statistics leads to inflated Type I error rates. As demonstrated by Blanca et al. (2023), applying Greenhouse–Geisser or Huynh–Feldt epsilon corrections routinely protects against false positives across diverse experimental conditions. The safest reporting practice is to report the estimated epsilon value alongside the Greenhouse–Geisser or Huynh–Feldt adjusted degrees of freedom and p-value regardless of Mauchly's significance level.

How does the Greenhouse–Geisser epsilon differ from the Huynh–Feldt epsilon mathematically? The Greenhouse–Geisser epsilon (`ε_GG`) is derived directly from the estimated sample variance-covariance matrix. While it reliably bounds Type I error, it is negatively biased, meaning it tends to underestimate the true population epsilon, especially in small samples, resulting in an overly conservative F-test that slightly reduces statistical power. Huynh and Feldt developed an alternative estimator (`ε_HF`) that corrects for this negative bias, providing a less conservative test with higher power when sphericity departures are mild. However, the Huynh–Feldt formula can occasionally yield an estimated epsilon greater than `1.0`, in which case statistical software automatically caps it at `1.0`. Under classical Girden (1992) guidelines, researchers report `GG` when `ε_GG < 0.75` and `HF` when `ε_GG >= 0.75`.

Why not replace repeated-measures ANOVA with Linear Mixed Models in every longitudinal study? While Linear Mixed Models (`LMM`) offer superior flexibility—including handling missing data under MAR, accommodating unbalanced observation schedules, and modeling continuous time—repeated-measures ANOVA with epsilon adjustments remains widely used in controlled experimental laboratory paradigms. In balanced, small-sample laboratory studies (`N = 15` to `25`) with zero missing data and discrete categorical conditions (such as cognitive reaction-time tasks), repeated-measures ANOVA provides exact finite-sample F-distributions, whereas LMM relies on asymptotic likelihood theory or Satterthwaite / Kenward–Roger approximations that can face convergence warnings or singular covariance fit issues when random slopes are overparameterized.

Sources

KEEP READING