Skip to content
K Knidox Search…
Statistics · Inference

Tukey HSD

Every pairwise comparison after an ANOVA, with adjusted p-values and confidence intervals.

One group per line. Separate values with commas or spaces. Groups may differ in size.
Significance level α
ANOVA F
4.8461p = 0.0159

df 2, 27

Critical q
3.506

k = 3 groups, 27 error df

MSE
0.3886

Pooled within-group variance

PairDifferenceqp95% intervalVerdict
A − B0.3711.8820.3909[-0.32, 1.062]No difference found
A − C-0.4942.5060.1980[-1.185, 0.197]No difference found
B − C-0.8654.3880.0120[-1.556, -0.174]Differ

Group means

A n = 10, mean = 5.032, sd = 0.5831B n = 10, mean = 4.661, sd = 0.7937C n = 10, mean = 5.526, sd = 0.4426

An ANOVA tells you some group differs, not which. Tukey’s HSD compares every pair and keeps the overall false-positive rate at α across all of them at once. With three groups of ten, a difference of 0.865 gives q = 4.388 and p = 0.012.

Why you cannot just run t-tests

With three groups there are three pairs; with five there are ten. If each pair is tested at α = 0.05 the chance of at least one false positive climbs with the number of pairs — for ten independent comparisons it is about 40%, not 5%. Running t-tests pair by pair therefore finds differences that are not there, and the more groups you have the worse it gets.

Tukey’s test fixes this by changing the reference distribution rather than the significance level. Instead of asking how big a single difference would be by chance, it asks how big the largest difference among k groups would be — which is a harder threshold to clear, and exactly the right one when you are looking at every pair.

The studentized range

That largest-difference distribution is the studentized range, written q. It is the range of k sample means divided by their common standard error, and it has no closed form: the critical values in every textbook appendix come from numerical integration. The test statistic for a pair is their difference divided by the same standard error, compared against that distribution rather than against t.

q = |x̄ᵢ − x̄ⱼ| ÷ √(MSE ÷ 2 × (1÷nᵢ + 1÷nⱼ))

compared against the studentized range on k groups and N − k error degrees of freedom

  1. 1
    Run the ANOVA first. Tukey rests on its pooled error term. If the overall F is not significant, there is no established difference for the pairs to locate.
  2. 2
    Take the MSE and its degrees of freedom. For three groups of ten, MSE = 0.3886 on 27 degrees of freedom.
  3. 3
    Work out the standard error for each pair. √(MSE ÷ 2 × (1/10 + 1/10)) = √(0.3886 ÷ 10) = 0.1971.
  4. 4
    Divide each difference by it. A difference of 0.865 gives q = 0.865 ÷ 0.1971 = 4.388.
  5. 5
    Compare against the critical q. For k = 3 and 27 degrees of freedom, q₀.₀₅ = 3.506. Since 4.388 exceeds it, that pair differs — p = 0.012.

Critical values of q at α = 0.05

Rows are error degrees of freedom, columns the number of groups. Computed from the studentized range distribution.

dfk = 2k = 3k = 4k = 5k = 6
53.6354.6025.2185.6736.033
103.1513.8774.3274.6544.912
153.0143.6734.0764.3674.595
202.9503.5783.9584.2324.445
302.8883.4863.8454.1024.301
602.8293.3993.7373.9774.163
∞2.7723.3143.6333.8584.030

Unequal group sizes, and what the intervals mean

When the groups are not all the same size the test becomes Tukey–Kramer, which uses each pair’s own two sample sizes in the standard error. The consequence is practical: a pair involving a small group gets a wider interval and needs a larger difference to clear the same threshold. The method reduces exactly to plain Tukey when the sizes match, so there is nothing to choose between them — the tool applies whichever the data calls for.

The confidence intervals are the more useful output. A 95% Tukey interval covers every pairwise difference simultaneously with 95% confidence, which is a stronger and more honest claim than a set of separate 95% intervals. An interval that excludes zero corresponds to a significant pair, but it also tells you how big the difference plausibly is — and a pair that is significant with an interval of [0.17, 1.56] is a much weaker finding than one with [4.9, 12.6].

Two assumptions carry over from the ANOVA: the groups should be roughly normal and have similar spreads, since they share a pooled MSE. Levene’s test checks the second. If the spreads clearly differ, Games–Howell is the usual replacement — it does not pool, and is not what this page computes.

What does HSD stand for?
Honestly Significant Difference. The “honestly” is the point: the threshold is set so that the error rate across all the comparisons together is α, not α for each one separately.
Why not just run multiple t-tests?
Because the false-positive rate compounds. Ten pairs each tested at 0.05 give roughly a 40% chance of at least one spurious result. Tukey holds the overall rate at 5% instead.
Do I need a significant ANOVA first?
Conventionally yes — Tukey is a post-hoc test that locates a difference the ANOVA has established. It controls its own error rate regardless, but reporting pairwise results after a non-significant F invites the criticism that you went looking.
What is the q statistic?
The studentized range: a difference between two means divided by their common standard error, compared against the distribution of the largest such difference among k groups rather than against t.
What is Tukey–Kramer?
The version for unequal group sizes, which uses each pair’s own sample sizes in the standard error. It reduces to ordinary Tukey when the groups are equal, so it is applied automatically here.
What if my groups have very different spreads?
Tukey pools them into one MSE, so unequal variances distort it. Check with Levene’s test; if the spreads genuinely differ, Games–Howell is the standard alternative.
Is Tukey more or less conservative than Bonferroni?
Less conservative, and usually preferable for all-pairs comparisons. Bonferroni divides α by the number of tests regardless of their structure; Tukey uses the actual distribution of the largest difference, so it has more power for the same error rate.