Unit 8, lesson 58

Planned Contrasts, Post-Hoc Comparisons and Multiple Testing

How planned contrasts differ from post-hoc comparisons, how Bonferroni, Holm and Tukey methods control the family-wise error rate, and how the Benjamini-Hochberg procedure controls the false discovery rate.

  • Video 58
  • Comparing Several Means

A study compares three training methods on several outcomes in two subgroups, and one comparison out of many gives a p-value of 0.030.03. How convincing is that? If 2020 independent tests of true null hypotheses each reject with probability exactly 0.050.05, the chance that at least one of them rejects is about 6464 percent. This lesson shows how to state in advance which comparisons answer the research question, how to define the family of claims, and how the Bonferroni, Holm, Tukey and Benjamini-Hochberg methods control two different kinds of error across that family.

Key terms

Planned contrast and post-hoc comparison

Definition For population means μ1,…,μk\mu_1, \dots, \mu_k, a contrast is a combination

L=∑j=1kcjμj,∑j=1kcj=0,\begin{gathered} L = \sum_{j=1}^{k} c_j\mu_j, \\[0.4em] \sum_{j=1}^{k} c_j = 0, \end{gathered}

with coefficients cjc_j that are not all zero. It is estimated by L^=∑jcjyˉj\hat{L} = \sum_j c_j\bar{y}_j. Under the one-way ANOVA model, with independent normal errors of common variance, the estimated standard error and the test statistic for H0 ⁣:L=0H_0\colon L = 0 are

SE⁡(L^)=MSW∑jcj2nj,t=L^SE⁡(L^),\begin{gathered} \operatorname{SE}(\hat{L}) = \sqrt{\text{MS}_{\text{W}} \sum_{j} \frac{c_j^2}{n_j}}, \\[0.4em] t = \frac{\hat{L}}{\operatorname{SE}(\hat{L})}, \end{gathered}

and tt has a t distribution with N−kN - k degrees of freedom when L=0L = 0. A planned contrast is chosen from the research question before the data are seen and is recorded in the analysis plan. A post-hoc comparison is chosen after looking at the results, for example the pair of groups whose means differ most. An ordinary p-value or interval for a post-hoc comparison ignores how it was selected. A valid post-hoc analysis uses a method that covers every comparison that could have been selected, and otherwise the result is reported as exploratory.

In plain words Coefficients that sum to zero make the combination a comparison, since shifting every mean by the same amount leaves it unchanged. A planned contrast turns the research question into one number with its own uncertainty. A comparison picked because it looked large looks large partly by chance, so testing it as if it had been planned overstates the evidence.

Example Take the constructed training data of the one-way ANOVA lesson, with means 44, 66 and 88 minutes for methods A, B and C, three people per method, and MSW=4\text{MS}_{\text{W}} = 4 with 66 degrees of freedom. Suppose the analysis plan, written before the data were seen, asks whether C differs from the average of A and B. That planned contrast uses the coefficients −12-\tfrac12, −12-\tfrac12 and 11, so

L^=8−12⋅4−12⋅6=3\hat{L} = 8 - \tfrac12 \cdot 4 - \tfrac12 \cdot 6 = 3

minutes. The sum ∑jcj2/nj\sum_j c_j^2/n_j is (14+14+1)/3=12(\tfrac14 + \tfrac14 + 1)/3 = \tfrac12, so SE⁡(L^)=4⋅12=2≈1.414\operatorname{SE}(\hat{L}) = \sqrt{4 \cdot \tfrac12} = \sqrt{2} \approx 1.414 minutes. Then t≈2.121t \approx 2.121 with 66 degrees of freedom, and the two-sided p-value is about 0.0780.078. With the critical value t0.975, 6≈2.447t_{0.975,\,6} \approx 2.447, the 95 percent confidence interval is 3±3.463 \pm 3.46, from about −0.46-0.46 to 6.466.46 minutes. The data are compatible with no difference and with a difference of several minutes.

Family-wise error rate

Definition A family is the set of hypotheses whose conclusions are reported and interpreted together, fixed before the results are seen. If VV is the number of true null hypotheses in the family that are rejected, the family-wise error rate is

FWER=P(V≥1),\text{FWER} = P(V \ge 1),

the probability of at least one false rejection. A procedure controls the FWER at level α\alpha if this probability is at most α\alpha whichever of the null hypotheses are true. When mm true null hypotheses are each tested with rejection probability exactly α\alpha and the tests are independent, the FWER is 1−(1−α)m1 - (1 - \alpha)^m. Without independence the exact value depends on the dependence, and it is at most min⁡(1,mα)\min(1, m\alpha).

