MerQuR+Statistics Glossary

Statistics Glossary → Repeated Measures ANOVA

Repeated Measures ANOVAanalysis

An analysis of variance for designs in which the same people are measured at three or more times or under three or more conditions, testing whether the means differ after setting aside the lasting differences between people.

Concept

When the same patients are measured every day after surgery, or the same participants are tested under several conditions, the measurements are not independent: a patient sensitive to pain gives relatively high scores every day. Repeated measures ANOVA builds this dependence into the model. The lasting differences between people are removed as a separate source of variability, so the effect of time or condition is tested against each person's own change. With the same number of measurements, this usually gives a much more powerful test than an independent-groups design.

The total variability is split three ways: between people, between conditions, and residual (error). F = condition mean square / error mean square. A special assumption of the test is sphericity: the variances of the difference scores between every pair of conditions are equal. Mauchly's test checks this assumption. When sphericity fails, the F test becomes too optimistic; the Greenhouse-Geisser or Huynh-Feldt corrections shrink the degrees of freedom by a factor ε and correct the p value. Multivariate tests are another route that does not require sphericity.

In addition, the outcome is assumed to be approximately normal at each condition and the people to be independent of one another. The classical method drops anyone with a missing measurement from the analysis entirely; with a lot of missing data, mixed-effects models are more suitable. A significant time effect says only that at least one time point differs from the others; pairwise comparisons show where the difference lies, and polynomial contrasts show the shape of the change (a steady fall, a rise followed by a decline).

When to use it

  • When the same people or units are measured at three or more times or under three or more conditions (follow-up studies, the same participants tested with several stimuli).
  • With only two measurements the paired t-test is enough; if measurements were taken at different times for different people, or there is a lot of missing data, mixed-effects (multilevel) models are preferred.
  • If different groups are also compared (e.g. the course over time of two treatment groups), use mixed-design ANOVA; with strongly skewed distributions and a small sample, use the Friedman test.

An everyday example

In a hospital, 15 patients rate their pain on a 0-10 scale on days 1, 2, 3 and 4 after surgery. The mean pain scores are 7.2, 5.8, 4.5 and 3.9. Patients differ greatly in how sensitive they are to pain, but repeated measures ANOVA removes these lasting differences and looks at each patient's own change. If the time effect is significant, pain can be said to really decrease over the days; pairwise comparisons may show that the drop happens mainly over the first three days.

Parameters in MerQur

Confidence Level (%90, %95, %99, Other/custom 80.0-99.9)

Concept: The confidence level sets how 'sure' the intervals for differences between time points are and the threshold (α) for significance decisions. It does not change the F value itself.

Everyday example: With 95% confidence the drop in pain between day 1 and day 4 might be given as 'between 2.4 and 4.2 points'. Asking for 99% confidence widens the interval, and borderline comparisons may become non-significant.

What it does: α = 1 - confidence level; sets the decision threshold and the width of the confidence interval. The custom value is read only when "Other" is selected.

Effect on the result: F, p, ε and Mauchly W do not change. In the single-factor path the H0 decision, the Mauchly decision (p >= α) and the pairwise CI change; in the multi-factor path the EMM CIs (t(1 - α/2, N - r)) and the asterisks change.

On the validation data: exer single factor, Bonferroni time1-time2 CI 95% [-14.1267, -2.6733], 90% [-13.4357, -3.3643]. exer + diet EMM (Condition = 1) 95% [90.9329, 95.3338]. The 99.9% level changes the Mauchly decision (p = 0.0030 > 0.001).

→ Confidence level and confidence interval

Sphericity correction (None, Greenhouse-Geisser, Huynh-Feldt)

Concept: When sphericity fails, the F test produces results that look more significant than they are. The corrections shrink the degrees of freedom by a factor called ε (epsilon), which ranges from 1/(k−1) to 1: ε = 1 means sphericity holds fully, while a small ε signals a serious violation. Greenhouse-Geisser is the more cautious correction, Huynh-Feldt slightly more liberal.

Everyday example: If differences in pain scores between the early days are very spread out while those between the later days are consistent, sphericity fails. With ε = 0.6, F stays the same but the degrees of freedom are multiplied by 0.6 and the p value grows a little; if the time effect is still significant, the result is robust despite the violation.

What it does: Under a sphericity violation, multiplies the degrees of freedom of the within-subject F by ε.

Effect on the result: In the single-factor path the displayed p and df change, F does not. In the multi-factor path "None" gives all rows together (sphericity assumed, GG, HF, lower bound); GG or HF adds only that row.

On the validation data: exer F = 11.7665; uncorrected F(2, 58), p = 0.000051; GG ε = 0.7464, F(1.49, 43.29), p = 0.000312; HF ε = 0.7777, p = 0.000249. If Mauchly is significant, GG (ε < 0.75) or HF (ε > 0.75) is used (Girden, 1992).

