Designing Experiments

Randomise, block, and decide the sample size before you look. The Salk vaccine trial, A/B tests, and why checking the results every day manufactures false wins

Designing Experiments

The most important statistical decisions are made before any data exist: who gets the treatment, who is compared with whom, and when you will stop. Get those right and the analysis is easy. Get them wrong and no analysis can rescue the result.

The Field Trial

Half of these 48 plots get a fertiliser, and the land is better in some places than others in a way you cannot see. Paint your own layout or pick a systematic one, then turn the hidden gradient and compare 2,000 seasons of your layout with 2,000 seasons of randomising.

Systematic layouts:
Blocks:
2.0
true effect of the fertiliser, unknown to the experimenter
6.23
estimate from the season on the field above
+4.27
built into your layout: fertility of its treated plots minus its control plots
—
plots complete randomisation needs to match one blocked plot (theory 6.0×)
Design, over 0 seasonsAverage estimateBiasStandard deviationTheory: bias, sd
Your layout, kept every season———+4.27, 0.29
Completely randomised———0.00, 0.76
Randomised blocks (north–south strips)———0.00, 0.31
Your layout puts the fertiliser on richer land than the controls, by 4.27 yield units on average. That amount is added to the estimate in every season, so its histogram is narrow and in the wrong place: repeating the experiment makes you more certain of the wrong answer. Nothing in the yields reveals it, because the fertility is hidden. Randomising is centred on the truth whichever way the gradient runs, and the north–south strips cut across the gradient, so each block is nearly uniform land and blocking removes most of the spread.

Simulated field: every plot’s yield is 30 + its hidden fertility + the true effect if treated + noise that changes each season. Sky plots are controls and orange plots are treated; white outlines mark blocks. In the histograms each amber bar counts seasons by the estimate they produced, the dashed line is the true effect, and the amber ring is the season on the field. “Your layout” is planted identically every season; the two randomised designs draw a fresh layout each season. Bias is the average estimate minus the truth. The theory column uses the fertility map, which only the demo can see.

Go deeper:Randomisation, Replication and Blocking

R. A. Fisher joined Rothamsted Experimental Station in 1919 and worked out there the principles that experiments in every science now follow. He set them out in Statistical Methods for Research Workers (1925) and The Design of Experiments (1935). There are three. Replication: each treatment goes on many plots, so that the variation between plots treated alike can be measured. Randomisation: chance, not the experimenter, decides which plots get which treatment. Blocking, which Fisher called local control: plots are grouped into blocks of similar land, and the treatments are compared within each block.

A fixed layout has a fixed imbalance. If its treated plots sit on land that is better by b, the estimate is the true effect plus b in every season, and more seasons only make the wrong answer more precise. Randomising does not remove the difference in fertility in any one season. It makes the difference equally likely to favour either treatment, so that over repetitions it averages to zero and shows up as spread instead of bias. With half of N plots treated at random, the fertility pattern contributes a variance of 4S²/N to the estimate, where S² is the variance of fertility across the field. Blocking replaces S² with the variance within blocks. When the blocks lie across the gradient, so that each is nearly uniform, most of S² disappears; when they lie along it, nothing is gained. The usual summary is “block what you can, randomise what you cannot”, a maxim usually attributed to George Box.

Randomisation does a second job: it justifies the analysis. Because the labels were assigned by chance, we know exactly how the estimate would behave if the treatment did nothing, by re-assigning the labels in every way the randomisation could have. That is the permutation test of the Hypothesis Tests lesson, and it is valid because the labels were assigned by chance. A systematic layout offers no such guarantee. The checkerboard in this demo is balanced against any straight gradient and does well on these fields, but it would fail against a pattern that alternates the way it does, and nobody can list in advance every pattern a field might hide. Randomisation is insurance against the ones nobody thought of.

The Polio Trial

The 1954 trial of the Salk vaccine ran as two designs at once. Find the puzzle in the published rates, then slide the risk in consenting families up and down and watch one design’s estimate drift while the other stays on the truth.