In plain words Each test at level 0.050.05 has a small chance of a false alarm, but a family of many tests offers many chances. Controlling the FWER keeps the chance of even one false claim in the whole family at or below the chosen level. The family should match the set of conclusions readers are asked to trust, not be narrowed afterward to the one favorable result.

Example For 2020 independent tests of true null hypotheses, each rejecting with probability exactly 0.050.05,

1−0.9520≈0.642.1 - 0.95^{20} \approx 0.642 .

The expected number of false rejections is 20⋅0.05=120 \cdot 0.05 = 1 whether or not the tests are independent. Dependence changes the probability of at least one. If the 2020 tests were the same test repeated, it would stay 0.050.05, and for other dependence structures it can be anywhere between 0.050.05 and 11.

Bonferroni correction

Definition For a family of mm hypotheses with p-values p1,…,pmp_1, \dots, p_m, the Bonferroni correction rejects HiH_i when pi≤α/mp_i \le \alpha/m, or equivalently when the adjusted p-value min⁡(1,mpi)\min(1, mp_i) is at most α\alpha. Suppose each p-value is valid, meaning that P(pi≤u)≤uP(p_i \le u) \le u for every uu in [0,1][0, 1] when HiH_i is true. If I0I_0 is the set of the m0m_0 true null hypotheses, the union bound gives

FWER≤∑i∈I0P(pi≤αm)≤m0 αm≤α,\begin{aligned} \text{FWER} &\le \sum_{i \in I_0} P\bigl(p_i \le \tfrac{\alpha}{m}\bigr) \\[0.4em] &\le m_0\,\frac{\alpha}{m} \le \alpha, \end{aligned}

with no assumption about dependence between the tests. In the same way, mm confidence intervals, each with confidence level 1−α/m1 - \alpha/m, all cover their parameters simultaneously with probability at least 1−α1 - \alpha.

In plain words Split the error budget α\alpha evenly among the mm tests. The chance of at least one false rejection is at most the sum of the individual chances, so it cannot exceed α\alpha. The price is power, since with many tests each threshold becomes small, and the actual FWER can fall far below α\alpha when the tests are strongly positively dependent.

Example Take the p-values 0.010.01, 0.030.03 and 0.200.20 with α=0.05\alpha = 0.05 and m=3m = 3. The threshold is 0.05/3≈0.01670.05/3 \approx 0.0167, so only the first hypothesis is rejected. The adjusted p-values are 0.030.03, 0.090.09 and 0.600.60. Three separate 95 percent intervals do not in general cover all three parameters with probability 95 percent, but three intervals at the level 1−0.05/3≈98.31 - 0.05/3 \approx 98.3 percent do so with probability at least 95 percent. For three independent tests of true null hypotheses whose p-values are uniform on [0,1][0, 1], the Bonferroni FWER is 1−(1−0.05/3)3≈0.0491 - (1 - 0.05/3)^3 \approx 0.049, just below 0.050.05.

Holm procedure

Definition Order the p-values as p(1)≤p(2)≤⋯≤p(m)p_{(1)} \le p_{(2)} \le \dots \le p_{(m)}, with matching hypotheses H(1),…,H(m)H_{(1)}, \dots, H_{(m)}. Holm’s procedure compares p(i)p_{(i)} with

αm−i+1,\frac{\alpha}{m - i + 1},

starting at i=1i = 1. It rejects H(1),H(2),…H_{(1)}, H_{(2)}, \dots in turn while each p-value is at or below its threshold, and stops at the first one that is above. That hypothesis and all later ones are not rejected, and if no p-value fails, all are rejected. With valid p-values and any dependence, Holm controls the FWER at α\alpha, and it rejects every hypothesis that Bonferroni rejects, sometimes more. The Holm-adjusted p-values are the running maxima of min⁡(1,(m−i+1)p(i))\min\bigl(1, (m - i + 1)p_{(i)}\bigr) taken in order from i=1i = 1, and a hypothesis is rejected when its adjusted value is at most α\alpha.

In plain words Holm starts with the strict Bonferroni threshold for the smallest p-value and relaxes the threshold by one step after each rejection. The stopping rule is part of the guarantee, so once a p-value fails, no later hypothesis is rejected, even one whose p-value is below its own threshold. Keep the original labels attached to the sorted p-values so that each decision returns to the right hypothesis.

