Multiple comparisons: what happens when you run many tests

Measure twenty outcomes for one drug, or scan thousands of genes at once, and a few "significant" results always show up. Here you will run the tests yourself to see how many of them are just luck, and how to fix the threshold. All data on this page is made up, and the page only explains statistical ideas.

Short answer. Even if one test has only a 5% chance of a false alarm (calling something "significant" when there is no effect), run 20 tests and one of them will probably come out "significant" by luck. So when you run many tests, you make the threshold stricter. Bonferroni controls "no false alarms at all" (the family-wise error rate, FWER). Benjamini-Hochberg controls "the share of false alarms among what you call discoveries" (the false discovery rate, FDR).

Each square is one test. Each test compares a made-up drug that does nothing with a fake pill, 20 people per group. So every orange square (p < 0.05) is a false discovery. "Run experiment" runs the same experiment again with new people. In the lower picture, the green curve is the formula 1 − 0.95^m, and the blue squares show how often "at least one significant" happened when the same experiment was repeated 2,000 times. The scale across goes 1, 2, 5, 10, so each step multiplies. The random numbers come from a fixed seed: for the same m, pressing in the same order gives the same results.

Try this. ① At the start (m = 20), 2 of the 20 tests with no effect have p < 0.05 (p = 0.00964, 0.04). ② Press "Run experiment" four more times and you get 0, 1 (p = 0.00607), 0 and 2. In three of the five experiments (60.0%), at least one test was significant. The formula says 64.2%, and the simulation with 2,000 repeats says 63.9%. ③ Set m to 1: the formula gives 5.0% and the simulation 5.3%. At 14 the formula passes half, 51.2% (simulation 50.3%). ④ Set m to 100: the first experiment colors 4 squares. On average it is 100 × 0.05 = 5, and the chance of at least one significant result is 99.4%.

Definitions

Suppose m null hypotheses are tested together. Write pi for the p-value of test i, and p(1)≤p(2)≤⋯≤p(m) for the p-values sorted from the smallest. Write R for the number of discoveries (null hypotheses rejected) and V for how many of them had a true null hypothesis (false discoveries, type I errors).

family-wise error rate (FWER)
The chance of at least one false discovery in a family, the set of tests done together to answer one question. If every null hypothesis is true, the tests are independent, and each uses significance level α, it is 1−(1−α)m.

FWER=P(V≥1)

false discovery rate (FDR)
The expected share of false discoveries among the discoveries. When there are no discoveries (R = 0), the share counts as 0.

FDR=E[Vmax(R,1)]

Bonferroni correction
Lower the significance level of every test to α ÷ m. The chance of a union of events is never more than the sum of their chances (Ai is the event that test i makes a type I error), so FWER ≤ α however the tests depend on each other. The adjusted p-value is min(1,mpi).

reject if pi≤αm,P(⋃iAi)≤∑iP(Ai)≤m×αm=α

Holm's method
Check the inequality below for i = 1, 2, … in order, and stop at the first rank where it fails. Reject only the ranks before it. FWER ≤ α however the tests depend on each other, and it always rejects everything Bonferroni rejects.

p(i)≤αm−i+1,i=1,2,…

Benjamini-Hochberg procedure
With q the level at which to hold the FDR, find k below and reject ranks 1 to k (if there is no such i, reject nothing). If the tests are independent, the FDR is m0mq, which is no more than q (m0 is the number of true null hypotheses).

k=max{i:p(i)≤im×q}

1. Why it is a problem: more chances for a false alarm

A hypothesis test measures, as a p-value, "if there were no effect, how likely is data at least this extreme?", and calls the result "significant" when the p-value is below a threshold α (usually 0.05). Getting "significant" when there is no effect is what this page calls a false alarm or false discovery. Textbooks call it a type I error (Type I and II errors and power). With a threshold of 0.05, one test with no effect raises a false alarm with chance 0.05.

The trouble starts with many tests. Run m independent tests with no effect, and the chance that none of them raises a false alarm is 0.95 multiplied m times. Everything else is "at least one false alarm".

P(at least one significant)=1−(1−α)m

Tests mChance of none: 0.95^mChance of at least one significantAverage false discoveries m × 0.05
10.955.0%0.05
50.773822.6%0.25
100.598740.1%0.5
200.358564.2%1
500.076992.3%2.5
1000.005999.4%5

With 20 tests you get one false discovery on average. That is what "one in 20" means. The group of tests you run to answer one question is called a family, and the chance of at least one false discovery in that family is the family-wise error rate (FWER). The third column above is the FWER with no correction.

