Among $k$ groups of 10 with equal means, unadjusted pairwise $t$-tests at 0.05 found a false difference in 19.7% of samples for $k = 4$ and 49.4% for $k = 8$ (30 seeds of 10,000). Testing each of $m$ comparisons at $\alpha/m$ (Bonferroni) holds the family-wise error rate to $\alpha$ under any dependence. Holm's step-down version rejects at least as much with the same guarantee; Tukey's studentized range gives exact simultaneous intervals for all pairs of equal-sized groups. A significant $F$ test protects only when all means are equal: with eight groups in two clusters, $F$-gated unadjusted tests erred in 35.6% of samples. On four NHANES age groups, all three find only the oldest group differing from the two youngest; protection roughly halves average power.
The one-way analysis of variance of systolic blood pressure in four NHANES age groups, 10 adults from each, gave $F = 5.716$ on 3 and 36 degrees of freedom, $p = 0.0026$. The four population means are not all equal, and that is all the $F$ test says. It does not say whether the oldest group differs from each of the others, or whether the three younger groups differ among themselves. Four groups make six pairs, and each pair can be tested. But six tests, each with a 5% chance of a false alarm, have together a much larger chance of producing at least one. How do we test all six pairs without letting the false alarms multiply? By testing each pair at a stricter level, chosen so that the chance of any false alarm in the whole set stays at 5%.
Multiple comparison procedures do this. They control the error rate of the whole set of comparisons rather than of each one. This article is the course's home of that error rate, the family-wise error rate, and of the Bonferroni correction that controls it.
First we measure the problem by simulation. Then we derive three procedures in order of increasing refinement:
- the Bonferroni correction, which the course text (Pagano, Gauvreau and Mattie, 2022) uses and which rests on a single inequality;
- Holm's step-down version of it, which rejects everything Bonferroni's does and sometimes more;
- Tukey's procedure, built on the exact distribution of the largest difference among the means.
All three are worked on the same NHANES sample, with the simultaneous confidence intervals each one gives. Then we show that a significant $F$ test does not make the comparisons that follow it safe, and measure what the protection costs in power. Worked problems close the article. The article assumes One-Way Analysis of Variance, whose worked sample and within-groups variance it reuses.
The problem
Back to the four age groups. The worked sample from One-Way Analysis of Variance has these group means, with the pooled within-groups variance $s_W^2 = 166.20$ on $n - k = 36$ degrees of freedom:
| Age group | $n_i$ | $\bar{x}_i$ (mm Hg) |
|---|---|---|
| 18–29 | 10 | 108.267 |
| 30–44 | 10 | 111.567 |
| 45–59 | 10 | 115.233 |
| 60 and over | 10 | 130.333 |
To compare groups $i$ and $j$, the course text uses the two-sample $t$ statistic with the within-groups variance in place of the two-group pooled variance:
$$t_{ij} = \frac{\bar{x}_i - \bar{x}_j}{\sqrt{s_W^2\left(\dfrac{1}{n_i} + \dfrac{1}{n_j}\right)}},$$
referred to a $t$ distribution with $n - k$ degrees of freedom. Using $s_W^2$ instead of the variance of the two groups alone is legitimate when all $k$ populations share a variance, the assumption the analysis of variance already makes. It gives the test 36 degrees of freedom instead of 18. Here every pair has the same standard error, $\sqrt{166.20\,(1/10 + 1/10)} = 5.765$ mm Hg.
Why $t_{ij}$ has that distribution. Suppose the populations are normal with a common variance $\sigma^2$ and $\mu_i = \mu_j$, whatever the other means are. Then $\bar{X}_i - \bar{X}_j$ is normal with mean 0 and variance $\sigma^2(1/n_i + 1/n_j)$, so
$$Z = \frac{\bar{X}_i - \bar{X}_j}{\sigma\sqrt{1/n_i + 1/n_j}}$$
is standard normal. One-Way Analysis of Variance proved that $V = (n - k)s_W^2/\sigma^2 = SSW/\sigma^2$ is chi-squared with $n - k$ degrees of freedom and independent of the group means, whether or not the means are equal (facts 1 and 3 of its proof). So $Z$ and $V$ are independent, and
$$t_{ij} = \frac{Z}{\sqrt{V/(n - k)}}$$
has the $t$ distribution with $n - k$ degrees of freedom, by the definition of that distribution in The Chi-Squared and t Distributions. The other groups enter only through $s_W^2$, so the result does not need their means to equal anything.
The family-wise error rate (FWER) is the probability that a set of tests rejects at least one true null hypothesis. For one test it is the significance level. Suppose $m$ independent tests are each run at level $\alpha$, and all their null hypotheses are true. Each test fails to reject with probability $1 - \alpha$, and by independence all $m$ fail to reject with probability $(1 - \alpha)^m$. So the family-wise error rate is $1 - (1 - \alpha)^m$, or 0.265 for six tests at 0.05. Type I and Type II Errors gives the same argument, and Significance Testing works it for comparisons of search engines.
Example (the pairwise tests are not independent). The six pairwise tests after an analysis of variance are not independent. They share the group means (the comparisons of groups 1 and 2 and of groups 1 and 3 both involve $\bar{x}_1$), and they all share $s_W^2$. For these tests the simulation below puts the actual family-wise error rate at 0.197 for four groups, below the 0.265 of the formula. Tests that share ingredients in this way tend to reject together, so their false alarms overlap, and fewer samples contain at least one. That direction is a finding of the simulation for these tests, not a rule for dependent tests in general. Dependence can also push the rate above the formula's: if no two tests could reject in the same sample, the rate would be $m\alpha$, the largest value the union bound of the next section allows.
To measure it, the script drew $k$ normal samples of 10 with equal means, for $k$ from 2 to 8. It ran all $m = \binom{k}{2}$ pairwise $t$-tests at 0.05 and counted the samples in which at least one rejected (30 seeds of 10,000 samples each, medians reported):
| Groups $k$ | Pairs $m$ | $1 - 0.95^m$ | Unadjusted pairwise tests |
|---|---|---|---|
| 2 | 1 | 0.050 | 0.050 |
| 3 | 3 | 0.143 | 0.119 |
| 4 | 6 | 0.265 | 0.197 |
| 5 | 10 | 0.401 | 0.275 |
| 6 | 15 | 0.537 | 0.353 |
| 8 | 28 | 0.762 | 0.494 |
The dependence makes the problem smaller than the independent-tests formula says, but not small. Imagine many studies in which age has no effect at all. With four groups, a fifth of them would report at least one "significant" difference between age groups; with eight groups, half would.
The usual goal is to keep the family-wise error rate at or below a chosen $\alpha$ whatever the true means are, including when some are equal and others are not. A procedure that does this controls the FWER in the strong sense. Controlling it only when all the means are equal is called weak control, and the difference matters later in the article.
The Bonferroni correction
How can a set of tests be held to $\alpha$ overall? The simplest answer is to test each comparison at a smaller level. If $m$ comparisons are made and each is tested at level $\alpha/m$, the family-wise error rate is at most $\alpha$. The proof needs one inequality.
The union bound. For any events $A_1, \ldots, A_m$,
$$P(A_1 \cup A_2 \cup \cdots \cup A_m) \le P(A_1) + P(A_2) + \cdots + P(A_m).$$
In words: the probability that at least one of several things happens is never more than the sum of their probabilities. Overlap between the events can only make the left side smaller. The inequality is also called Boole's inequality, and Bonferroni's inequality in the form used for intervals below. Learning theory applies it to the rules of a finite class instead of to tests: PAC Learning and Finite Hypothesis Classes uses it to bound the chance that any poor rule fits the training data perfectly.
Proof. By induction on $m$. For $m = 1$ the two sides are equal. For two events, the addition rule of The Rules of Probability gives $P(A \cup B) = P(A) + P(B) - P(A \cap B)$, and $P(A \cap B) \ge 0$, so $P(A \cup B) \le P(A) + P(B)$. Now suppose the inequality holds for any $m - 1$ events, and let $B = A_1 \cup \cdots \cup A_{m-1}$. By the two-event case and then the induction hypothesis,
$$P(A_1 \cup \cdots \cup A_m) = P(B \cup A_m) \le P(B) + P(A_m) \le P(A_1) + \cdots + P(A_{m-1}) + P(A_m). \qquad \blacksquare$$
The correction. Let $A_i$ be the event that comparison $i$ rejects. A test at level $\alpha/m$ rejects a true null hypothesis with probability at most $\alpha/m$. If $m_0$ of the $m$ null hypotheses are true and each is tested at level $\alpha/m$, then
$$\text{FWER} = P\Big(\bigcup_{i \text{ true null}} A_i\Big) \le \sum_{i \text{ true null}} P(A_i) \le m_0\cdot\frac{\alpha}{m} \le \alpha.$$
If no null hypothesis is true, there is nothing to reject falsely and the rate is zero. Nothing in the argument depends on how the tests are related. So the correction controls the family-wise error rate in the strong sense, for any set of tests, dependent or not. The NIST/SEMATECH e-Handbook of Statistical Methods (§7.4.7.3) states the same inequality in its complementary form, for the probability that a set of confidence intervals all cover their targets. For all pairwise comparisons among $k$ groups, $m = \binom{k}{2} = k(k-1)/2$, and the course text's significance level for each comparison is
$$\alpha^* = \frac{\alpha}{\binom{k}{2}}.$$
The procedure can be stated equivalently with adjusted $p$-values: multiply each $p$-value by $m$, cap the result at 1, and compare it with $\alpha$. The two statements agree because $p_i \le \alpha/m$ exactly when $mp_i \le \alpha$, and for $\alpha < 1$ the cap changes nothing: a product above 1 is above $\alpha$ before and after it. This is how software usually reports it (R Core Team, p.adjust documentation).
The worked example
With $k = 4$ there are $m = 6$ comparisons, and at $\alpha = 0.05$ each is tested at $\alpha^* = 0.05/6 = 0.00833$. Equivalently, a pair differs significantly when $|t_{ij}|$ exceeds $t_{36,\,1-0.05/12} = 2.7920$. With a standard error of 5.765, that means a difference in means of at least $2.7920 \times 5.765 = 16.10$ mm Hg. An unadjusted test at 0.05 would need $|t_{ij}| > 2.0281$, a difference of 11.69 mm Hg.
| Comparison | $\bar{x}_i - \bar{x}_j$ | $t_{ij}$ | $p$ | Bonferroni $p$ |
|---|---|---|---|---|
| 60+ vs 18–29 | 22.067 | 3.827 | 0.0005 | 0.0030 |
| 60+ vs 30–44 | 18.767 | 3.255 | 0.0025 | 0.0148 |
| 60+ vs 45–59 | 15.100 | 2.619 | 0.0128 | 0.0769 |
| 45–59 vs 18–29 | 6.967 | 1.208 | 0.2348 | 1 |
| 45–59 vs 30–44 | 3.667 | 0.636 | 0.5288 | 1 |
| 30–44 vs 18–29 | 3.300 | 0.572 | 0.5706 | 1 |
Unadjusted, three comparisons are significant at 0.05: the oldest group against each of the others. With the Bonferroni correction, two remain. The oldest group differs from the 18–29 and 30–44 groups. Its difference of 15.1 mm Hg from the 45–59 group, with $p = 0.0128$, does not clear the threshold of 0.00833. None of the differences among the three younger groups is significant either way.
These data come from populations whose means all differ, so every non-rejection here is a Type II error. The correction has turned one correct detection into a miss. This is the price of protection, measured below. It is also a reminder of what "not significant" means. A reader may be tempted to conclude that the 45–59 and oldest groups have the same mean. The samples say only that they cannot establish the difference; the populations in fact differ by 9.29 mm Hg.
Simultaneous confidence intervals
The correction applies to intervals as well as tests. Build each interval for $\mu_i - \mu_j$ with confidence level $1 - \alpha/m$:
$$(\bar{x}_i - \bar{x}_j) \pm t_{n-k,\,1-\alpha/(2m)}\sqrt{s_W^2\left(\frac{1}{n_i} + \frac{1}{n_j}\right)}.$$
Each misses its target with probability $\alpha/m$. By the union bound, the probability that any of the $m$ intervals misses is at most $\alpha$, so they are simultaneous $100(1-\alpha)\%$ intervals (NIST handbook, §7.4.7.3). For the worked example, they are $\pm 2.7920 \times 5.765 = \pm 16.10$ mm Hg around each difference. The interval for the oldest group against the 45–59 group is $[-1.00, 31.20]$, which contains zero, matching the test. The one against the youngest group is $[5.97, 38.16]$.
Holm's step-down procedure
Bonferroni's correction is simple, but is it wasteful? Somewhat: it tests every comparison against the same threshold, $\alpha/m$, as if all $m$ null hypotheses might be true. Once a comparison has been rejected, that worst case is no longer plausible, and the threshold for the rest can be relaxed. Holm (1979) turned this into a procedure:
- Order the $p$-values from smallest to largest, $p_{(1)} \le p_{(2)} \le \cdots \le p_{(m)}$, breaking ties in any fixed way.
- Compare $p_{(1)}$ with $\alpha/m$, $p_{(2)}$ with $\alpha/(m-1)$, and in general $p_{(r)}$ with $\alpha/(m - r + 1)$.
- Reject the hypotheses in order until the first $p$-value that exceeds its threshold; that hypothesis and all later ones are retained.
Holm's procedure rejects everything Bonferroni's does. Suppose Bonferroni's correction rejects a hypothesis: its $p$-value is at most $\alpha/m$. Let $r$ be its position in the ordering. Every earlier $p$-value satisfies $p_{(s)} \le p_{(r)} \le \alpha/m \le \alpha/(m - s + 1)$, so the procedure does not stop before position $r$. At position $r$, $p_{(r)} \le \alpha/m \le \alpha/(m - r + 1)$, so the hypothesis is rejected. The thresholds after the first are larger than Bonferroni's, so Holm's procedure can reject more. Yet it still controls the family-wise error rate in the strong sense.
Here is the idea of the proof. With $m_0$ true null hypotheses, the procedure can only reach the first true one after rejecting false ones, and by then its threshold is at most $\alpha/m_0$. A Bonferroni correction for $m_0$ tests already holds the error rate to $\alpha$.
Theorem (Holm, 1979). Suppose each true null hypothesis has a valid $p$-value: $P(p_i \le c) \le c$ for every $c$ between 0 and 1. Then Holm's procedure rejects at least one true null hypothesis with probability at most $\alpha$, whatever the dependence between the tests and whichever of the hypotheses are true.
Proof. If no null hypothesis is true there is nothing to prove. Suppose $m_0 \ge 1$ of them are true. Let $E$ be the event that every true null hypothesis has a $p$-value greater than $\alpha/m_0$. Its complement is the union of the $m_0$ events $p_i \le \alpha/m_0$, each of probability at most $\alpha/m_0$. By the union bound the complement has probability at most $m_0\cdot\alpha/m_0 = \alpha$, so $E$ has probability at least $1 - \alpha$.
On $E$, let $r$ be the position in the ordering of the first true null hypothesis. Every hypothesis before it is false, and there are only $m - m_0$ false ones. So $r - 1 \le m - m_0$, that is, $m - r + 1 \ge m_0$, and the threshold at position $r$ is $\alpha/(m - r + 1) \le \alpha/m_0$. The $p$-value at position $r$ belongs to a true null hypothesis, so on $E$ it exceeds $\alpha/m_0$, and with it the threshold. The procedure therefore stops at position $r$, if it has not stopped earlier. Either way it rejects only hypotheses before position $r$, all of which are false. So on $E$ no true null hypothesis is rejected, and the probability of rejecting any true null hypothesis is at most $P(\text{not } E) \le \alpha$. $\blacksquare$
The argument, like Bonferroni's, makes no assumption about the dependence between the tests. R's documentation for p.adjust puts the practical conclusion bluntly: "There seems no reason to use the unmodified Bonferroni correction because it is dominated by Holm's method, which is also valid under arbitrary assumptions." Holm's procedure is also a case of a general construction: Closed Testing derives it as the closure of Bonferroni tests and, for pairwise comparisons, improves on it by using the logical relations among the hypotheses.
Example (Holm on the six comparisons). In the Bonferroni table above, the third-smallest $p$-value is 0.0128, for the oldest group against the 45–59 group. Holm's threshold at rank 3 is $0.05/4 = 0.0125$. So Holm's procedure does not detect this difference that Bonferroni's missed, though only just: 0.0128 exceeds 0.0125 by 0.0003, and the procedure stops at rank 3. The full table:
| Rank | Comparison | $p$ | Threshold | Decision |
|---|---|---|---|---|
| 1 | 60+ vs 18–29 | 0.0005 | $0.05/6 = 0.0083$ | Reject |
| 2 | 60+ vs 30–44 | 0.0025 | $0.05/5 = 0.0100$ | Reject |
| 3 | 60+ vs 45–59 | 0.0128 | $0.05/4 = 0.0125$ | Stop |
| 4–6 | the three younger pairs | 0.2348 to 0.5706 | Retain |
Holm's procedure makes the same decisions as Bonferroni's here. Its adjusted $p$-value for the oldest against the 45–59 group is $4 \times 0.0128 = 0.0513$, against Bonferroni's 0.0769. The adjusted $p$-value at rank $r$ is the largest of $(m - s + 1)\,p_{(s)}$ over $s \le r$, capped at 1, so that adjusted values never decrease down the ordering. It is at most $\alpha$ exactly when the procedure rejects the hypothesis at rank $r$. The procedure rejects it when every step up to $r$ passes, that is, when $p_{(s)} \le \alpha/(m - s + 1)$ for all $s \le r$, and that says $(m - s + 1)\,p_{(s)} \le \alpha$ for all $s \le r$. Here the three products are $6 \times 0.0005$, $5 \times 0.0025$ and $4 \times 0.0128$, and the third is the largest.
Tukey's honestly significant difference
The Bonferroni and Holm procedures use only the union bound, so they must allow for the worst case. Can a procedure built for pairwise comparisons do better? Yes. For that specific family, the exact distribution of the largest comparison is known. A procedure built on it, due to John Tukey, holds the family-wise error rate at or below $\alpha$ for any means. When the means are all equal and the group sizes are equal, it holds the rate at exactly $\alpha$.
Here is the idea in one sentence. All the pairwise differences are within a margin of their targets exactly when the errors in the group means, largest minus smallest, are within that margin. So a bound on the range of the errors covers every pair at once.
The studentized range. Let $Z_1, \ldots, Z_k$ be independent standard normal variables. Let $S$ be independent of them, with $\nu S^2$ chi-squared on $\nu$ degrees of freedom (the distribution is defined in The Chi-Squared and t Distributions). The studentized range is
$$Q = \frac{\max_i Z_i - \min_i Z_i}{S},$$
the range of the $k$ values divided by an independent estimate of their standard deviation. Its distribution depends only on $k$ and $\nu$, and its upper $\alpha$ point is written $q_{k,\,\nu,\,1-\alpha}$. The NIST handbook (§7.4.7.1) gives the definition with an example. For 5 normal observations and 10 degrees of freedom, the 95th percentile is 4.65. So the range of five observations is at most 4.65 times an independent standard deviation estimate, with probability 0.95.
The connection to pairwise tests. Suppose every group has $n_0$ observations. Whatever the population means are, the standardized errors of the group means,
$$Z_i = \frac{\bar{X}_i - \mu_i}{\sigma/\sqrt{n_0}},$$
are independent standard normal variables. And $S = s_W/\sigma$ is independent of them, with $(n - k)S^2 = SSW/\sigma^2$ chi-squared on $n - k$ degrees of freedom, as proved in One-Way Analysis of Variance (facts 1 and 3 of its proof, which hold whatever the means are). The error in the estimated difference between groups $i$ and $j$ is
$$(\bar{X}_i - \bar{X}_j) - (\mu_i - \mu_j) = \frac{\sigma}{\sqrt{n_0}}(Z_i - Z_j).$$
The largest value of $\lvert Z_i - Z_j\rvert$ over all pairs is $\max Z_i - \min Z_i$, attained by the pair with the largest and the smallest $Z$. So the largest of the errors over all pairs, measured in units of $s_W/\sqrt{n_0} = \sigma S/\sqrt{n_0}$, is $(\max Z_i - \min Z_i)/S = Q$. The event $Q \le q_{k,\,n-k,\,1-\alpha}$ has probability exactly $1 - \alpha$, and it is the event that every pair satisfies
$$\big|(\bar{x}_i - \bar{x}_j) - (\mu_i - \mu_j)\big| \le q_{k,\,n-k,\,1-\alpha}\sqrt{\frac{s_W^2}{n_0}}.$$
These are Tukey's simultaneous confidence intervals for all pairwise differences. The procedure declares a pair different when its interval excludes zero, that is, when
$$|\bar{x}_i - \bar{x}_j| > \text{HSD} = q_{k,\,n-k,\,1-\alpha}\sqrt{\frac{s_W^2}{n_0}},$$
the honestly significant difference. The intervals cover all differences together with probability $1 - \alpha$ whatever the means are. A pair with equal population means can be declared different only if its interval excludes zero, its true difference, and so only if some interval misses its target, which has probability $\alpha$. So the procedure controls the family-wise error rate in the strong sense. When all the means are equal, a false declaration happens exactly when some interval misses, so the rate is exactly $\alpha$. In terms of the $t_{ij}$ statistics, it compares each $|t_{ij}|$ with $q_{k,\,n-k,\,1-\alpha}/\sqrt{2}$, since the standard error of a difference is $\sqrt{2}$ times $s_W/\sqrt{n_0}$. The NIST handbook writes the intervals in that form.
The worked example. For $k = 4$ groups and 36 degrees of freedom, $q_{4,\,36,\,0.95} = 3.8088$, and
$$\text{HSD} = 3.8088\sqrt{\frac{166.20}{10}} = 15.53 \text{ mm Hg}.$$
The differences of 22.07 and 18.77 mm Hg between the oldest group and the two youngest exceed it. The difference of 15.10 mm Hg between the oldest and the 45–59 group falls just short, with a Tukey-adjusted $p$-value of 0.0592. The decisions are the same as Bonferroni's and Holm's. Tukey's critical value on the $t$ scale, $3.8088/\sqrt{2} = 2.6932$, is a little smaller than Bonferroni's 2.7920. So its intervals are about 4% narrower: $[-0.43, 30.63]$ against $[-1.00, 31.20]$ for the oldest against the 45–59 group.
Unequal group sizes. With unequal $n_i$ the range argument no longer applies directly. The Tukey–Kramer procedure, the form for unequal sizes (Kramer, 1956), replaces $\sqrt{s_W^2/n_0}$ by $\sqrt{\tfrac{1}{2}s_W^2(1/n_i + 1/n_j)}$ for each pair. That is, it compares each $|t_{ij}|$ with $q_{k,\,n-k,\,1-\alpha}/\sqrt{2}$ as before. Its family-wise error rate is then at most $\alpha$, and in general somewhat below it (NIST handbook, §7.4.7.1): Hayter (1984) proved the conjecture that the procedure is conservative. With equal sizes it reduces to Tukey's procedure, whose rate under the complete null hypothesis is exactly $\alpha$.
Comparing the procedures
On the worked sample, all three procedures made the same decisions. Their critical values show how much they differ in other designs. For all pairwise comparisons among $k$ groups of 10, the critical values on the scale of $|t_{ij}|$ are:
| $k$ | $m$ | df | Unadjusted $t$ | Bonferroni $t$ | Tukey $q/\sqrt{2}$ | Scheffé |
|---|---|---|---|---|---|---|
| 2 | 1 | 18 | 2.101 | 2.101 | 2.101 | 2.101 |
| 3 | 3 | 27 | 2.052 | 2.552 | 2.479 | 2.590 |
| 4 | 6 | 36 | 2.028 | 2.792 | 2.693 | 2.932 |
| 5 | 10 | 45 | 2.014 | 2.952 | 2.841 | 3.212 |
| 6 | 15 | 54 | 2.005 | 3.071 | 2.954 | 3.454 |
| 8 | 28 | 72 | 1.993 | 3.245 | 3.122 | 3.870 |
With two groups all four coincide, and every procedure is the two-sample $t$-test. With more groups, the protected critical values grow with the number of comparisons. They grow much faster than the unadjusted one shrinks with the extra degrees of freedom. Bonferroni's critical value is only 3 to 4% larger than Tukey's throughout this range. For all pairwise comparisons Tukey's procedure is the better choice, as the NIST handbook (§7.4.7.3) also concludes, but the difference is modest.
The simulation measured the family-wise error rate of each procedure under the complete null hypothesis, all means equal. Tukey's procedure gave 0.049 to 0.050 for every $k$, within simulation error of the 0.05 that the theory requires. Bonferroni's was below the nominal level, from 0.042 at $k = 3$ to 0.036 at $k = 8$. The union bound ignores the overlap between the events "comparison $i$ rejects", which is large when the comparisons are dependent, and the dependence grows with the number of groups. Holm's rate was the same as Bonferroni's, as it must be under the complete null hypothesis. There both procedures reject something exactly when the smallest $p$-value is below $\alpha/m$.
Scheffé's method answers a broader question. A contrast is any combination $\sum_i c_i\mu_i$ with $\sum_i c_i = 0$. A pairwise difference is one; the average of the two younger groups against the average of the two older ones is another. A contrast is estimated by $\sum_i c_i\bar{x}_i$, whose standard error is $\sqrt{s_W^2\sum_i c_i^2/n_i}$, since the group means are independent with variances $\sigma^2/n_i$. Scheffé's procedure gives intervals that cover all contrasts simultaneously, infinitely many of them. It uses the critical value $\sqrt{(k - 1)F_{k-1,\,n-k,\,1-\alpha}}$ with each contrast's own standard error (NIST handbook, §7.4.7.2):
$$\sum_i c_i\bar{x}_i \pm \sqrt{(k - 1)F_{k-1,\,n-k,\,1-\alpha}}\;\sqrt{s_W^2\sum_i\frac{c_i^2}{n_i}}.$$
Here is the idea of the proof: among all contrasts, the largest squared $t$-like statistic is exactly $(k - 1)$ times an $F$ statistic, so bounding that one $F$ bounds every contrast at once.
Proof that the intervals cover all contrasts with probability exactly $1 - \alpha$. Let $e_i = \bar{X}_i - \mu_i$ be the error in each group mean and $\bar{e} = \sum_i n_i e_i/n$. For a contrast, $\sum_i c_i\bar{e} = 0$, so the error of its estimate is $\sum_i c_i e_i = \sum_i c_i(e_i - \bar{e})$. By the Cauchy–Schwarz inequality applied to the pairs $c_i/\sqrt{n_i}$ and $\sqrt{n_i}(e_i - \bar{e})$,
$$\Big(\sum_i c_i e_i\Big)^2 = \Big(\sum_i \frac{c_i}{\sqrt{n_i}}\cdot\sqrt{n_i}\,(e_i - \bar{e})\Big)^2 \le \Big(\sum_i\frac{c_i^2}{n_i}\Big)\Big(\sum_i n_i(e_i - \bar{e})^2\Big),$$
with equality for $c_i = n_i(e_i - \bar{e})$, which is a contrast because $\sum_i n_i(e_i - \bar{e}) = 0$. Dividing by $s_W^2\sum_i c_i^2/n_i$, the largest value over all contrasts of the squared error in units of its standard error is
$$\max_c \frac{\big(\sum_i c_i e_i\big)^2}{s_W^2\sum_i c_i^2/n_i} = \frac{\sum_i n_i(e_i - \bar{e})^2}{s_W^2} = (k - 1)F',$$
where $F'$ is the analysis-of-variance statistic of the shifted data $y_{ij} = x_{ij} - \mu_i$. Their group means are the errors $e_i$, their grand mean is $\bar{e}$, and their within-groups variance is $s_W^2$ itself, because subtracting a constant from every observation in a group does not change the deviations from the group mean. The $y_{ij}$ are independent normal observations with a common variance and all population means equal to 0, whatever the $\mu_i$ are. So the theorem of One-Way Analysis of Variance applies to them as it stands, and $F'$ has the $F$ distribution with $k - 1$ and $n - k$ degrees of freedom. Hence every contrast's error is within the stated margin exactly when $(k - 1)F' \le (k - 1)F_{k-1,\,n-k,\,1-\alpha}$, an event of probability $1 - \alpha$. $\blacksquare$
The same identity, with the group means in place of the errors, says that $(k - 1)F$ is the largest squared contrast statistic in the data. So the $F$ test rejects at level $\alpha$ exactly when at least one contrast has a Scheffé interval that excludes zero. On the worked sample, $(k - 1)F = 3 \times 5.716 = 17.148$.
The last column of the table shows the cost: for pairwise comparisons only, Scheffé's critical value is the largest of the three. It is the right tool when the comparisons of interest are chosen after looking at the data and are not all pairwise. The Normal Linear Model extends Scheffé's intervals to the coefficients of any regression, and Hotelling's T-Squared Test gives their multivariate form, for combinations of several means measured on the same subjects, and compares them with Bonferroni intervals.
Two other procedures are worth knowing by name:
- Dunnett's procedure compares several treatments with a single control group. It needs fewer comparisons than all pairs, and so gives narrower intervals.
- The Games–Howell procedure is a pairwise procedure built from Welch's unequal-variance standard errors, for groups that do not share a variance.
scipy provides both (scipy.stats.dunnett, and scipy.stats.tukey_hsd with equal_var=False).
Does a significant F test protect the comparisons?
It does not, once some of the means differ. A common belief says the corrections are unnecessary after a significant $F$ test: "the $F$ test already guarded against false alarms, so the pairwise tests can run unadjusted." The traditional practice built on it runs the analysis of variance first and makes unadjusted pairwise comparisons only if the $F$ test is significant. This is often called Fisher's least significant difference procedure. The NIST handbook (§7.4.7) also calls the $F$ test a "preliminary test" that indicates whether to investigate further, although the procedures it then describes are the protected ones of this article.
The idea is that the $F$ test acts as a gatekeeper. When all the means are equal it rejects only 5% of the time, so the pairwise tests that follow can produce a false alarm at most 5% of the time. In the simulation the gate held exactly that. Under the complete null hypothesis, the $F$-protected procedure had a family-wise error rate of 0.049 to 0.050 for every $k$.
Example (two clusters of groups). Now suppose eight groups of 10 fall into two clusters: four groups with mean 0 and four with mean 3 standard deviations. The 12 pairs within the clusters have equal means, and the $F$ gate no longer keeps the chance of a false difference among those 12 pairs near 5%. The $F$ test rejects because of the real differences between the clusters; in the script it rejected in every sample. The gate is then always open, and the unadjusted tests among the equal means run with no protection at all. Among the 12 true null comparisons, the $F$-protected procedure produced at least one false rejection in 35.6% of samples. Bonferroni's did so in 1.9%, Holm's in 4.1% and Tukey's in 2.7%.
So the $F$ test gives only weak control. It protects against false alarms when nothing is going on, which is not the situation in which comparisons are usually made.
With exactly three groups the gatekeeping does work. If all three means are equal, a false difference can be declared only when the $F$ test rejects, which has probability $\alpha$. If not all are equal, at most one of the three pairs has equal means: two pairs with equal means share a group, so all three means would be equal. So at most one true null hypothesis is tested, and its unadjusted $t$-test rejects with probability $\alpha$; requiring the $F$ test to reject as well can only lower that. Either way the family-wise error rate is at most $\alpha$. With four or more groups, a partial null hypothesis can leave several true null comparisons, as in the example of the two clusters, and the argument breaks down.
What protection costs
Every procedure above buys its control of false alarms with something. Controlling the family-wise error rate means accepting more Type II errors, and the script measured how many. It simulated the design of the worked example:
- four normal populations with the NHANES age-group means (113.18, 118.75, 127.56 and 136.85 mm Hg);
- a common standard deviation of 17.06 mm Hg;
- samples of 10 per group.
Every pair of means differs, so every rejection is correct. The table gives the share of samples in which each procedure detected each difference (30 seeds of 10,000 samples).
| Comparison | True difference (mm Hg) | Unadjusted | Bonferroni | Holm | Tukey |
|---|---|---|---|---|---|
| 60+ vs 18–29 | 23.67 | 0.856 | 0.625 | 0.636 | 0.658 |
| 60+ vs 30–44 | 18.10 | 0.636 | 0.352 | 0.382 | 0.387 |
| 45–59 vs 18–29 | 14.39 | 0.451 | 0.200 | 0.231 | 0.227 |
| 60+ vs 45–59 | 9.29 | 0.220 | 0.069 | 0.089 | 0.082 |
| 45–59 vs 30–44 | 8.81 | 0.204 | 0.062 | 0.085 | 0.074 |
| 30–44 vs 18–29 | 5.57 | 0.110 | 0.027 | 0.037 | 0.032 |
Averaged over the six differences, unadjusted tests detected 41.3%, and the protected procedures between 22.2% (Bonferroni) and 24.3% (Holm and Tukey). On average, protection roughly halves the power in this design. The loss is uneven: the largest difference keeps about three quarters of its unadjusted power, and the smallest about a quarter to a third. Holm's procedure and Tukey's gain a few points on Bonferroni's, and neither dominates the other. Tukey's is ahead for the largest differences, Holm's for the smaller ones. Once Holm's procedure has rejected the large differences, it tests the rest against relaxed thresholds.
The remedy for low power is the same as for a single test: a larger sample, planned with the multiple comparisons in mind. A study that intends to compare every pair among four groups should compute its sample size at the corrected significance level, not at 0.05. Ten adults per age group are far too few to resolve differences of 5 to 10 mm Hg between neighboring age groups, with or without correction.
Choosing a procedure
With the costs measured, the choice depends on which comparisons a study needs.
- Decide the family in advance. The correction depends on the number of comparisons, so the set of comparisons should be fixed before the data are seen. The NIST handbook (§7.4.7) makes the same point for contrasts: chosen after seeing the results, their stated confidence levels no longer hold. A study interested only in the oldest group against each other group has three comparisons, not six, and a Bonferroni correction for three.
- For all pairwise comparisons among groups of equal or similar size, Tukey's procedure gives exact simultaneous intervals and is slightly more powerful than Bonferroni's. With clearly unequal variances, the Games–Howell procedure is the pairwise analogue of Welch's analysis of variance.
- For a small, prespecified set of comparisons, or tests of any kind, Holm's procedure is the default. It needs nothing but the $p$-values, makes no assumption about their dependence, and is never less powerful than Bonferroni's. Bonferroni's remains useful for its simplicity and for intervals, which Holm's procedure does not provide.
- For contrasts chosen after looking at the data, Scheffé's method.
- The $F$ test is not required first. Tukey's and Holm's procedures control the error rate on their own. The two kinds of test can also disagree: an $F$ test can be significant with no pairwise difference significant, since the $F$ test also responds to contrasts that are not pairwise. The example below shows one.
Example (a significant $F$ with no significant pair). Take four groups of 10 with sample means $-0.5$, $-0.5$, $0.5$ and $0.5$ and $s_W^2 = 1$. The grand mean is 0, so $SSB = 10(4 \times 0.25) = 10$ and $F = (10/3)/1 = 3.333$ on 3 and 36 degrees of freedom, which exceeds $F_{3,\,36,\,0.95} = 2.8663$ ($p = 0.030$). The largest pairwise difference is 1.0. Tukey's honestly significant difference is $3.8088\sqrt{1/10} = 1.204$ and Bonferroni's critical difference is $2.7920\sqrt{2/10} = 1.249$, so neither procedure declares any pair different (the adjusted $p$-values of the largest difference are 0.133 and 0.190). What the $F$ test has detected is the contrast between the average of the first two groups and the average of the last two. Its estimate is $-1.0$ with standard error $\sqrt{4(0.25)/10} = 0.316$, a ratio of $-3.162$, beyond Scheffé's critical value of 2.932. No single pair shows the difference clearly; the two pairs of groups together do.
Family-wise control is the right standard when a single false claim is costly, as when each comparison may change a clinical decision. Genomic studies, by contrast, screen thousands of hypotheses at once. There, demanding no false positives at all leaves almost no power, and a weaker criterion is used. The false discovery rate is the expected proportion of false discoveries among the rejected hypotheses, and the procedure of Benjamini and Hochberg (1995) controls it (R Core Team, p.adjust documentation); The False Discovery Rate and the Benjamini–Hochberg Procedure proves that it does, and q-Values and the Share of True Nulls attaches a rate to each single finding. That answers a different question, about the proportion of errors among many findings rather than the chance of any error among a few. For comparing a handful of group means, the procedures above remain the standard.
Worked problems
The first problem applies the course text's Bonferroni procedure to the data of an exercise in its chapter on the analysis of variance (Pagano, Gauvreau and Mattie, 2022), whose $F$ test is worked in One-Way Analysis of Variance. The exercise itself stops at the $F$ test, and the comparisons are posed here, as are the second and third problems, on the age groups. The script recomputes every number.
Problem 1 (which tobacco-use groups differ). Baseline systolic blood pressure in four groups of patients with insulin-dependent diabetes:
| Group | $n_i$ | $\bar{x}_i$ (mm Hg) |
|---|---|---|
| Nonsmokers | 269 | 115 |
| Current smokers | 53 | 114 |
| Exsmokers | 28 | 118 |
| Tobacco chewers | 9 | 126 |
The within-groups variance is $s_W^2 = 164.09$ on 355 degrees of freedom, and the $F$ test rejected equality of the four means ($F = 2.736$, $p = 0.0435$). Find which pairs of groups differ at a family-wise level of 0.05, by the Bonferroni, Holm and Tukey–Kramer procedures.
Solution. Bonferroni's and Holm's procedures declare no pair different. The Tukey–Kramer procedure declares one: tobacco chewers against current smokers.
There are $m = \binom{4}{2} = 6$ comparisons, so $\alpha^* = 0.05/6 = 0.00833$, and Bonferroni's critical value is $t_{355,\,1-0.05/12} = 2.6531$. The group sizes differ, so each pair has its own standard error. For the tobacco chewers against the current smokers,
$$\sqrt{164.09\left(\frac{1}{9} + \frac{1}{53}\right)} = \sqrt{164.09 \times 0.12998} = 4.618, \qquad t = \frac{126 - 114}{4.618} = 2.598,$$
and $p = 2P(T_{355} \ge 2.598) = 0.0098$. All six, ordered by $p$-value:
| Comparison | Difference | Standard error | $t_{ij}$ | $p$ | Bonferroni $p$ |
|---|---|---|---|---|---|
| Chewers vs current smokers | 12 | 4.618 | 2.598 | 0.0098 | 0.0585 |
| Chewers vs nonsmokers | 11 | 4.341 | 2.534 | 0.0117 | 0.0702 |
| Chewers vs exsmokers | 8 | 4.908 | 1.630 | 0.1040 | 0.6241 |
| Exsmokers vs current smokers | 4 | 2.993 | 1.337 | 0.1822 | 1 |
| Exsmokers vs nonsmokers | 3 | 2.544 | 1.179 | 0.2390 | 1 |
| Current smokers vs nonsmokers | $-1$ | 1.925 | $-0.519$ | 0.6038 | 1 |
Bonferroni. The smallest $p$-value, 0.0098, is above 0.00833, so no comparison is significant. The simultaneous 95% interval for chewers against current smokers is $12 \pm 2.6531 \times 4.618 = [-0.25, 24.25]$ mm Hg, which just includes zero.
Holm. The first step compares the smallest $p$-value with $0.05/6$, the same threshold, and fails, so the procedure stops at once and rejects nothing. Holm's procedure can do better than Bonferroni's only after a first rejection.
Tukey–Kramer. The critical value on the $t$ scale is $q_{4,\,355,\,0.95}/\sqrt{2} = 3.6504/1.4142 = 2.5812$, smaller than Bonferroni's 2.6531. The largest statistic, 2.598, exceeds it (adjusted $p = 0.048$), and the next, 2.534, does not (adjusted $p = 0.056$). So this procedure declares the tobacco chewers' mean pressure higher than the current smokers', and nothing else.
Three things are worth noticing. Unadjusted tests at 0.05 would have declared two differences (critical value $t_{355,\,0.975} = 1.9667$). A significant $F$ test was followed by no significant pair under two of the three procedures, which is possible because the $F$ test and the pairwise procedures ask different questions. And every difference in doubt involves the nine tobacco chewers, whose mean is the least precisely known: the standard errors of their comparisons, 4.3 to 4.9 mm Hg, are well above those of the others, 1.9 to 3.0.
Problem 2 (a smaller family, chosen in advance). Suppose the study of the four age groups had stated in its protocol that only the oldest group would be compared with each of the other three. Apply the Bonferroni and Holm procedures to that family at 0.05, and give the simultaneous interval for the oldest group against the 45–59 group.
Solution. All three differences are significant under both procedures, and the interval is $[0.62, 29.58]$ mm Hg.
The family has $m = 3$ comparisons, with $p$-values 0.0005, 0.0025 and 0.0128 from the article's table. Bonferroni's threshold is $0.05/3 = 0.0167$, and all three $p$-values are below it. The Bonferroni-adjusted $p$-values are three times the originals: 0.0015, 0.0074 and 0.0385 (from the unrounded $p$-values). Holm's thresholds are $0.05/3 = 0.0167$, $0.05/2 = 0.025$ and $0.05$, and each ordered $p$-value passes its own, so Holm's procedure rejects all three as well, with adjusted $p$-values 0.0015, 0.0049 and 0.0128.
For the intervals, the critical value is $t_{36,\,1-0.05/6} = 2.5110$, so each is the difference $\pm\,2.5110 \times 5.765 = \pm 14.48$ mm Hg. For the oldest group against the 45–59 group that is $15.100 \pm 14.48 = [0.62, 29.58]$, which excludes zero.
With six comparisons the same difference was not significant (adjusted $p = 0.0769$). The data are the same; the family is smaller, and each comparison pays for fewer companions. That is legitimate only because the three comparisons were fixed before the data were seen. Choosing them afterwards, because the oldest group stood out, would be using the data twice, and the family-wise error rate would no longer be controlled.
Problem 3 (a contrast, with Scheffé's method). On the worked sample, compare the average of the two younger age groups with the average of the two older ones. Give the estimate, its standard error and Scheffé's simultaneous 95% interval.
Solution. The estimate is $-12.87$ mm Hg, with standard error 4.077 and Scheffé interval $[-24.82, -0.91]$: the two younger groups' average pressure is lower.
The contrast has coefficients $c = (\tfrac{1}{2}, \tfrac{1}{2}, -\tfrac{1}{2}, -\tfrac{1}{2})$, which sum to zero. Its estimate is
$$\frac{108.267 + 111.567}{2} - \frac{115.233 + 130.333}{2} = 109.917 - 122.783 = -12.867 \text{ mm Hg},$$
and its standard error is
$$\sqrt{s_W^2\sum_i\frac{c_i^2}{n_i}} = \sqrt{166.20 \times \frac{4(0.25)}{10}} = \sqrt{16.620} = 4.077 \text{ mm Hg}.$$
Scheffé's critical value is $\sqrt{3 \times F_{3,\,36,\,0.95}} = \sqrt{3 \times 2.8663} = 2.9324$, so the interval is
$$-12.867 \pm 2.9324 \times 4.077 = -12.867 \pm 11.95 = [-24.82, -0.91] \text{ mm Hg}.$$
It excludes zero. The ratio of the estimate to its standard error is $-3.156$, beyond 2.9324, so the contrast is significant even at Scheffé's price, which covers every contrast that could have been examined. Had this one contrast been the study's single prespecified comparison, the unadjusted interval would apply: $-12.867 \pm 2.0281 \times 4.077 = [-21.13, -4.60]$, with $p = 0.0032$. An average of two groups is more precisely known than either group's mean: the contrast's standard error is 4.077 mm Hg, against 5.765 for a pairwise difference.
What we have learned
Six unadjusted tests among four groups produce a false difference in about a fifth of samples when no difference exists. The Bonferroni correction tests each at $\alpha/m$ and holds the family-wise error rate to $\alpha$ by the union bound alone. Holm's step-down version rejects at least as much, and Tukey's studentized range gives exact simultaneous intervals for all pairs; its rank-based counterpart, Nemenyi's critical difference, compares systems across many tasks in Comparing Systems Across Many Tasks. On the age groups, all three found the oldest group above the two youngest and could not establish the other four differences. A significant $F$ test does not make unadjusted comparisons safe, and protection roughly halves the average power of the comparisons in the design simulated here. For thousands of hypotheses, or hypotheses chosen after looking at the data, the library's Multiple Testing unit takes the theory further.
The tests of this unit, from the $F$ test to the pairwise $t$-tests and Tukey's range, all assume normal populations, and all but Welch's analysis of variance and the Games–Howell procedure also assume a common variance. Bonferroni's and Holm's corrections need only valid $p$-values, but here the $p$-values come from $t$-tests. For skewed data or outliers, a different idea is needed: compare ranks instead of values. The next topic, Nonparametric Methods, begins with the sign test and the Wilcoxon signed-rank test for paired data, and reaches several groups with the Kruskal–Wallis test.
In Python
import numpy as np
from scipy import stats
g1 = [114.7, 110.7, 110.0, 114.0, 118.7, 114.0, 96.7, 100.0, 110.0, 94.0] # 18-29
g2 = [116.0, 116.7, 131.3, 110.7, 112.7, 88.7, 96.0, 121.3, 95.0, 127.3] # 30-44
g3 = [108.0, 112.7, 137.0, 103.3, 116.7, 114.0, 108.7, 112.7, 106.0, 133.3] # 45-59
g4 = [144.7, 156.0, 108.7, 134.0, 110.0, 122.7, 144.0, 126.0, 142.0, 115.3] # 60+
res = stats.tukey_hsd(g1, g2, g3, g4)
print(res.pvalue.round(4)) # res.pvalue[3, 2], 60+ vs 45-59: 0.059
print(res.confidence_interval(0.95).low) # Tukey's simultaneous 95% intervals (low ends)
def bonferroni(p):
return np.minimum(1, len(p) * np.asarray(p))
def holm(p):
p = np.asarray(p)
order = np.argsort(p)
adj = np.minimum(1, (len(p) - np.arange(len(p))) * p[order])
out = np.empty_like(adj)
out[order] = np.maximum.accumulate(adj)
return out
p = [0.0005, 0.0025, 0.0128, 0.2348, 0.5288, 0.5706]
print(bonferroni(p)) # 0.003, 0.015, 0.0768, 1, 1, 1
print(holm(p)) # 0.003, 0.0125, 0.0512, 0.7044, 1, 1
The $p$-values in the last lines are the rounded ones from the table, so the adjusted values differ from the table's in the last digit. The function tukey_hsd uses the Tukey–Kramer form when the group sizes differ and the Games–Howell procedure with equal_var=False. In R, p.adjust(p, method = "holm") and TukeyHSD do the same. In statsmodels, multipletests applies the Holm–Šidák procedure unless a method is named; Inferential Statistics in Python covers that default, and finds that 14 uncorrected tests on random labels report a difference 43% of the time. Every number in this article is computed by tools/experiments/applied-statistics/multiple-comparisons-and-bonferroni.py in the site's repository, which implements the studentized range distribution by numerical integration and was checked against scipy 1.17.1.
References
- Benjamini, Y., and Hochberg, Y. (1995). Controlling the false discovery rate: a practical and powerful approach to multiple testing. Journal of the Royal Statistical Society, Series B, 57(1), 289–300. record · 6 pages
- Hayter, A. J. (1984). A proof of the conjecture that the Tukey–Kramer multiple comparisons procedure is conservative. The Annals of Statistics, 12(1), 61–75. record
- Holm, S. (1979). A simple sequentially rejective multiple test procedure. Scandinavian Journal of Statistics, 6(2), 65–70. record · 2 pages
- Kramer, C. Y. (1956). Extension of multiple range tests to group means with unequal numbers of replications. Biometrics, 12(3), 307–310. record
- National Center for Health Statistics (2020). National Health and Nutrition Examination Survey 2017–2018: Demographic Variables and Sample Weights (DEMO_J) and Blood Pressure (BPX_J) data files. Centers for Disease Control and Prevention. https://wwwn.cdc.gov/nchs/nhanes/continuousnhanes/default.aspx?BeginYear=2017 record · 109 pages
- NIST/SEMATECH. e-Handbook of Statistical Methods, §7.4.7 (How can we make multiple comparisons?), §7.4.7.1 (Tukey's method), §7.4.7.2 (Scheffé's method) and §7.4.7.3 (Bonferroni's method). National Institute of Standards and Technology. https://www.itl.nist.gov/div898/handbook/ record · 37 pages
- Pagano, M., Gauvreau, K., and Mattie, H. (2022). Principles of Biostatistics (3rd ed.). CRC Press. The course text. record · 48 pages
- R Core Team.
p.adjust: Adjust P-values for Multiple Comparisons. Documentation for package stats, R. https://stat.ethz.ch/R-manual/R-devel/library/stats/html/p.adjust.html record - SciPy.
scipy.stats.tukey_hsd. SciPy reference documentation. https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.tukey_hsd.html record
Reviewed: verified, 16 Nov 2026 · checked against sources, 23 Nov 2026 · citations checked, 16 Nov 2026 · editorial review, 23 Nov 2026 · 15 revisions