How to Run an A/B Test: Hypothesis, Sample Size and the Most Common Mistakes

Girişimci Kafası5 min read
Mary Cassatt, The Tea, 1880: two women on a floral sofa in a striped drawing room, one drinking from a white cup, a silver tea set on a tray in front of them
Image: Mary Cassatt, The Tea (Le Thé), yaklaşık 1880, Museum of Fine Arts, Boston (kamu malı, Wikimedia Commons)

One afternoon at the Rothamsted agricultural research station in England, the statistician Ronald Fisher handed a cup of tea to the algae specialist Muriel Bristol. She turned it down: she wanted the milk poured in before the tea. Fisher said the order could not change the taste. Bristol said she could tell the difference.

William Roach, who overheard them and would later marry Bristol, suggested a way to settle it: let's test her. Fisher turned the moment into an experimental design in the second chapter of The Design of Experiments, published in 1935. Eight cups are prepared; four get milk first and four get tea first. The cups are served in random order and the lady is asked to pick out the four with milk first.

Fisher's arithmetic was this: there are 70 ways to choose four cups out of eight. If Bristol could not tell anything, her chance of picking all four correctly was 1 in 70. Only then could you say that something beyond luck was going on. According to the statistician David Salsburg, who heard it from H. Fairfield Smith, a witness to the test, Bristol got all eight cups right.

The most interesting part of the story is not the result but the rules written before it. How many cups, what order, how much success would count: all of it was settled before the test began. A startup's A/B test is worth something only with the same discipline; otherwise it is just an expensive coin toss.

A confession from the founder of an A/B testing tool

Joe D'elia, whom Failory interviewed in 2019, had built Tailor, a website personalisation and A/B testing tool. His idea was simple: show a variant to 10% of traffic and serve the winner to the remaining 90%. He found the existing tools too focused on statistics. As he told Failory, his maths was wrong from start to finish, and the product often did little more than pick a random option. The tool could only give meaningful results for large sites; on small, low-traffic sites the difference in conversion simply did not show.

Another founder interviewed on the same site, the data scientist Andy Goldschmidt, had built ABBY to document A/B test results. His observation was that teams ran tests but neglected to write down the results. A test that is not written down does not feed the next decision.

Eight porcelain teacups on a table; a hand lifts one of them, with a milk jug and a teapot beside them
Illustration: Girişimci Kafası · generated with AI

How do you run an A/B test?

An A/B test means splitting visitors at random into two groups over the same period, showing one the current version and the other a single change, and comparing how the two groups behave. The rules of Fisher's tea table apply here too.

Write the hypothesis before the test

"Let's try the new button" is not a hypothesis. "If we change the wording on the sign-up button, the sign-up rate will rise by at least one point" is. Write down what you are changing, which number you will watch and what difference you will count as meaningful before the test starts. To link that number to the company's real goal, What Is a North Star Metric? helps.

Work out the sample size in advance

This is where Tailor stumbled on small sites. If your sign-up rate is 5% and you want to catch a change that lifts it to 6% with 95% confidence and 80% power, the standard formula calls for about 8,150 visitors in each group. A product with a few hundred visitors a week cannot finish that test for months. At that stage talking to users teaches you faster; that is why How to Run a Customer Interview is useful.

Do not peek at the result and stop the test

The software developer Evan Miller's 2010 piece How Not To Run an A/B Test describes the most common mistake: opening the test every day and stopping it the first moment it looks significant. In Miller's example, even a change with no effect at all is declared the winner 26.1% of the time when tests are stopped as soon as significance appears. The intended error rate is 5%. Set the duration and the sample at the start, then wait.

One change, one main number

If you change the headline, the colour and the price in the same test, you cannot know which one worked. If you look at twenty different numbers, one of them will look like a winner by chance. Pick one main number and watch the others only to catch damage.

Write down the result, losers included

Goldschmidt's observation applies here: record the test's name, hypothesis, duration, result and decision in a short note. Losing tests teach as much as winners; when they are not written down, the same idea gets tried again six months later.

Hypothesis: the stone placed underneath

The word hypothesis comes from the Ancient Greek hupóthesis, which means "a placing under". You set a stone beneath a line of reasoning, not yet proven, but something to build on.

Fisher used that stone the other way round. What the experiment tested was not Bristol's ability but the assumption that she could not tell any difference; this is called the null hypothesis. For Fisher the null hypothesis is never proved by an experiment, it can only be disproved. That small distinction saves a startup team from a lot of error: a test does not say "the new design is better", only "this difference is unlikely to be chance".

A small crowd passing through an arched doorway and dividing into two separate corridors; in front, a pair of scales with both pans empty and level
Illustration: Girişimci Kafası · generated with AI

Who are you fooling?

In his 1974 commencement address at Caltech, the physicist Richard Feynman put the first principle of scientific honesty like this:

"The first principle is that you must not fool yourself"

and, he added, you are the easiest person to fool. An A/B test protects not the team but, first of all, the person who has fallen in love with an idea. In your last test, did you know which result you wanted to see before it started?

Before you decide which idea is worth testing, What Is an MVP and How Do You Plan One? is worth a read.