Repeated-Measures Comparisons

Canonical reference: Maxwell, Delaney, & Kelley (MDK) ref/mdk

The omnibus test of One-Way Repeated-Measures ANOVA asks whether the population means of the conditions are all equal. A rejection establishes only that they are not: it does not say which conditions differ, by how much, or in which direction. Substantive questions are usually narrower — whether one condition differs from another, or whether a control condition differs from the average of several treatments — and each is answered by a specific comparison.

Between-subjects designs test a comparison against a single pooled within-group mean square, the setting of Linear Contrasts. A within-subjects design cannot use that yardstick: its within-condition variability still contains the stable differences among participants that the design is meant to remove. The error for a comparison must come instead from the variability of that comparison across participants. This page develops the resulting procedure. Every comparison, pairwise or complex, is reduced to one score per participant and tested with a one-sample test on those scores, and a set of comparisons is held to a familywise error rate with the Bonferroni procedure.

The running example is the hypothetical caffeine study of the parent page. Ten participants () each took a capsule containing mg (placebo), mg, mg, or mg of caffeine ( conditions), and nightly sleep duration was recorded in hours. The scores are tabulated on the parent page. The condition means, averaged over the participants and written for condition , are , , , and hours for placebo, mg, mg, and mg, and the omnibus test rejects the null hypothesis that they are equal. Which doses differ is the question the comparisons below answer.

From the omnibus test to specific comparisons

Let be the population condition means. The omnibus null hypothesis, , bundles every pattern of differences into one hypothesis, so its rejection locates none of them. A pairwise comparison tests one difference between conditions and , . A complex comparison tests a statement that involves more than two means, such as , placebo against the average of the three active doses. Each returns an estimate, a test, and an interval for exactly the quantity it defines.

Such comparisons do not depend on a preliminary omnibus rejection. A significant omnibus is not a prerequisite for the Bonferroni procedure, whose familywise guarantee holds on its own; imposing the omnibus test as a gate only makes the follow-up tests more conservative (the omnibus test and follow-up procedures). Two separate decisions do matter, and the rest of the page takes them in turn: which error term each comparison is tested against, and how the set of comparisons is protected against multiplicity.

A pooled error term or a separate one

The omnibus statistic is the ratio of the condition mean square to the participant-by-condition mean square , both defined on the parent page. The denominator measures how inconsistently the conditions differ from one participant to the next, and it is a single number for the whole design: in a complete balanced data set it equals half the average of the variances of all pairwise difference scores (Repeated-Measures Assumptions and Corrections).

If that same served as the error for every comparison, each comparison would be judged against the one average. The yardstick fits a particular comparison only if its difference scores vary as much as the average does, and it fits all of them at once only if the difference scores of every comparison have the same population variance. That condition is sphericity — the assumption the unadjusted omnibus itself relies on. The caffeine data show that it is not a technicality. The placebo-minus-400 mg differences have variance and the 100-mg-minus-200 mg differences have variance . The pooled error mean square is , corresponding to a pooled difference variance of on the same scale. That pooled value exceeds but falls below . Reused for every pair, the pooled term would therefore overstate the error for some comparisons and understate it for others.

When sphericity is doubtful, each comparison can instead be tested against its own error term, the variability of its own scores across participants. What that choice does and does not assume deserves precision:

  • Dropped: the pooling assumption. The test of one comparison no longer depends on the variances of the other comparisons.
  • Kept: independence and normality. The participants’ scores for the comparison must be independent of one another, and the population of those scores must follow a normal distribution. Dependence among the conditions within a participant is not assumed away; it is expected, and the comparison’s own score absorbs it.
  • Kept: multiplicity. Several comparisons on the same participants still accumulate Type I error across the set, and a separate error term does nothing about that.
  • Cost: degrees of freedom. A separate error term has degrees of freedom, here against the of the pooled term, so at the same tail probability, or the same familywise level, its critical values are higher than those of a pooled analysis. Interval widths do not follow from the degrees of freedom alone. Each half-width is a critical value multiplied by a standard error, and the separate and pooled standard errors are different estimates that can differ substantially; a small comparison-specific variance can more than offset the larger critical value, so a separate-error interval need not be the wider one.

Contrast scores

A comparison is specified by coefficients with , as in Linear Contrasts: picks out placebo against 400 mg, and sets placebo against the average of the three active doses. The zero-sum restriction is what makes the combination a comparison of means rather than a measure of their overall level. The population quantity is the contrast , and the null hypothesis is .

Between-subjects and within-subjects analyses estimate in exactly the same way, as a combination of the condition means. They differ in the standard error. A within-subjects analysis applies the coefficients to each participant’s own scores, giving the contrast score

where is the score of participant () in condition (). Because the coefficients sum to zero, a constant that is specific to the participant cancels: adding the same amount to all of a participant’s scores leaves unchanged. Each contrast score therefore reflects only how that participant differs across conditions, and the participant’s overall level never needs to be estimated or removed.

The contrast scores are the data for the test. Their mean,

is the same estimate that a between-subjects analysis would report. Their sample standard deviation,

