Explore

One-way ANOVA with Tukey's test

H₀: μ₁ = … = μ₄ · H₁: at least one mean differs

Your result lies beyond the edge of the chart; it is marked at the edge.

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

Groups: n, mean, standard deviation
One group per line (or separated by ;): its size, mean and standard deviation, separated by commas.

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

The estimate with its interval 1 − 2: −0.9 [−1.1, −0.7]. 1 − 3: −2.3 [−2.6, −2.1]. 1 − 4: −0.2 [−0.4, 0.0]. 2 − 3: −1.5 [−1.7, −1.2]. 2 − 4: 0.7 [0.5, 0.9]. 3 − 4: 2.1 [1.9, 2.4]. no difference. no difference1 − 2 −0.9 [−1.1, −0.7] 1 − 3 −2.3 [−2.6, −2.1] 1 − 4 −0.2 [−0.4, 0.0] 2 − 3 −1.5 [−1.7, −1.2] 2 − 4 0.7 [0.5, 0.9] 3 − 4 2.1 [1.9, 2.4] −3 −2 −1 0 1 2 3x̄ᵢ − x̄ⱼ (Tukey's intervals)
The ANOVA table
SourceSSdfMSFp
between9467.761533155.9205278.19591.40E-174
within136085.45841199611.3442
Tukey's test for every pair (Tukey–Kramer)
Pairx̄ᵢ − x̄ⱼIntervalqpp ≤ α
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.14890.1161✗
2 − 3-1.4586[-1.6833, -1.2338]23.5829< 1.00E-12✓
2 − 40.6907[0.4592, 0.9222]10.8396< 1.00E-12✓
3 − 42.1493[1.9038, 2.3947]31.8222< 1.00E-12✓

The worked steps

  1. The grand mean

    x̄ = Σ nᵢ x̄ᵢ / N = 14.8972, N = 12000
  2. Between groups

    SS_between = Σ nᵢ (x̄ᵢ − x̄)² = 9467.7615
  3. Within groups

    SS_within = Σ (nᵢ − 1) sᵢ² = 136085.4584
  4. Mean squares

    MS_between = 9467.7615 / 3 = 3155.9205 · MS_within = 136085.4584 / 11996 = 11.3442
  5. The F statistic

    F = MS_between / MS_within = 3155.9205 / 11.3442 = 278.1959
  6. The p-value

    p = P(F(3, 11996) ≥ 278.1959) = 1.40E-174
  7. Critical value at α

    α = 0.05: F* = 2.6056
  8. Effect size (η²)

    η² = SS_between / SS_total = 9467.7615 / 145553.2198 = 0.06505
  9. Tukey'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)
Excel has no Tukey test; scipy's tukey_hsd and statsmodels' pairwise_tukeyhsd both use the Tukey–Kramer form for unequal group sizes.

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

  1. 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.

  2. 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.

  3. 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 %.

An unhandled error has occurred. Reload 🗙

Reconnecting…

Your connection to Hypothesis Testing Lab dropped, probably a Wi-Fi blip. Hold on while it reconnects.

The connection could not be restored. The page will reload in a few seconds.