This formula assumes the tests are independent. When tests are linked, like similar outcomes measured on the same people, the value changes. But "at most m × α" is always true, linked or not. The next section shows this as a picture.

A common wrong reading. "One of 20 outcomes had p = 0.04, so the effect is real with 96% probability." A p-value is "the chance of data this extreme if there were no effect", not "the chance the effect is real". On top of that, even with no effect at all, about one in 20 tests gives p < 0.05. If only the significant one is reported and the other nineteen are left out, readers have no way to know.

2. How the formula is built: the Bonferroni threshold α ÷ m

To keep the family-wise error rate under α (0.05), how low must the threshold for each test be? The answer is α ÷ m. Press "Next" to see where it comes from, one step at a time.

In the formula, the piece with the orange background is the one added in this step. The grid on the left shows two tests, the chart on the right shows m tests. From the third step on, the grid fades.

Written only as formulas, the steps above look like this. Ai is the event that test i makes a type I error.

P(A1)=α=20400=0.05

P(A1∪A2)=P(A1)+P(A2)−P(A1∩A2)=20+20−1400=0.0975≤α+α

P(⋃i=1mAi)≤∑i=1mP(Ai)=m×α

P(⋃i=1mAi)≤m×αm=α

m=20:0.0520=0.0025,1−(1−0.0025)20≈0.0488

  1. One test: P(false alarm) = α. A test with no effect says "significant" with chance α = 0.05. That is 20 of the 400 squares.
  2. Two tests: P(at least one of two) ≤ α + α. "At least one false alarm" is any square in the green row or the blue column. Adding the two gives 20 + 20 = 40 squares, but the square where they cross was counted twice. The real count is 39, and 39 ÷ 400 = 0.0975. Adding without taking off the overlap gives a number at least as big as the real one, so we write "at most" (≤).
  3. m tests: P(at least one of m) ≤ m × α. Three or four tests work the same way. Add them all up without taking off any overlap, and you get at most m × α. This holds even when the tests are linked, because we only added and never needed to know the size of the overlaps.
  4. Give each test α ÷ m: m × (α ÷ m) = α. To hold the total at α, do not give each test all of α. Split it into m pieces. Then the right side of the inequality is exactly α.
  5. Done: threshold for each test = α ÷ m. With m = 20 that is 0.05 ÷ 20 = 0.0025. Only tests with p ≤ 0.0025 count as "significant".

Here is how close the rough bound m × α is to the exact value, in numbers (for independent tests).

mExact 1 − (1 − α)^mRough bound m × αWith α ÷ m per test: 1 − (1 − α ÷ m)^m
20.09750.10.0494
50.22620.250.0490
100.40130.50.0489
200.641510.0488

The larger m is, the looser the bound gets. At m = 20 the bound of 1 tells you nothing, but it is never smaller than the exact value. That is why giving each test α ÷ m keeps the family-wise error rate under 0.05, as the last column shows. It even leaves a little unused (0.0488). If you know the tests are independent, you can use the exact threshold 1 − (1 − α)^(1 ÷ m) (Šidák), but at m = 20 that is 0.00256 against 0.0025, so Bonferroni is used more often.

Try this. ① Press "Next" once: the blue column appears, and the orange square where the two lines cross is counted twice. On the right, the bound 0.1 and the exact 0.0975 for m = 2 appear. ② Press again to see the gap (orange fill) between the bound 1 and the exact 0.6415 at m = 20. ③ Go to the end: the two lines lie flat near 0.05, and with the threshold 0.0025 at m = 20 the chance of at least one false alarm is 0.0488.

3. Two goals: the family-wise error rate and the false discovery rate

After m tests, each test lands in one of four boxes. In real life you do not know which tests have a real effect, but with made-up data you do.

Called a discovery (significant)Left alone (not significant)
Real effectTrue discoveryMissed (type II error)
No effectFalse discovery (type I error)Correctly left alone

Call the number of false discoveries V and the number of discoveries R. The two goals differ like this.

For example, a list of 20 discoveries with 1 false one has a false discovery share of 5%. Through FWER eyes that is "a false discovery, so it failed". Through FDR eyes it is "5% is fine". When no test has a real effect, the two are the same, because any false discovery makes that list 100% false.

Family-wise error rate (FWER)False discovery rate (FDR)
AsksChance of even one wrong discoveryShare of wrong ones among discoveries (on average)
StrictnessStrict. The more tests, the lower the threshold goesLess strict. With many real effects the threshold drops less
FitsConfirming studies where one wrong claim has big consequences. Several main outcomes in a clinical trialExploring, where you find many and check them again in the next experiment. Scanning thousands of genes
Main methodsBonferroni, HolmBenjamini-Hochberg (BH)