is the comparison’s own error term: the extent to which the comparison varies from participant to participant. The standard error of is , and the test is the one-sample test applied to the contrast scores, with degrees of freedom ():

or, written as an test with and degrees of freedom,

The reference distribution is exact when the contrast scores are independent draws from a normal distribution with mean and common variance . No condition is placed on the variances of other contrasts, which is why the test needs no sphericity.

Stating the orientation and the scale

Two conventions must be fixed before the numbers can be read.

Orientation. The sign of depends on which condition is subtracted from which. Every difference on this page is written with the lower dose first: placebo minus 400 mg means , so a positive value indicates more sleep at the lower dose. Reversing every coefficient reverses the signs of , , and both interval limits and leaves , the -value, and the width of the interval unchanged.

Scale. The coefficients are normalized so that the positive ones sum to and the negative ones to (Choosing a scaling). The mean contrast score is then a difference between two means, in hours of sleep, and so are the intervals below. This is why each active dose carries a coefficient of in the comparison against their average.

Pairwise comparisons as the special case

A pairwise comparison assigns to one condition, to another, and to the rest. The contrast score is a difference score,

with mean and standard deviation , and the test is the paired-samples test: on degrees of freedom. With only two conditions there is a single contrast and nothing to pool, so no question about equal variances across contrasts can arise (Repeated-Measures Assumptions and Corrections); the two-condition repeated-measures of the parent page is this squared.

Worked test: placebo versus 400 mg

Does sleep duration differ between placebo and 400 mg? The table forms the ten difference scores from the data on the parent page and subtracts their mean, , to show where the variance comes from.

Participant Placebo 400 mg
1853
2963
3743
4972
5862
6532
7743
8862
9954
10752
Sum775126

Every participant slept longer after placebo than after 400 mg, by between and hours. The mean difference equals the difference between the condition means:

Grouping the squared deviations by size,

Dividing by gives the variance of the difference scores, and its square root the standard deviation:

The standard error of the mean difference, , is divided by :

The test statistic is the mean difference in standard-error units:

with a two-sided -value. In form the same test is , the square of the unrounded . The mean difference lies almost twelve standard errors from zero. The variance is the smallest of the six pairwise difference-score variances: participants agree closely on how much less they sleep after 400 mg than after placebo, and it is that agreement, as much as the size of the difference, that the statistic registers.

So far this is one test assessed on its own. Asking which doses differ means testing all six pairs, and that requires an error rate for the set.

Bonferroni control over a declared family

With conditions there are pairwise comparisons, and testing all of them on the same participants gives six opportunities for a false rejection. The family is the set of comparisons over which the error rate is controlled; here it is declared as all six pairs. At a familywise error rate of , the Bonferroni procedure tests every member of the family at the per-comparison level

The union bound that justifies the adjustment and its validity whatever the dependence among the tests are developed under The Bonferroni procedure, and apply in a within-subjects design. The requirement to define the family before examining results is treated under Planned and post hoc comparisons. Two mechanics carry the adjustment into this setting, and both come from the test on contrast scores.

Decision rule. A comparison is declared different when its unadjusted two-sided -value falls below , equivalently when exceeds the two-sided critical value . That is the number for which a variable on degrees of freedom leaves probability in each tail beyond it,

Simultaneous intervals. The interval for replaces the ordinary critical value with the same :

Each interval on its own covers its parameter with probability , so it misses with probability at most ; the probability that at least one of the intervals misses is therefore at most . All six intervals cover their six parameters simultaneously with probability at least . The bound is conservative, because it adds miss probabilities without credit for the overlap among tests that share participants, so the simultaneous coverage is at least and often more. An interval excludes zero exactly when the corresponding test rejects, so decisions can be read from the intervals alone (Simultaneous confidence intervals).

For placebo versus 400 mg the interval is

with both limits in hours. Together with the other five comparisons, and with at least confidence for the set, mean sleep duration after placebo exceeds the mean after 400 mg by between and hours. The interval adds what the decision withholds — the range of magnitudes compatible with the data, in the outcome’s own units.

All six pairwise comparisons

Comparison (hours)Unadjusted Bonferroni 95% CI (hours)Different?
Placebo − 100 mg0.70.4231.66.132No
Placebo − 200 mg1.70.4483.79.004Yes
Placebo − 400 mg2.60.22111.76Yes
100 mg − 200 mg1.00.5581.79.107No
100 mg − 400 mg1.90.5043.77.004Yes
200 mg − 400 mg0.90.5261.71.121No

All entries are computed from unrounded values and rounded for display. Three conventions govern how the table is read.

  • Each mean difference is the first-listed dose minus the second, so every row compares sleep at the lower dose with sleep at the higher dose.
  • Each row carries its own standard error , computed from that pair’s ten difference scores; is the mean difference divided by its standard error.
  • The -values are unadjusted. Each is the two-sided -value of one comparison against the distribution on degrees of freedom, and none is compared with . A comparison is declared different only when its unadjusted -value is below , equivalently when its Bonferroni interval excludes zero; the intervals share the critical value and cover all six differences simultaneously with probability at least .