61%
fewer cases with the vaccine, randomised design (28 against 71)
54%
fewer cases with the vaccine, observed-control design (25 against 54)
71
rate among children who consented and got the placebo
46
rate among children whose parents refused: lower, with no injection at all
These are the published 1954 figures. Look at the two unvaccinated groups in the randomised design: children whose parents refused had less polio (46) than children who consented and received the placebo (71). Consenting families were different to begin with. In the observed-control design, the controls are every first- and third-grader, a mixture of both kinds of family, while the vaccinated children all come from families who consented. That comparison is not like with like, and it makes the vaccine look weaker.
60%
true efficacy in this simulated world
58%
randomised estimate in this trial (long-run 60%)
54%
observed-control estimate in this trial (long-run 54%)
−6 points
long-run error of the observed-control design
Children of consenting families are at 1.50 times the risk. The controls in the observed-control design are 60% such children and 40% lower-risk children, so they would have had less polio than the vaccinated group even with no vaccine. The comparison credits the vaccine with 54% when the truth is 60%. The randomised design compares consenters with consenters and is untouched.

The top chart shows the published 1954 rates, rounded as in Freedman, Pisani and Purves. Everything below it is a simulation built to show the direction of the bias, not a reconstruction of 1954. Orange bars are vaccinated children, sky bars the comparison group, grey bars children without consent; each bar is one simulated trial and the dashed tick is its long-run rate. In the lower chart the dashed line is the true efficacy, the amber curve the long-run estimate of the randomised design, the violet curve that of the observed-control design, and the dots are the simulated trial shown above. The diagnostic shift is applied only to the randomised trial; the observed-control design had no placebo and could not be blind in any case.

Go deeper:Comparable Controls, Placebos and Blinding

The 1954 field trial of Jonas Salk’s polio vaccine was the largest public health experiment of its time, involving well over a million children. The National Foundation for Infantile Paralysis first proposed to vaccinate second-graders whose parents consented and to use all first- and third-graders as controls. Some areas ran the trial that way. Others used a randomised design: among children whose parents consented, chance decided who received the vaccine and who received a placebo, and neither the families nor the doctors diagnosing cases knew which. On 12 April 1955 Thomas Francis Jr., who directed the evaluation, announced that the vaccine was safe and effective.

Two kinds of number appear in the demo’s top chart. The counts for the two randomised arms are exact: 57 cases among 200,745 vaccinated children and 142 among 201,229 given the placebo, which are rates of 28 and 71 per 100,000. The other group sizes and rates are the rounded figures tabulated from the Francis report in Freedman, Pisani and Purves’s textbook Statistics.

The explanation usually given for the puzzle is that better-off families consented more often, and their children were more vulnerable to paralytic polio: growing up in more hygienic surroundings, they tended to meet the virus later, without the protection that an early infection gives. So the observed-control comparison set a higher-risk vaccinated group against lower-risk controls and understated the benefit. In the model, if consenters’ children have r times the risk of the rest and a share c of parents consent, a vaccine of true efficacy e appears to have efficacy 1 − r(1 − e)/(cr + 1 − c). That equals e only when r = 1. The model is a simulation built to reproduce the direction of the bias; it is not a reconstruction of 1954.

The general points outlast the vaccine. Controls must be like the treated group in everything but the treatment, and the only reliable way to arrange that is to form both groups from the same people by chance. Volunteers differ from non-volunteers, often in ways that matter for the outcome. A placebo keeps the two groups’ experience the same, and blinding keeps expectations from shaping the measurement: polio was hard to diagnose in mild cases, and a doctor who knows a child was vaccinated may read a borderline case differently.

The Peeking Problem

This A/B test compares two identical versions. Press Run one experiment and stop the first time z crosses the line, then raise the number of looks and watch the false wins multiply. Switch stopping rules to repair it, and finally give B a real advantage.

