The Bonferroni correction is the simplest guard against false alarms when many hypotheses are tested together. Each extra test is another chance to see a "significant" result by luck, so the per-test threshold is tightened until the chance of any false positive across the whole family stays at the chosen level $\alpha$, usually 5%.
Choosing the correction depends on which error you want to control:
The problem. If each of $m$ independent tests has a false-positive rate of $\alpha$ when the null hypothesis is true, the chance of at least one false alarm is $1-(1-\alpha)^m$. At $\alpha=0.05$ that is about $22.6\%$ for $m=5$, $64.2\%$ for $m=20$, and $99.4\%$ for $m=100$. A fab that screens one hundred process parameters will almost always find something "significant" even when nothing has changed.
The correction. Bonferroni compares each p-value with $\alpha/m$, or equivalently multiplies each p-value by $m$ and caps the result at $1$:
It works because of Boole's inequality: the chance that at least one of $m$ events occurs is at most the sum of their chances. If every true null is tested at $\alpha/m$, the total false-alarm probability is at most $m\cdot\alpha/m=\alpha$. This holds under any dependence between the tests, which is why the method is so widely applicable. The Šidák version, $1-(1-\alpha)^{1/m}$, is slightly less strict when tests are independent: $0.01021$ versus $0.01$ for $m=5$.
Worked example. Five tests give the ranked p-values $0.001,\ 0.012,\ 0.021,\ 0.040,\ 0.300$, and $\alpha=0.05$.
| Rank | p-value | Bonferroni adjusted p | Holm cutoff | Holm adjusted p |
|---|---|---|---|---|
| 1 | $0.001$ | $0.005$ | $0.05/5=0.0100$ | $0.005$ |
| 2 | $0.012$ | $0.060$ | $0.05/4=0.0125$ | $0.048$ |
| 3 | $0.021$ | $0.105$ | $0.05/3\approx0.0167$ | $0.063$ |
| 4 | $0.040$ | $0.200$ | $0.05/2=0.0250$ | $0.080$ |
| 5 | $0.300$ | $1.000$ | $0.05/1=0.0500$ | $0.300$ |
Bonferroni's single cutoff is $0.05/5=0.01$, so only the first hypothesis is rejected. Holm's step-down procedure uses the sliding cutoffs in the table, walks from the smallest p-value, and stops at the first failure: $0.001\le0.01$ passes, $0.012\le0.0125$ passes, and $0.021>0.0167$ stops it. Holm rejects two hypotheses while giving the same family-wise guarantee, so it is never less powerful than Bonferroni. The Benjamini-Hochberg rule instead compares the rank-$i$ p-value with $i\alpha/m$ and rejects the four smallest, because $0.040\le4(0.05)/5=0.04$. It controls the expected share of false discoveries, not the chance of any false positive, so it answers a different question. The results match statsmodels.
When to use it.
- Define the family first: decide which tests are corrected together before seeing the data. Quietly dropping or adding tests defeats the guarantee.
- Few tests, confirmatory claims: Bonferroni or, better, Holm. For all pairwise comparisons after an ANOVA, Tukey HSD is usually tighter.
- Many tests, screening: with hundreds or thousands of candidates, Bonferroni's cutoff of $\alpha/m$ becomes tiny and misses real effects. An FDR method such as Benjamini-Hochberg is the usual choice.
- Cost: the price of protection is power. With $m=20$ the per-test cutoff is $0.0025$, so a real effect needs a smaller p-value to be recognised.
- Report both: give the adjusted p-value or the corrected interval, and say which correction and family size were used.
Read the Bonferroni correction as a budget: the 5% false-alarm allowance is split across all the tests, so each one gets a smaller share and a claim that survives is much harder to dismiss as luck.