← Chapter 13
Statistics · Chapter 13

Between and Within

Three groups come back with three different averages. They always will — averages taken from different people never land on the same number, even when nothing at all distinguishes the groups. So the useful question is never are the group means different? It is are they further apart than the ordinary churn inside the groups can explain? That comparison needs two numbers, not one: a measure of how far the group means sit from the overall average, and a measure of how much individuals scatter around their own group's average. Analysis of variance builds exactly those two, puts the first over the second, and calls the result F. Below, the group means are handles you can grab. Drag them apart and only the top of the ratio moves. Widen the scatter with the slider on the right and only the bottom moves. Everything — the sums of squares, the table, the p‑value, the curve — recomputes from the arrangement you build.

Grab a mean and move it

Each dot is one person's outcome; each thick bar is that group's mean, and each bar is a handle — drag it up or down (or tab to it and use the arrow keys). The dots travel rigidly with their bar, so dragging changes how far apart the groups sit without disturbing the scatter inside any of them. That is the whole point: you are moving the between part while holding the within part perfectly still, and F responds to that alone. The dashed line is the grand mean of everyone pooled together.
group mean vs grand mean — between person vs own group mean — within grand mean

One ratio, assembled

Both halves start as sums of squared deviations, and the two of them add up exactly to the total spread of all the data around the grand mean: SStotal = SSbetween + SSwithin. That identity is the reason the method is called analysis of variance rather than analysis of means. But sums of squares cannot be compared directly — one is built from k numbers, the other from N — so each is divided by its own degrees of freedom to become a mean square, which is an honest average squared deviation. F is the ratio of those two averages.

How surprising is that F?

Here is the quiet fact that makes the whole method work. MSwithin estimates the common within-group variance no matter what — whether the groups truly differ or not, it just pools the scatter inside them. MSbetween estimates that same variance only if every population mean is equal; any real separation inflates it. So under the null hypothesis the two are estimating the same thing and their ratio hovers around 1, and the curve below is the exact distribution that ratio follows, with df1 = k − 1 on top and df2 = N − k underneath. Shaded is the p‑value: the chance of an F this big or bigger when nothing separates the groups.
F when all population means are equal this big or bigger — the p‑value your F reject beyond here

Run the whole study a thousand times

Until now the handles have been sample means you arranged by hand. Promote them: treat the values you dragged them to as the true population means, then draw a fresh sample of n people from each group, compute F, throw the data away and keep only that number. The bars are those F values. The dark curve is the F distribution for these degrees of freedom — drawn from the formula, fitted to nothing, and correct only when the true means are all equal. Line the means up and the bars settle onto the curve with about one run in twenty past the cut‑off. Fan them apart and the whole pile marches right, off the curve. That march is power.
simulated studies the null curve, not fitted rejection cut‑off
Studies
run
0
Mean F
observed
—
Mean F
under the null
—
Share
rejecting
—
A trial with several armsdrag a mean bar on the left to begin

The study you are running

A trial with k arms and n people in each. The outcome is a symptom score six weeks in, where lower is better. Move these and the arrangement on the left rebuilds around them.
The design
3
8
The between part — the top of the ratio
6.0
This slider re-arranges every handle into an even fan. Dragging a single bar afterwards moves only that one, and the slider re-reads itself from whatever you built.
The within part — the bottom of the ratio
8.0
off
Jump to a situation worth seeing

This arrangement, computed live

People
total N
— 
Grand
mean
—all N pooled
df
between
—k − 1
df
within
—N − k
MS
between
—SSb ÷ df1
MS
within
—SSw ÷ df2
F
statistic
—MSb ÷ MSw
Reject
beyond
—α = 0.05
p‑value
upper tail
— 
η² share
explained
—SSb ÷ SStot
Widest gap
between arms
— 
Pooled SD
√MSwithin
—the common scatter
The table you would actually report
SourceSSdfMSFp
Every cell above is computed from the dots on the left, and every row is forced to be consistent: the two SS values add to the total, and the two df values add to N − 1. If a printed table ever fails those two additions, something has been mistyped.