Common wrong readings.

4. Three methods: Bonferroni, Holm, Benjamini-Hochberg

All three are easiest to think about with the p-values sorted from smallest to largest and ranked. The smallest p is rank 1: p₍₁₎ ≤ p₍₂₎ ≤ … ≤ p₍ₘ₎. Here α and q are both 0.05.

MethodControlsThreshold for rank iIf tests are linkedFinding power
No correctionα for each single testαDoes not matterLargest (and the most false discoveries)
BonferroniFWERα ÷ mStill holdsSmallest
HolmFWERα ÷ (m − i + 1), stop at the first rank that failsStill holdsAlways finds everything Bonferroni finds
BHFDR(i ÷ m) × q, up to the largest rank under its thresholdProven for independent tests and tests that move togetherWith q = α, always finds everything Holm finds

With the same α = q, the lists of discoveries always grow in the order Bonferroni ⊆ Holm ⊆ BH ⊆ no correction. Holm's threshold for rank i, α ÷ (m − i + 1), is never larger than BH's (i ÷ m) × α (comparing the two comes down to (i − 1)(m − i) ≥ 0).

This experiment (50 tests)
MethodTrue discoveriesFalse discoveriesMissedCorrectly left aloneFalse discovery sharePower
Average over 2,000 repeats with the same settings
MethodAverage false discovery share (FDR)Share with at least one false discovery (FWER)Average power

This is a scaled-down model. Each test compares the averages of a made-up drug group and a fake pill group, 20 people each, and the "share with a real effect" decides how many of the 50 tests (counted from the front) get an effect. The effect size d is the difference between the two group averages divided by the standard deviation (1 means they differ by one standard deviation). Instead of drawing a value for each person, it assumes the standard deviation is known and draws the test statistic z directly, which gives the same results. Real studies often use a t-test, but the multiple comparisons picture is the same. The scale going up is a log scale where each line is 10 times smaller, so even tiny p-values show. That is also why BH's straight threshold (i ÷ m) × q looks curved. For no correction and Bonferroni, the dots under the line are the discoveries. Holm reads from the left and stops at the first dot above its line. BH takes everything up to the rightmost dot under its line.

Try this. ① At the start (20% real = 10 tests, d = 1), no correction finds 11. It found all 10 real ones, but 1 false discovery is mixed in. ② Bonferroni finds 4 and Holm finds 5. No false discoveries, but they miss 6 and 5 real ones. ③ BH finds 10: 9 real and 1 false. This time the false discovery share is 10.0%, above q = 5%, but the average over 2,000 repeats (the FDR) is 4.0%. That equals the share of tests with no effect, 80%, times 5%. ④ In the repeat table, the FWER of Bonferroni and Holm is 4.2% and 4.5%, under 5%, with power 44.8% and 45.9%. BH has a high FWER of 27.3% but power of 68.0%. No correction has FWER 87.7% and FDR 17.3%. ⑤ Set the real share to 0: with no real effects, the FDR and the FWER become the same (92.5% for no correction, 5.1% for the other three). ⑥ From the start, raise only the effect size to 1.5: all four methods find all 10 real ones. Large effects pass even strict thresholds.

5. Work it out by hand: five p-values

Say a group taking a made-up drug was compared with a group taking a fake pill, on five outcomes. The p-values came out as below (made-up numbers). For which of the five can we say there is an effect? m = 5, α = q = 0.05.

Rank iOutcomepBonferroni threshold 0.05 ÷ 5Holm threshold 0.05 ÷ (5 − i + 1)BH threshold (i ÷ 5) × 0.05
1Blood pressure0.0040.01: found0.01: found0.01: under
2Cholesterol0.0110.01: left alone0.0125: found0.02: under
3Body weight0.020.01: left alone0.0167: over, stop0.03: under
4Hours of sleep0.0450.01: left alone(not checked)0.04: over
5Headaches0.30.01: left alone(not checked)0.05: over
  1. No correction. Below 0.05 are 0.004, 0.011, 0.02 and 0.045: 4.
  2. Bonferroni. Threshold 0.05 ÷ 5 = 0.01. Only 0.004 is under it: 1. 0.011 just misses.
  3. Holm. Rank 1: 0.004 ≤ 0.05 ÷ 5 = 0.01, found. Rank 2: 0.011 ≤ 0.05 ÷ 4 = 0.0125, found. Rank 3: 0.02 > 0.05 ÷ 3 ≈ 0.0167, stop. 2. It found the 0.011 that Bonferroni left alone.
  4. BH. The thresholds are 0.01, 0.02, 0.03, 0.04, 0.05. Ranks 1, 2 and 3 have p ≤ threshold, and the largest is k = 3 (rank 4: 0.045 > 0.04). Ranks 1 to 3, so 3 discoveries.