Example The sorted p-values 0.010.01, 0.030.03 and 0.200.20 meet the thresholds 0.05/3≈0.01670.05/3 \approx 0.0167, 0.05/2=0.0250.05/2 = 0.025 and 0.050.05. The first is below 0.01670.0167, so its hypothesis is rejected. The second is above 0.0250.025, so the procedure stops and neither of the last two hypotheses is rejected. The adjusted p-values are 3⋅0.01=0.033 \cdot 0.01 = 0.03, then 2⋅0.03=0.062 \cdot 0.03 = 0.06, then max⁡(0.06,0.20)=0.20\max(0.06, 0.20) = 0.20. The rejection says only that the first effect is not zero. Its size belongs in an estimate with an interval, preferably a simultaneous interval for the same family.

False discovery rate and the Benjamini-Hochberg procedure

Definition Let RR be the number of rejected hypotheses and VV the number of rejected null hypotheses that are actually true. The false discovery proportion is V/max⁡(R,1)V/\max(R, 1), which is 00 when nothing is rejected, and the false discovery rate is its expectation

FDR=E ⁣(Vmax⁡(R,1)).\text{FDR} = E\!\left(\frac{V}{\max(R, 1)}\right).

The Benjamini-Hochberg procedure at level qq orders the mm p-values, finds the largest ii with

p(i)≤im q,p_{(i)} \le \frac{i}{m}\,q ,

and rejects H(1),…,H(i)H_{(1)}, \dots, H_{(i)}, even if some of the smaller p-values were above their own thresholds. If no such ii exists, nothing is rejected. When the p-values of the true null hypotheses are independent of each other and of the remaining p-values, or under a certain kind of positive dependence, the procedure keeps the FDR at most qm0/m≤qqm_0/m \le q. Under arbitrary dependence that guarantee can fail, and the Benjamini-Yekutieli variant, which replaces qq by q/(1+12+⋯+1m)q/(1 + \tfrac12 + \dots + \tfrac1m), restores it. When every null hypothesis is true, every rejection is false, so the FDR equals the FWER.

In plain words The FWER asks how likely any false claim is. The FDR asks what fraction of the claims are false, on average over repeated use of the procedure. That suits screening many outcomes for follow-up, where a few false leads among many true ones are acceptable. With q=αq = \alpha, Benjamini-Hochberg rejects every hypothesis that Holm rejects and often more. An FDR of 5 percent does not mean that 5 percent of this study’s discoveries are false. The proportion in one study can be larger or smaller.

Example With q=0.05q = 0.05 and m=3m = 3, the thresholds are 0.01670.0167, 0.03330.0333 and 0.050.05. For the sorted p-values 0.010.01, 0.030.03 and 0.200.20, the second is below 0.03330.0333 and the third is above 0.050.05, so the largest passing rank is 22 and the first two hypotheses are rejected. Holm rejected only one. Neither calculation is wrong, since the two procedures control different error rates. The Benjamini-Hochberg adjusted p-values, the running minima of min⁡(1,mp(i)/i)\min\bigl(1, mp_{(i)}/i\bigr) taken from i=mi = m down to i=1i = 1, are 0.030.03, 0.0450.045 and 0.200.20.

Tukey procedure

Definition Consider the family of all k(k−1)/2k(k - 1)/2 pairwise differences μi−μj\mu_i - \mu_j in a one-way design with independent normal errors, a common variance and equal group sizes nn. Tukey’s procedure gives the intervals

h=qα; k, νMSWn,(yˉi−yˉj)±h,\begin{gathered} h = q_{\alpha;\,k,\,\nu}\sqrt{\frac{\text{MS}_{\text{W}}}{n}}, \\[0.4em] (\bar{y}_i - \bar{y}_j) \pm h, \end{gathered}

where ν=N−k\nu = N - k and qα; k, νq_{\alpha;\,k,\,\nu} is the upper α\alpha point of the studentized range distribution. That is the distribution of the range of kk independent standard normal variables divided by an independent χν2/ν\sqrt{\chi^2_\nu/\nu}. All the intervals cover their differences simultaneously with probability 1−α1 - \alpha, so declaring a pair different when its interval excludes 00 controls the FWER at α\alpha for the family of all pairs. With unequal group sizes the Tukey-Kramer version replaces MSW/n\sqrt{\text{MS}_{\text{W}}/n} by (MSW/2)(1/ni+1/nj)\sqrt{(\text{MS}_{\text{W}}/2)(1/n_i + 1/n_j)}, and its joint coverage is at least 1−α1 - \alpha. The procedure does not need a significant F test first. It covers only the pairwise family, not other contrasts, other outcomes or subgroups, and unequal variances call for a different pairwise method.