Is the F test entitled to this data?

Three conditions sit behind the curve. Independence is a fact about how the data were collected and cannot be recovered from the numbers — one person's outcome must not sway another's, which rules out measuring the same person in two arms. Roughly normal within each arm matters most when the arms are small; with a healthy n the sampling behaviour of the means smooths out anyway. Comparable spreads is the one you can inspect here: MSwithin pools every arm into a single estimate, which only makes sense if there is a single scatter to estimate. The working rule of thumb is that the largest group SD should be less than about twice the smallest.
Smallest
arm SD
—
Largest
arm SD
—
Largest ÷
smallest
—
People
per arm
—

Say it right

Nine things people say after an ANOVA. Four of them are correct. Tap each one.
Pick a statementEach one is either a fair reading of F or a habit worth breaking. The four correct ones are the sentences you can safely write down.

What to carry out of this section

F is a signal-to-noise ratio, and you can see both halves on screen. The numerator asks how far the group means have wandered from the grand mean; the denominator asks how far individuals wander from their own group's mean. Neither number means anything alone. A gap of six points between arms is enormous if people within an arm sit within a point or two of each other, and invisible if they are scattered over thirty. That is why dragging the bars apart and widening the scatter can leave F exactly where it was — the two moves cancel. F only ever reports the comparison.
Under the null, F sits near 1 — not near 0. Both mean squares are estimating the same variance when no arm truly differs, so their ratio is a number divided by a slightly different estimate of itself. Its long-run average is df2 / (df2 − 2), a hair above 1. This is the single most useful sanity check you have: an F of 0.8 is not weak evidence of a difference, it is a perfectly ordinary null result, and an F below 1 means the group means are actually closer together than chance alone typically puts them.
Only the upper tail is used, and not because the alternative is one-sided. Every kind of separation between arms — in any direction, in any arm — makes the numerator larger, because the deviations from the grand mean are squared before they are added. There is no arrangement of means that produces a small F for an interesting reason. So a big F is the only signal of difference there is, and the lower tail is not a rejection region.
Sample size lives in the numerator, and it changes the verdict without changing the world. SSbetween is n multiplied by the squared distances between the means, so holding the arrangement fixed and adding people drives F up roughly in proportion to n. Load Same gaps, more people and then drag n back down to 5: the arms are exactly as far apart as they were, the scatter is identical, and the test now shrugs. A large p‑value never means the arms are the same. It means this study could not resolve the difference at hand. Effect size — η², the share of total variation the grouping accounts for — is the number that stays put when n moves, which is exactly why it belongs beside every F you report.
A significant F does not say which arms differ. ANOVA is an omnibus test: one question, "is anything going on among these means?", answered with one number. It will not tell you that arm A beat arm C, and reading the largest and smallest means off the chart after the fact is exactly the fishing expedition the omnibus test was designed to protect you from. Follow-up comparisons — Tukey's procedure and its relatives — exist precisely because they adjust for how many pairs you are inspecting. Which is also why running a separate t‑test on every pair is not a substitute: with six arms there are fifteen pairs, and at 5% apiece the chance of at least one false alarm climbs above 50%.
Nor does it say the grouping caused anything. F compares variances; it knows nothing about how people ended up in the arms they are in. If they were randomly assigned, the difference is attributable to the assignment, and a causal reading is earned by the design rather than by the statistic. If the groups were merely observed — people who already differ, sorted by something they chose — then anything that travels with the grouping is a live alternative explanation, and the same F is the same number carrying far less freight.
One thing worth doing before you leave. Press Line the means up, so every population mean is genuinely identical, and run five thousand studies. The bars land on the curve, the mean F settles near 1, and roughly one study in twenty crosses the rejection line anyway. Nothing is wrong with those studies. They are honest samples from a world with no difference in it, and they are the advertised, agreed-upon price of drawing a line at 5%.