The same working, written as formulas:

Bonferroni:0.055=0.01,p(1)=0.004≤0.01<0.011=p(2)

Holm:0.004≤0.055=0.01,0.011≤0.054=0.0125,0.02>0.053≈0.0167

BH:k=max{i:p(i)≤i5×0.05}=3(0.02≤0.03,0.045>0.04)

You can reach the same answer with adjusted p-values: an adjusted p of 0.05 or less is a discovery.

pBonferroni: 5 × p (cap at 1)Holm: (5 − i + 1) × p, running maximum from the frontBH: 5 × p ÷ i, running minimum from the back
0.0040.025 × 0.004 = 0.025 × 0.004 ÷ 1 = 0.02
0.0110.0554 × 0.011 = 0.0445 × 0.011 ÷ 2 = 0.0275
0.020.13 × 0.02 = 0.065 × 0.02 ÷ 3 ≈ 0.0333
0.0450.2252 × 0.045 = 0.095 × 0.045 ÷ 4 = 0.05625
0.31 (1.5)1 × 0.3 = 0.35 × 0.3 ÷ 5 = 0.3

In this example the values are already in order, so the running maximum and minimum change nothing. With data where the order flips, the running step makes sure a later rank never gets a smaller adjusted p. The bold ones are 0.05 or less: 1 for Bonferroni, 2 for Holm, 3 for BH, the same as above. In Python, statsmodels does the same calculation.

from statsmodels.stats.multitest import multipletests
p = [0.004, 0.011, 0.02, 0.045, 0.3]
for method in ["bonferroni", "holm", "fdr_bh"]:
    reject, adjusted, _, _ = multipletests(p, alpha=0.05, method=method)
    print(method, reject.sum(), adjusted)
# discoveries: bonferroni 1, holm 2, fdr_bh 3. adjusted holds the adjusted p-values in the table above

6. The BH procedure, one step at a time

The confusing part of BH is that it does not just take "the dots under the line". It takes "everything up to the last dot under the line". Follow the procedure line by line with p-values from a made-up cell culture experiment that tested 10 candidate compounds. You can edit the p-values.

Rank ipThreshold (i ÷ m) × qp ≤ threshold?Result

Write 2 to 20 p-values separated by commas. They take effect when you leave the box. Only numbers between 0 and 1 are accepted. q stays at 0.05. In the table, the orange underline marks rank k and the green background marks discoveries.

Try this. ① With the first 10 values, press "Next" four times: step ④ shows k = 4 (p = 0.018 ≤ 0.02). ② Press once more: ranks 1 to 4 are discoveries. But rank 3, 0.016, is above its own threshold of 0.015. It is found anyway because rank 4, after it, is under its threshold. With the same values, Bonferroni (threshold 0.005) and Holm find only 1, and no correction finds 5 (up to 0.041). ③ In the box, change 0.018 to 0.021: rank 4 goes over its threshold, k becomes 2, and the discoveries drop from 4 to 2. One value near the line changes the result a lot. ④ Press "The 5 from section 5" to see the calculation from section 5. k = 3.

7. Hidden multiple comparisons

People often run many tests without noticing. All of the cases below are the same problem. Because they amount to "trying other paths until something is significant", this is also called p-hacking.

This runs a made-up experiment 2,000 times in which the drug and the fake pill are exactly alike. At each look, 10 more people are added to each group, and the test uses all the data collected so far. When z goes outside the orange dashed lines (±1.96), p < 0.05. The rule is "stop as soon as it is significant", so the orange line ends there. Only the first 40 experiments are drawn.

Try this. ① At the start (10 looks), 20.0% of the 2,000 runs end with "it works". Testing the same data once at the end gives 5.5%. Of the 40 lines drawn, 8 stopped. ② Set the number of looks to 1 for 5.1%, 2 for 8.8%, 3 for 11.6%, 5 for 14.9% and 20 for 25.8%. Every look is one more chance to cross the edge by luck. But the looks share most of their data, so they are linked, and the rate does not climb as high as 20 independent tests would (64.2%).