In plain words The pair with the largest and smallest means gives the most extreme of all pairwise comparisons, and the studentized range is the distribution of exactly that extreme when the means are equal. Using its critical value for every pair accounts for the fact that the pair that looks most different may have been picked for that reason.

Example For the training data k=3k = 3, n=3n = 3, MSW=4\text{MS}_{\text{W}} = 4 and ν=6\nu = 6, and q0.05; 3, 6≈4.339q_{0.05;\,3,\,6} \approx 4.339, so h≈4.3394/3≈5.01h \approx 4.339\sqrt{4/3} \approx 5.01 minutes. The intervals are 2±5.012 \pm 5.01 for B minus A and for C minus B, and 4±5.014 \pm 5.01, from about −1.01-1.01 to 9.019.01, for C minus A. All three contain 00. Now suppose someone notices that C minus A is the largest difference and runs an ordinary t test on it. That gives t=4/4(13+13)=6≈2.449t = 4/\sqrt{4(\tfrac13 + \tfrac13)} = \sqrt{6} \approx 2.449 with 66 degrees of freedom and a p-value of about 0.04980.0498, just below 0.050.05. When all three population means are equal, testing the largest of the three differences in that way rejects about 11 percent of the time under this model, not 5 percent. Bonferroni intervals for the three pairs would have half-width about 5.375.37, wider than Tukey’s, because Tukey uses the exact joint distribution for this family.

Check yourself

  1. A family of three hypotheses, declared in advance, gives the p-values 0.0040.004, 0.020.02 and 0.040.04. Apply Holm’s procedure at α=0.05\alpha = 0.05 and compare the result with Bonferroni.
Show the answer

The Holm thresholds are 0.05/3≈0.01670.05/3 \approx 0.0167, 0.05/2=0.0250.05/2 = 0.025 and 0.050.05. The value 0.0040.004 is below 0.01670.0167, then 0.020.02 is below 0.0250.025, then 0.040.04 is below 0.050.05, so all three hypotheses are rejected. The Holm-adjusted p-values are 0.0120.012, 0.040.04 and 0.040.04.

Bonferroni compares every p-value with 0.01670.0167, so it rejects only the first hypothesis. Both procedures control the FWER at 0.050.05, and Holm gains power by relaxing the threshold after each rejection.

  1. The p-values 0.010.01, 0.040.04 and 0.0450.045 form a family of three. Apply Holm at α=0.05\alpha = 0.05 and Benjamini-Hochberg at q=0.05q = 0.05. Someone argues that Holm should also reject the third hypothesis because 0.0450.045 is below its threshold 0.050.05. Is that right?
Show the answer

For Holm, 0.010.01 is below 0.01670.0167, so the first hypothesis is rejected, but 0.040.04 is above 0.0250.025, so the procedure stops there. The third hypothesis is not rejected, even though 0.0450.045 is below 0.050.05, because the stopping rule is part of what guarantees FWER control. The Holm-adjusted p-values are 0.030.03, 0.080.08 and 0.080.08.

For Benjamini-Hochberg the thresholds are 0.01670.0167, 0.03330.0333 and 0.050.05. The largest rank that passes is 33, since 0.045≤0.050.045 \le 0.05, so all three hypotheses are rejected, including the second even though 0.040.04 is above 0.03330.0333. The procedures disagree because they control different error rates, the chance of any false rejection for Holm and the expected fraction of false rejections among the rejections for Benjamini-Hochberg.

  1. The same p-values 0.0040.004, 0.020.02 and 0.040.04 turn out to be the three smallest of 2020 analyses across outcomes and subgroups. What does Holm’s procedure give for the full family, and what should a report disclose?
Show the answer

With m=20m = 20 the first Holm threshold is 0.05/20=0.00250.05/20 = 0.0025. The smallest p-value 0.0040.004 is above it, so the procedure stops at once and nothing is rejected. The Holm-adjusted value of the smallest p-value is 20⋅0.004=0.0820 \cdot 0.004 = 0.08.

Presenting a family of three would hide the other 1717 analyses and claim an error control that the search does not have. A report should state how many analyses were run and how they were chosen, give all the results or a complete summary, say which comparisons were planned and which were exploratory, name the error rate controlled across the full family, and give estimates with intervals. The three results can still suggest a new study with a planned contrast.

How this lesson connects