Your one-way ANOVA or Kruskal-Wallis test came back significant. The natural next question is which groups differ, and answering it is the job of post-hoc tests, also called multiple comparison procedures. This guide explains why you cannot simply run a t-test on every pair, how the most common corrections work (with numbers you can check by hand), and which method fits which situation.
Why not just run t-tests on every pair?
Each test at α = 0.05 has a 5% chance of a false positive when there is no real difference. Run several tests and those chances add up. The probability of at least one false positive across m independent tests is 1 − 0.95m:
| Groups | Pairwise comparisons | Chance of ≥ 1 false positive |
|---|---|---|
| 3 | 3 | 14% |
| 4 | 6 | 26% |
| 5 | 10 | 40% |
| 6 | 15 | 54% |
(Pairwise tests share data, so they are not truly independent and the real figures are a little lower, but the trend is the same.) This overall error rate is called the family-wise error rate. Post-hoc procedures keep it at 5% for the whole family of comparisons, at the cost of making each individual comparison a bit stricter.
Bonferroni: simple and strict
The Bonferroni correction divides α by the number of comparisons. With three comparisons, each must reach p < 0.05 / 3 = 0.0167 to count as significant. Equivalently, multiply each p-value by the number of comparisons (capping at 1) and compare with 0.05.
It works with any kind of test, which makes it very flexible, but it becomes conservative when there are many comparisons: with 10 comparisons the threshold is 0.005, and real differences start to be missed.
Holm: same guarantee, more power
The Holm (or Holm-Bonferroni) method gives exactly the same protection as Bonferroni and is never less powerful, so there is rarely a reason to prefer plain Bonferroni. It works step by step:
- Sort the m p-values from smallest to largest.
- Compare the smallest with 0.05 / m, the next with 0.05 / (m − 1), and so on, until the last is compared with 0.05 / 1.
- Stop at the first p-value that fails its threshold; it and all larger p-values are not significant.
Worked example
Three groups give three pairwise p-values: A vs B = 0.004, A vs C = 0.020, B vs C = 0.030.
| Comparison | p | Bonferroni threshold | Bonferroni | Holm threshold | Holm |
|---|---|---|---|---|---|
| A vs B | 0.004 | 0.0167 | Significant | 0.05/3 = 0.0167 | Significant |
| A vs C | 0.020 | 0.0167 | Not significant | 0.05/2 = 0.025 | Significant |
| B vs C | 0.030 | 0.0167 | Not significant | 0.05/1 = 0.05 | Significant |
Same data, same 5% family-wise guarantee, but Holm detects all three differences while Bonferroni detects only one.
Tukey's HSD: the classic after ANOVA
Tukey's Honestly Significant Difference test is designed specifically for comparing all pairs of group means after a one-way ANOVA. It uses the pooled within-group variance from the ANOVA and a distribution (the studentized range) that accounts for the fact that you are looking at the largest of all the pairwise differences. When its assumptions hold (roughly normal data, similar variances), it is more powerful than Bonferroni or Holm for all-pairs comparisons.
If the group variances differ noticeably, the Games-Howell test is the Welch-style alternative: it gives each pair its own standard error and degrees of freedom.
Dunnett's test: everything versus one control
If you only care about comparing each treatment with a single control group (not treatments with each other), Dunnett's test is the right tool. Because it makes fewer comparisons than all-pairs methods (k − 1 instead of k(k − 1)/2), it has more power for the comparisons you actually care about. Decide this before looking at the data.
Dunn's test: after Kruskal-Wallis
For the non-parametric route, Dunn's test compares pairs of groups using the mean ranks from the Kruskal-Wallis analysis, combined with a Bonferroni or Holm adjustment. Pairwise Mann-Whitney U tests with a Holm correction are a reasonable alternative when Dunn's test is not available.
Which one should I use?
| Situation | Recommended |
|---|---|
| ANOVA, all pairs, similar variances | Tukey's HSD |
| ANOVA, all pairs, unequal variances | Games-Howell |
| ANOVA, each group vs one control | Dunnett's test |
| Kruskal-Wallis follow-up | Dunn's test with Holm adjustment |
| A small set of planned comparisons, any test type | Holm correction |
Common questions
Do I need a significant ANOVA before running post-hoc tests?
Not strictly. Tukey, Dunnett and Holm-corrected comparisons control the error rate on their own. Many fields still expect the omnibus test first, and it is reasonable to report both. Note that the two can occasionally disagree: a significant ANOVA with no significant pair, or the reverse, is uncommon but possible.
Can I choose comparisons after seeing the graph?
Picking the two groups that look most different and testing only that pair is the same as testing all pairs and reporting the best one. If you choose comparisons after looking, correct for all possible pairs.
What about the false discovery rate?
In large screening studies (gene expression, many outcome variables), controlling the family-wise error rate is too strict. The Benjamini-Hochberg procedure instead controls the expected proportion of false positives among the results you call significant. It is a different goal, appropriate for exploration rather than confirmation.
Doing this with StatFlo
StatFlo runs the two most common post-hoc procedures automatically whenever you compare three or more groups:
- One-way ANOVA → Tukey's HSD. The results add a table with every pair's mean difference, simultaneous 95% confidence interval and adjusted p-value (Tukey-Kramer method, so unequal group sizes are handled correctly).
- Kruskal-Wallis → Dunn's test. The table shows each pair's mean-rank difference, z, unadjusted p and Holm-adjusted p, using the pooled ranks with tie correction.
Choose Significance on graph to draw Prism-style brackets with asterisks for the significant pairs (or all pairs). StatFlo's Tukey and Dunn calculations are checked against SciPy reference results. If you need a method StatFlo does not offer, such as Dunnett's test against a single control or Games-Howell, run Welch's t-tests on the pairs you planned and apply the Holm procedure above to their p-values, stating this in your methods.
For a full walkthrough of the ANOVA step, see reading an ANOVA result, step by step.