That does not mean you must never look early. Clinical trials often run interim analyses for safety. In that case, the number and timing of looks are fixed in advance, and the threshold is split strictly across the looks so the overall false alarm rate stays at α (boundaries such as Pocock or O'Brien-Fleming). See Clinical trial design for more.

8. When to correct, and with what

One main outcome chosen in advance needs no correction

If, before the experiment starts, you choose one main outcome (the primary endpoint), such as "does this drug lower blood pressure after 8 weeks", and you claim an effect only from that, you have one test. There is nothing to correct. To make that promise believable, you publish the main outcome and the analysis plan before starting. This is preregistration. Anyone can then check whether the main outcome was changed after the results came in. The other outcomes (secondary outcomes) are either corrected or reported as "exploratory" and checked again in a later study.

Confirming: FWER. Exploring: FDR

The price of correcting: less power

A lower threshold means fewer false alarms but more missed real effects. Power (the chance of finding a real effect) goes down. With the starting settings of the section 4 experiment (d = 1, 20 people per group), one test at 0.05 has power of about 89%. Correct 50 tests with Bonferroni, and the threshold becomes 0.05 ÷ 50 = 0.001, which cuts power to about 45%, half as much (88.5% and 44.8% in the repeat table). To keep the same 89%, you need 41 people per group instead of 20. If you plan several tests, use the corrected threshold from the start when you work out the sample size. Running fewer tests, meaning one main outcome, is the cheapest fix.

Post hoc comparisons after ANOVA

Comparing the averages of three or more groups with analysis of variance only tells you "something differs". Testing each pair to see which one is multiple comparisons again. With 4 groups there are 4 × 3 ÷ 2 = 6 pairs. There are methods made for this.

Bonferroni and Holm can be used here too.

9. Key properties

PropertyIn plain words
More tests, more chances for a false alarmFor m independent tests, 1 − (1 − α)^m. However they are linked, at most m × α
Bonferroni ⊆ Holm ⊆ BH ⊆ no correctionWith the same α = q, the list of discoveries always grows in this order. So does the chance of a false one slipping in
With m = 1 they are all the sameWith one test, Bonferroni, Holm and BH are all just "p ≤ α"
Correcting lowers powerA strict threshold misses real effects along with false alarms. You need more people to make up for it
Decide the "family" in advanceThe correction depends on m. Changing which tests count after seeing the results is also a kind of choosing

Where it is used

Frequently asked questions

What is the multiple comparisons problem?

When you run many tests, the chance that at least one comes out "significant" by luck grows, even if nothing has an effect. One test has a 5% chance of a false alarm, but with 20 independent tests the chance of at least one significant result is about 64%.

How do you do a Bonferroni correction?

Lower the threshold to α ÷ m. With 20 tests and α = 0.05, only results with p ≤ 0.0025 count as significant. The same thing from the p-value side: multiply each p-value by m (cap it at 1) and compare it with 0.05.

What is the difference between FWER and FDR?

The FWER (family-wise error rate) is the chance of at least one false discovery. The FDR (false discovery rate) is the average share of false discoveries among everything you call a discovery. Use the FWER for confirming studies where not a single claim may be wrong, and the FDR for exploring, where you find many candidates and check them again later.

Do I always have to correct when I run more than one test?

No. If you test one main outcome that you chose in advance, that is one test, so there is nothing to correct. Correct when you pick comparisons after seeing the data, or when you plan to say "it works" if any one of several outcomes is significant.

Is Holm always better than Bonferroni?

It keeps the same promise (FWER at most α), always finds everything Bonferroni finds, and sometimes finds more. So wherever you would use Bonferroni, you lose nothing by using Holm. It just takes a little more explaining, because each rank gets a different threshold.

Words

Plain words used hereTextbook term
Running many testsMultiple comparisons, multiple testing
False alarm, false discoveryType I error, false positive
MissedType II error, false negative
The threshold αSignificance level
The group of tests run togetherFamily of tests
Chance of at least one false discoveryFamily-wise error rate (FWER)
Average share of false discoveriesFalse discovery rate (FDR)
False share in the one list you gotFalse discovery proportion (FDP)
p recalculated for the stricter thresholdAdjusted p-value
At most m × αUnion bound, Boole's inequality
Bonferroni / Holm / BHBonferroni correction / Holm's step-down procedure / Benjamini-Hochberg procedure
Start at the front and stop / search from the backStep-down / step-up
Chance of finding a real effectPower
Effect size dCohen's d, standardized mean difference
Main outcome chosen in advancePrimary endpoint, primary outcome
Publishing the plan in advancePreregistration
Trying other paths until something is significantp-hacking
Looking earlyInterim analysis, peeking
Pair comparisons after ANOVAPost hoc comparisons
Confirming study / scanning studyConfirmatory / exploratory study

Sources

← Multiple regressionRisk, relative risk and odds ratio →