Multiple Comparisons › The Multiple Comparisons Problem

Michael BrenndoerferJanuary 9, 20265 min read
Machine Learning from ScratchAll chapters
Part 2 of 9Hypothesis Testing
Chapter 21Multiple Comparisons › The Multiple Comparisons Problem
Reading section 2 of 12 · The Multiple Comparisons Problem · 5 minSection 2 of 12 · 5 min

Book contents

Section 2 of 12 · 5 min read

Multiple Comparisons › The Multiple Comparisons ProblemOne section · Sections in this chapter2 / 12 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

When we conduct a single hypothesis test at significance level α=0.05\alpha = 0.05, we accept a 5% chance of a Type I error: rejecting a true null hypothesis. This seems like an acceptable risk. But what happens when we conduct many tests?

The Mathematics of Multiplicity

Consider conducting mm independent hypothesis tests, each at significance level α\alpha. If all null hypotheses are true, each test has probability α\alpha of producing a false positive. The probability of making at least one false positive across all tests is:

P(at least one false positive)=1−P(no false positives)P(\text{at least one false positive}) = 1 - P(\text{no false positives})

Since the tests are independent:

P(no false positives)=(1−α)mP(\text{no false positives}) = (1 - \alpha)^m

Therefore:

P(at least one false positive)=1−(1−α)mP(\text{at least one false positive}) = 1 - (1 - \alpha)^m

This is called the family-wise error rate (FWER): the probability of making at least one Type I error among a family of tests.

Let's see how quickly this grows:

Number of tests (mm)FWER at α=0.05\alpha = 0.05
10.050
50.226
100.401
140.512
200.642
500.923
1000.994

With just 14 tests, you have more than a 50% chance of at least one false positive. By 100 tests, a false positive is virtually certain (99.4%).

Out[3]:
Visualization
Line plot showing FWER increasing with number of tests for different alpha levels.
The family-wise error rate grows rapidly with the number of tests. At the commonly used α = 0.05, conducting 14 tests already gives a 50% chance of at least one false positive. This illustrates why multiple comparison corrections are essential in high-dimensional research.

Simulation: Seeing False Positives Emerge

Let's simulate the multiple comparisons problem directly. We'll generate data where all null hypotheses are true (no real effects) and watch how false positives accumulate.

Out[4]:
Visualization
Histogram of p-values from 100 null-hypothesis tests, with the alpha equals 0.05 threshold marked.
Distribution of p-values from 100 tests where all null hypotheses are true. P-values should be uniformly distributed under the null hypothesis.
Scatter plot of 100 p-values with three false positives below the alpha equals 0.05 threshold highlighted.
Visualization of p-values from 100 tests with significant results highlighted. Despite no real effects, several tests show 'significant' results (p < 0.05), exactly what we'd expect from random chance.

The simulation confirms our mathematical analysis: with 100 tests and no real effects, we obtained {python} sum(significant) "significant" results, false positives that could mislead researchers into believing they've found real effects.