One-way ANOVA with Tukey's test
H₀: μ₁ = … = μ₄ · H₁: at least one mean differs
F = 278.1959 · df = (3, 11996) · p = 1.40E-174
p = 1.40E-174 ≤ α = 0.05: reject H₀. At least one group's mean differs (F = 278.1959, η² = 0.06505); Tukey's test finds 5 of 6 pairs that differ.
How to read the picture
The curve is the null world of F: how the ratio of between to within would vary if every group had the same mean.
The vertical line is your F; the shaded tail is the p-value.
The ANOVA table shows the two sums of squares that make F.
Tukey's intervals: a pair whose interval excludes 0 differs, with the familywise error held at α.
Your data
Significance level α
ANOVA asks one question about several groups at once: do their means differ by more than the spread inside the groups would explain? F is the variation between the group means over the variation within the groups. If ANOVA rejects, Tukey's test says which pairs differ, with intervals that hold for all the pairs together.
The estimate and what the data show
| Source | SS | df | MS | F | p |
|---|---|---|---|---|---|
| between | 9467.7615 | 3 | 3155.9205 | 278.1959 | 1.40E-174 |
| within | 136085.4584 | 11996 | 11.3442 |
| Pair | x̄ᵢ − x̄ⱼ | Interval | q | p | p ≤ α |
|---|---|---|---|---|---|
| 1 − 2 | -0.8892 | [-1.096, -0.6825] | 15.6279 | < 1.00E-12 | ✓ |
| 1 − 3 | -2.3478 | [-2.57, -2.1256] | 38.396 | < 1.00E-12 | ✓ |
| 1 − 4 | -0.1985 | [-0.4276, 0.03056] | 3.1489 | 0.1161 | ✗ |
| 2 − 3 | -1.4586 | [-1.6833, -1.2338] | 23.5829 | < 1.00E-12 | ✓ |
| 2 − 4 | 0.6907 | [0.4592, 0.9222] | 10.8396 | < 1.00E-12 | ✓ |
| 3 − 4 | 2.1493 | [1.9038, 2.3947] | 31.8222 | < 1.00E-12 | ✓ |
The worked steps
The grand mean
x̄ = Σ nᵢ x̄ᵢ / N = 14.8972, N = 12000Between groups
SS_between = Σ nᵢ (x̄ᵢ − x̄)² = 9467.7615Within groups
SS_within = Σ (nᵢ − 1) sᵢ² = 136085.4584Mean squares
MS_between = 9467.7615 / 3 = 3155.9205 · MS_within = 136085.4584 / 11996 = 11.3442The F statistic
F = MS_between / MS_within = 3155.9205 / 11.3442 = 278.1959The p-value
p = P(F(3, 11996) ≥ 278.1959) = 1.40E-174Critical value at α
α = 0.05: F* = 2.6056Effect size (η²)
η² = SS_between / SS_total = 9467.7615 / 145553.2198 = 0.06505Tukey's critical q
q* (4 groups, df = 11996) = 3.6337
The same in code
- scipy, from the data
from scipy import stats stats.f_oneway(g1, g2, g3, g4) stats.tukey_hsd(g1, g2, g3, g4)- statsmodels, from the data (a value column and a group column)
from statsmodels.stats.multicomp import pairwise_tukeyhsd pairwise_tukeyhsd(values, groups, alpha=0.05)- scipy, from the summaries
from scipy import stats F = 3155.9205 / 11.3442 p = stats.f.sf(F, 3, 11996) q_crit = stats.studentized_range.isf(0.05, 4, 11996)- Excel
Data Analysis ToolPak: Anova: Single Factor =F.DIST.RT(278.1959, 3, 11996)
Formulas
The between sum of squares measures how far the group means sit from the grand mean; the within sum measures the spread inside the groups. Tukey's q compares one pair's gap with the studentized range for k groups.
Try this
Between against within
Open the three machines and make every standard deviation 4 instead of about 2.
Look for: The means have not moved, so the between sum of squares is the same; the within sum grows, F shrinks and the verdict can flip. Differences between groups are judged against the noise inside them.
Size matters
Open Helion's regions with 10 customers each, then Helion's full regions.
Look for: With 10 per region only the largest gap stands out; with thousands, even North and South differ. With thousands, read η² to see how much of the variation the regions explain.
Why not six t tests?
Open Helion's regions and count Tukey's pairs: six comparisons among four groups.
Look for: Six t tests at 5 % each would give a false alarm somewhere about 26 % of the time if nothing differed. Tukey's intervals are wider so that all six together keep the 5 %.