A/B tests and the cost of peeking

Today let's find out what happens when you watch an A/B test every single day instead of waiting for it to finish.

Larkspur Home Goods runs an online store, and Dana, the site's analyst, is testing a new green add-to-cart button against the current blue one. Every day for up to 30 days, 300 new visitors see the blue button and another 300 see the green one. Dana has a habit. She opens the results every morning, checks whether the green button is ahead, and the moment the test looks significant, she calls a winner and ships it.

Here's that habit, laid out one morning at a time.

That is the whole shape of what Dana is doing. That habit has a real cost, and working out exactly how big it is, and what to do about it, is where we start.

The test Dana is actually running

Before looking at what checking early costs, let's be precise about the test itself.

Larkspur's store runs two versions of its add-to-cart button. Variant A is the current button, blue. Variant B is the new one, green. Every day, 300 new visitors are randomly sent to each variant, so by day 30 each variant will have seen up to 9,000 visitors in total.

To make this lesson's point as clean as possible, both buttons here truly convert at the same rate, 10%. Neither button is actually better. That's not something Dana knows. It's something we get to set up on purpose, so that anything the test calls a "win" is necessarily a false alarm, and we can measure exactly how often that happens instead of guessing.

The test Dana runs each day is a two-proportion z-test. It compares the cumulative conversion rate of variant B against variant A, using every visitor seen so far, not just that day's visitors. The test is two-sided, since Dana does not know in advance which button, if either, would do better, and she sets the usual significance level, alpha = 0.05.

That's the whole setup: two variants, 300 visitors a day each, both truly converting at 10%, checked daily with a two-sided z-test at alpha = 0.05. Now let's see what one honest look at that test costs.