Peeking simulator

Why you can’t stop a test the moment it looks good. Each grey line is one test of a change that does nothing, followed every time someone checks the dashboard. Red lines are tests that would have been called a win anyway.

How to read itLeft to right is the test’s life, look by look; up means B looks better. Each grey line is one simulated test. The black lines are where a result counts. Red lines are tests stopped on a win or a loss that is not real; blue lines, when the change really works, are real wins found.

How often you check the results
When you stop
What is really true
Tests to simulate
line you must cross to call a winnerstopped on a fake winstopped on a real win

—

Stopped, on average, at check
—
Called the wrong direction
—

The maths

Each path is a sum of independent standard normal increments, standardised at every look: the large-sample behaviour of a z-test as data accumulates, exact enough for any test with thousands of users per look.

Boundaries use Lan–DeMets alpha spending, two-sided, α = 0.05 split equally between the tails, computed by numerical integration and checked against published tables and simulation.

O’Brien–Fleming type spends almost nothing early, so early stops need overwhelming evidence and the final look stays close to 1.96. Pocock type spends evenly and is easier to stop early, at the cost of a stricter final look.

The same idea with a coin

Toss a coin 1,000 times and keep a running score, +1 for heads and −1 for tails. The score after 1,000 tosses contains the score after 500: it is the same walk, looked at twice. Each path above is a walk like that, rescaled so that it can be read in standard errors.

That is why looks are neither independent nor identical. Five completely fresh chances at 5% would give 1 − 0.95⁵ = 23% false alarms. Five looks at exactly the same number would give 5%. Five looks at a growing total give 14%.

α spending
The 5% of false alarms is a budget. A plan says how much of it each look may use.
4.88 … 2.03
O’Brien–Fleming type, five looks: 4.88 · 3.36 · 2.68 · 2.29 · 2.03. The first look spends almost nothing, about one false stop in a million tests, so the last line stays close to 1.96.
about 2.4
Pocock type, five looks: roughly the same line at every look. Easier to stop early, harder to win at the end, and up to 21% more people.

To size a sequential test, set “Planned looks at the results” in the planner. The reasoning is in Looking early without fooling yourself.