Looks:
Stopping rule:
Maximum visitors per arm:
—
of 0 experiments declared a difference: every one a false positive
19.3%
exact figure for this rule (Armitage, McPherson and Rowe: 19.3%)
—
average visitors per arm when the experiment ended (maximum 1,000)
0.024
p-value of the experiment shown, at the moment it ended
Rule, with 10 looksCritical |z|False positives (no difference)Power at a difference of 0.00Average visitors per arm
Fixed horizon: look once, at the end1.96, once5.0%—1,000
Stop the first time |z| > 1.961.96 at every look19.3%—881
Pocock boundary2.56 at every look5.0%—971
O’Brien–Fleming boundary6.60 falling to 2.095.0%—991
A and B are identical here, so every “win” is false. Each look taken alone has a 5% chance of a false alarm, but stopping at the first one that crosses gives the data 10 chances: — of these experiments were stopped and declared significant. The p-value at the moment of stopping is below 0.05 every time, and it means nothing.

Simulated experiments: each visitor’s outcome is a score with standard deviation 1, and z compares the two arms’ averages so far. The teal path is the experiment being watched; faint grey paths are other experiments that ran to the end, and rose paths stopped where their dot is. Dashed sky lines are ±1.96, rose lines and dots are the stopping boundary at each look, and thin vertical lines are the looks. The end marker is emerald for a correct decision and rose for a wrong one. In the bar chart, rose bars are the exact false-positive rate of stopping at the first |z| > 1.96, emerald dots the rate with a Pocock boundary, and the amber line your own run. The table’s figures are exact, by numerical integration, unless marked as simulated.

Go deeper:Repeated Looks and Group-Sequential Designs

A significance test at the 5% level promises a 5% false-positive rate for one test at a sample size fixed in advance. Testing again and again as the data accumulate, and stopping at the first significant result, breaks the promise. Armitage, McPherson and Rowe computed by how much in 1969: for normal data and two-sided 5% tests, the chance of at least one “significant” result is 8.3% with two equally spaced looks, 14.2% with five, 19.3% with ten, 24.8% with twenty and 32.0% with fifty. The looks are not independent, since each uses all the earlier data, which is why ten looks give 19% and not 1 − 0.9510 = 40%.

There is no ceiling. The law of the iterated logarithm says that the running z statistic of a true null hypothesis will, with probability 1, eventually exceed any fixed threshold if you wait long enough. An experimenter who can keep collecting until the result is significant is certain to get there.

The remedy is to choose the looks and the thresholds before starting, so that the chance of crossing at any of them adds up to 5%. Stuart Pocock (1977) used the same critical value at every look: 2.413 for five looks. Peter O’Brien and Thomas Fleming (1979) made the early thresholds very strict and the last one close to the usual value: for five looks, 4.562/√k at look k, which is 4.56 at the first and 2.04 at the last. Gordon Lan and David DeMets (1983) introduced alpha-spending functions, which allow the number and timing of looks to change as the trial goes on. These group-sequential designs are standard in clinical trials, where an independent data monitoring committee reviews interim results because it would be unethical to continue a trial whose answer is already clear.

A sequential design trades a little power, or a slightly larger maximum sample, for the chance to stop early when the effect is large, and on average it needs fewer participants than a fixed design of the same power. The same problem is endemic in online A/B testing, where dashboards update continuously and it is tempting to stop the moment a result turns significant. What makes early stopping honest is that the stopping rule was fixed in advance.

Key Takeaways

  • A fixed layout carries a fixed bias that no amount of repetition removes; randomising turns it into spread.
  • Blocking compares treatments within similar units, and gains precision when the blocks really are uniform.
  • Controls must be comparable to the treated group: volunteers differ from non-volunteers, and blinding keeps expectations out of the measurements.
  • Stopping at the first significant look inflates false positives; fix the stopping rule in advance.

Spot a mistake or have an idea?

Search