→ Greenhouse-Geisser and Huynh-Feldt corrections

Post-hoc test (None, Bonferroni, Holm; single-factor path only)

Concept: After a significant time effect, applies a paired t-test to each pair of time points to find which differ, and corrects for the false-alarm risk of multiple comparisons. Holm is a step-wise method that is less conservative than Bonferroni while providing the same error control.

Everyday example: Four days form six pairs. With Bonferroni, the difference between day 1 and day 2 may be significant while that between day 3 and day 4 is not, showing that pain falls mainly in the first days.

What it does: Paired t tests for condition pairs with p adjustment.

Effect on the result: Post-hoc section only. This option is not read in the multi-factor path.

On the validation data: exer Bonferroni time1-time2 p = 0.0025, time2-time3 0.3741; Holm 0.0024 and 0.1247.

→ Post hoc tests (pairwise comparisons)

Mauchly sphericity test, generalized η², and descriptives (checkboxes; single-factor path only)

Concept: Mauchly's test checks the sphericity assumption; if p < α the assumption is violated. Generalised η² gives the size of the effect taking between-person differences into account, making effects from studies with different designs (repeated measures or independent groups) comparable. The descriptive table shows the mean and spread at each time point.

Everyday example: If Mauchly gives p = 0.02, sphericity is violated in the pain data and the corrected p values are used. A generalised η² of 0.25 can be set beside the effect from another study that examined pain with independent groups of patients.

What it does: Mauchly: W, p, GG/HF ε and corrected p. Generalized η² (Olejnik and Algina, 2003). Descriptives: n, mean, SD, SE, skewness, kurtosis (adjusted G1/G2).

Effect on the result: Extra rows only. With Mauchly off, the warning reads "sphericity not checked".

On the validation data: exer Mauchly W = 0.6603, p = 0.0030 (VIOLATED); generalized η² = 0.1052; time1 M = 93.1333, SD = 6.1517.

→ Mauchly's test of sphericity

Multivariate tests and lower-bound correction (checkboxes; single-factor path only)

Concept: Multivariate tests treat the differences between successive measurements together as a vector and do not require sphericity; in return they need more people than measurements and can be less powerful in small samples. The lower-bound correction pulls ε to its smallest possible value (1/(k−1)) and gives the most conservative result.

Everyday example: If sphericity is badly violated, the multivariate test gives a second opinion on the pain data that does not depend on any correction. For four days the lower bound is ε = 1/3; if the time effect is significant even with this most pessimistic correction, the result is very robust.

What it does: Multivariate: Hotelling T² on the difference scores; with one within-subject factor the four tests give the same exact F and need no sphericity. Lower bound: ε = 1/(k - 1), the most conservative correction.

Effect on the result: Extra rows only.

On the validation data: exer Pillai = 0.3488, F(2, 28) = 7.4976, p = 0.002468; lower-bound p = 0.001830.

→ Multivariate test statistics (Wilks' Λ, Pillai's trace, Hotelling-Lawley, Roy)

Polynomial contrasts (None, Linear, Quadratic, Cubic; single-factor path only)

Concept: If the time or condition levels are ordered and equally spaced, polynomial contrasts test how the means change along that order: the linear component captures a steady rise or fall, the quadratic component curvature that turns at a peak or trough, and the cubic component more complex wiggles.

Everyday example: If pain falls from 7.2 to 5.8, 4.5 and 3.9, the linear component is strong. The slowing of the drop on the last days may make the quadratic component significant too, telling that pain levels off after a while.

What it does: Gives F(1, n - 1) for equally spaced orthonormal trend contrasts.

Effect on the result: Contrast rows only. The levels are assumed to be equally spaced.

On the validation data: exer linear SS = 1915.35, F = 14.0013, p = 0.000803; quadratic F = 3.8946, p = 0.058039. dogs (4 levels) cubic F = 12.2074.

→ Polynomial (trend) contrasts

Pairwise comparisons (Δ, CI) (None, Bonferroni, Šidák, LSD; single-factor path only)

Concept: For each pair of time points, gives the mean difference, its standard error and confidence interval; since several comparisons are made, the p values and intervals can be adjusted with Bonferroni or Šidák. LSD makes no adjustment.

Everyday example: If pain fell by an average of 3.3 points from day 1 to day 4, the confidence interval says within what range this drop lies. For a doctor, 'a drop of around 3 points' is far more useful than just 'p < 0.001'.

What it does: Gives, for condition pairs, the difference, SE = SD(d)/√n, t(n - 1), the adjusted p and the adjusted CI.

