Skip to main content

Biostatistics in Practice: Principles and Procedures - A MedCalc companion e-book

Repeated-Measures ANOVA

Repeated-measures ANOVA is used when the same subjects are measured under three or more conditions or at three or more time points. Because all measurements come from the same individuals, consecutive observations on the same subject are correlated — and that correlation is an asset rather than a nuisance. By isolating and removing the variability between subjects from the error term, repeated-measures designs are considerably more powerful than independent-groups designs of the same total sample size: the same treatment effect can be detected with far fewer participants. The price of this efficiency is an additional assumption — sphericity — that must be checked and, when violated, corrected for. When the normality assumption cannot be met, the Friedman test provides a non-parametric alternative.

The Repeated-Measures Design

In the simplest, single-factor design, a group of subjects is measured repeatedly under different conditions or at different time points — the only factor is the within-subjects factor (condition, time, or treatment). The question is whether the mean response differs across the levels of that factor.

A two-factor design adds a between-subjects factor: subjects are divided into groups (for example, a treatment arm and a control arm), and each subject is still measured repeatedly. This design allows three questions to be asked simultaneously:

The interaction is usually the most clinically interesting question in a two-factor design: it tests whether the treatment modifies the trajectory of the outcome over time.

The Sphericity Assumption

One-way ANOVA for independent groups assumes that the population variance is the same in all groups. The analogous assumption for repeated-measures ANOVA is sphericity: the variances of the differences between every pair of conditions must be equal. When there are only two time points, sphericity is automatically satisfied. With three or more, it is a genuine constraint that must be checked.

Mauchly's test provides a formal check. A significant result ($P < 0.05$) indicates that the sphericity assumption is violated. When sphericity is violated, the standard F-test is anti-conservative — it produces too many false positives — so a correction to the degrees of freedom is applied, making the test more stringent.

Two corrections are available, both based on a quantity called epsilon (ε), which measures how severely sphericity is violated. A value of ε = 1 indicates perfect sphericity; smaller values indicate greater violation.

In practice, when the two corrections give very similar results — or when both corrected P values are clearly significant or clearly non-significant — the choice between them rarely matters for the conclusion.

Post-Hoc Comparisons and Trend Analysis

A significant within-subjects F-test establishes that the means are not all equal across conditions, but does not say which specific pairs of conditions differ. Pairwise comparisons with Bonferroni correction examine every pair of time points or conditions, controlling the family-wise error rate at 5%.

Trend analysis partitions the within-subjects effect into polynomial components — linear, quadratic, and cubic trends. This is most useful when the factor is an ordered quantitative variable such as dose or time. A significant linear trend indicates a steady increase or decrease; a significant quadratic trend indicates an acceleration or deceleration in that change (a curve); a significant cubic trend indicates a more complex pattern with two inflections. Identifying the dominant trend can be more informative than reporting a collection of pairwise comparisons, particularly when many time points are involved.

Worked Example

Twelve patients with type 2 diabetes begin a new hypoglycaemic regimen and have HbA1c (%) measured at baseline and at 3, 6, and 12 months:

Baseline 3 months 6 months 12 months
Mean HbA1c (%)8.47.67.27.0
SD0.90.80.80.7

HbA1c falls from baseline through to 6 months and then appears to plateau. Mauchly's test gives $W = 0.61$, $P = 0.042$, indicating that sphericity is violated. The Greenhouse–Geisser estimate of ε is 0.72, which is below 0.75, so the Greenhouse–Geisser correction is applied. The corrected within-subjects F-test is highly significant ($P < 0.001$), confirming that HbA1c changed significantly over the 12 months.

Bonferroni-corrected pairwise comparisons show that:

Trend analysis confirms a significant linear trend ($P < 0.001$) and a significant quadratic trend ($P = 0.018$), consistent with a decline that levels off — the plateau visible in the data.

The clinical interpretation is straightforward: treatment produced a meaningful and sustained reduction in HbA1c of approximately 1.4 percentage points, with most of the improvement occurring within the first six months.

MedCalc computes repeated-measures ANOVA with sphericity corrections, trend analysis, and Bonferroni post-hoc comparisons in its Repeated measures ANOVA procedure.