What the table establishes:

  • Three differences. Sleep duration was shorter after 200 mg than after placebo, shorter after 400 mg than after placebo, and shorter after 400 mg than after 100 mg.
  • Three pairs not distinguished. The three adjacent pairs — placebo against 100 mg, 100 mg against 200 mg, and 200 mg against 400 mg — are not declared different. This is imprecision, not evidence of equivalence. Their intervals include zero, but they also include differences of , , and hours in the direction of shorter sleep at the higher dose: with ten participants the study cannot reliably separate adjacent doses, and a sizeable difference between neighboring doses remains compatible with the data.
  • Size alone does not decide. The placebo-minus-200 mg difference of hours is declared and the 100-mg-minus-200 mg difference of hour is not, because their standard errors are and : the same threshold applies to every row, and the variability of each pair’s own difference scores separates them.
  • The adjustment changes thresholds, not these verdicts. No unadjusted -value lies between and , so the same three pairs would be declared at the unadjusted level; the Bonferroni intervals are wider than ordinary intervals would be.

Taken together, the condition means fall as the dose rises, every pair two or more steps apart in the ordered dose levels is declared different, and no adjacent pair is distinguished.

A complex comparison: placebo against the average active dose

Pairwise comparisons are not the only questions the design can answer. Whether sleep after placebo differs from sleep after caffeine on average across the three doses is a complex comparison, since it involves all four means. Its coefficients, , sum to zero, and each participant’s contrast score sets that participant’s placebo night against the average of their three active nights:

Participant 1, with scores of , , , and hours, contributes

The ten contrast scores in participant order are , , , , , , , , , and ; every participant slept longer after placebo than after their own average active dose. The test is the same one-sample test. The mean contrast score is again the difference between the condition means that the coefficients define, and the standard error is :

with a two-sided -value. The displayed quantities are rounded; the standard error and the statistic are computed from unrounded values.

No separate standard-error formula is needed. Whatever the pattern of dependence among a participant’s four scores, it is carried inside that participant’s single contrast score, and measures how much those scores vary.

The result supports one statement: averaged over the three doses, participants slept hours longer after placebo than after caffeine, and the placebo mean differs from the average active-dose mean. The evidence is strong but narrow. It does not show that every active dose differs from placebo. An average can be carried by one or two of its components while another contributes nothing, and the pairwise table cannot rule that out: the 100 mg mean is not distinguished from placebo, whereas the 200 mg and 400 mg means are. The individual doses are answered by their own comparisons; the complex comparison answers only the question its coefficients pose (What a single contrast establishes).

The complex comparison is also a seventh test of the same data. If it was planned alongside the six pairwise tests, the family has members, and every one of them must be judged at , with critical value about instead of . In this example no verdict would change — the complex contrast, at , would be declared along with the three pairs — but all seven intervals would widen. The family has to match the questions actually investigated (Planned and post hoc comparisons): testing seven comparisons while correcting for six understates the error rate.

Reporting and boundaries

A follow-up analysis is reported so that every decision can be reconstructed. For each comparison, give:

  • the orientation — which condition is subtracted from which;
  • the estimate in the outcome’s units;
  • the test statistic with its degrees of freedom, as or equivalently ;
  • the -value convention — whether values are unadjusted and judged against or already adjusted — and the family size behind the level;
  • the simultaneous interval with its familywise confidence level.

One comparison then reads: sleep duration was hours longer after placebo than after 400 mg, , unadjusted , with a Bonferroni adjustment for a family of six pairwise comparisons () and a 95% familywise interval of hours.

Three boundaries keep this page in place.

  • Effect sizes for the omnibus effect and for the standardized difference between two conditions, together with the integrated report of the whole analysis, belong to One-Way Repeated-Measures ANOVA.
  • Assumptions and corrections for the omnibus test — independence, normality, sphericity, and the Greenhouse–Geisser and Huynh–Feldt epsilon corrections — belong to Repeated-Measures Assumptions and Corrections. The epsilon corrections change the reference distribution of the omnibus ; they have no counterpart in the tests on this page. A separate-error test keeps its degrees of freedom whatever the sphericity of the data, because its error term comes from the one contrast being tested. A report can therefore pair a corrected omnibus test with follow-up tests on uncorrected degrees of freedom without inconsistency.
  • Design. Order effects, counterbalancing, and carryover determine whether a difference between condition means can be attributed to the conditions themselves; the tests on this page establish mean differences, not causes (Repeated-Measures Design Considerations).
  • One-Way Repeated-Measures ANOVA supplies the design, the caffeine data, the omnibus test that the comparisons localize, and the omnibus effect sizes and reporting conventions.
  • Repeated-Measures Assumptions and Corrections defines independence, normality, and sphericity, and the epsilon corrections to the omnibus reference distribution.
  • Linear Contrasts develops the generic between-subjects machinery — coefficients, scaling, and forms, and intervals — that this page re-instantiates with contrast scores.
  • Multiple Comparisons owns per-comparison and familywise error rates, the Bonferroni procedure, and simultaneous intervals.
  • t Tests develops the paired-samples test that a pairwise comparison becomes.
  • Repeated-Measures Design Considerations treats order, counterbalancing, and carryover.