Effect on the result: Pairwise comparison section only.

On the validation data: exer time1-time2: Δ = -8.4000, SE = 2.2538, t(29) = -3.727; p Bonferroni 0.0025, LSD 0.0008; 95% CI Bonferroni [-14.1267, -2.6733], LSD [-13.0095, -3.7905].

→ Post hoc tests (pairwise comparisons)

Within-subject factors (WSFACTORS)

Concept: The same people can have more than one within-subject factor, for instance both day and time of day. Each factor's main effect and the interaction between factors are then tested separately; the interaction shows whether the effect of one factor changes with the level of the other.

Everyday example: If patients give a pain score both morning and evening every day, day and time of day are two within-subject factors. The interaction tests, for example, whether evening pain falls faster than morning pain.

What it does: Defines several within-subject factors; in the cell order the first factor changes slowest.

Effect on the result: Switches to the multi-factor path.

On the validation data: O'Brien-Kaiser "phase(3) hour(5)" + treatment, gender: SS, F, p, GG/HF, Mauchly W, multivariate tests, EMM and pairwise comparisons are given for all effects.

→ Within-subject (repeated-measures) factor

Between-subjects factor(s) and Covariate(s)

Concept: A between-subjects factor is a grouping variable that separates people (e.g. treatment group); a covariate is a numeric variable measured at the person level (e.g. age). Adding them also tests whether the groups follow different courses over time, or what the covariate's effect is.

Everyday example: If half the patients take painkiller A and half take B, treatment is a between-subjects factor; the time × treatment interaction shows whether pain falls faster with one drug. Adding age as a covariate adjusts the results for age differences.

What it does: Group factors (sum-to-zero coded, Type III) and subject-level covariates (uncentred) are added to the model.

Effect on the result: Switches to the multi-factor path. An uncentred covariate warning is shown.

On the validation data: exer + diet: diet F(1, 28) = 3.147, p = 0.0869; time F(2, 56) = 11.808; diet x time F = 1.102. dogs Drug x Depleted: Mauchly W = 0.1753, Time x Drug F = 8.17 (GG p = 0.0039).

→ Between-subjects factor

Simple effects and pairwise comparisons; multiple comparison adjustment (Bonferroni, Šidák, Holm, LSD; multi-factor path only)

Concept: When an interaction is significant, the effect of one factor is tested separately at each level of the other (simple effects), and pairwise comparisons within these slices are given with a multiple-comparison adjustment. This reveals differences that the overall average effect hides.

Everyday example: If the time × treatment interaction is significant, the decline in pain over the days is tested separately for drug A and drug B; in addition, the two drugs are compared on each day. For instance, the drugs may be the same on day 1 but clearly different on day 3.

What it does: Gives the effect of each factor at the levels of the other (within-subject: Hotelling T² exact F; between-subjects: Wald F) and adjusted pairwise comparisons. At least two factors are required (a covariate is not a factor).

Effect on the result: Extra section only.

On the validation data: exer + diet, Condition | diet = 2: F(2, 27) = 6.0275, p = 0.0069 (multivariate test); diet | Condition = 1: F(1, 28) = 3.7012.

→ Simple effects

Example on real data

Data: SAS/STAT GLM documentation, dogs (Cole and Grizzle 1966)

Variables: measurement columns LogHistamine0, 1, 3, 5 (log histamine at minutes 0, 1, 3 and 5)

  • Question: Does the log histamine level in dogs differ across the four measurement times (minutes 0, 1, 3, 5)? (complete n = 15 dogs)
  • Assumption: Mauchly W = 0.0168, p < .001; sphericity is severely violated (GG ε = 0.415, HF ε = 0.436).
  • Result: The sphericity-assumed F(3, 42) = 9.65, p < .001. Because of the violation the corrected p should be used: Greenhouse-Geisser p = .004, Huynh-Feldt p = .004; the decision does not change, the time effect is significant.
  • Effect size: Partial η² = 0.41; a large effect.
  • Descriptive: Mean log histamine is -2.75 at minute 0, peaks at -1.46 at minute 1, then -1.75 at minute 3 and -1.90 at minute 5.
  • APA: F(3, 42) = 9.65, p < .001, η²p = .41; with the Greenhouse-Geisser correction (ε = 0.42) p = .004.

Related concepts

Post hoc tests (pairwise comparisons)Mauchly's test of sphericityGreenhouse-Geisser and Huynh-Feldt correctionsPolynomial (trend) contrastsSimple effectsWithin-subject (repeated-measures) factorMultivariate test statistics (Wilks' Λ, Pillai's trace, Hotelling-Lawley, Roy)Sphericity assumption

The numbers in the examples are MerQur's output on independent, publicly available validation data; see the MerQur Technical Note for details.