Math paradoxes

Courses / A/B testing in plain words

Course · for non-mathematicians

A/B testing in plain words

Test: a "Buy now" buttonday 3 of 14
A48 purchases of 1,000 B61 purchases of 1,000
B +27%confidence 90%

The boss asks: "Do we ship B to everyone?"

An A/B test is a way to compare two versions fairly: half the people see A, half see B, and we count who bought. The idea is simple, but it comes with many questions. Why test when you can compare "before" and "after"? How many people do you need? What does "95% confidence" mean? When may you stop? What if there is no winner? The course answers nine such questions, one per chapter. There are no formulas: only counting ("6 purchases in 100"), a coin and a "Run it again" button. At the end comes an exam of seven dashboards and an answer for the boss on this one.

≈ 30–40 minutes, in 5-minute parts if you like; your progress is saved.

This is the first step. When you want more, there is a course for those who run tests every week: "A/B testing paradoxes".

Done 0 of 10 chaptersCatalogue puzzles solved: 0 of 5
Test dictionaryversions A and B, conversion rate, lift, control group, A/A test, confidence, winner
Versions A and B
A is what you have now, B is the new idea: another button, subject line or price.
Conversion rate
How many people in 100 took the action: 6 purchases per 100 visitors is 6%.
Lift
"B +20%" on a dashboard: how much bigger B's number is than A's. From 5 to 6 in 100 is +20%, though the gap is just 1 purchase per 100 people (chapter 4).
Control group
Those who see the old version A at the same time as others see B (chapter 1).
A/A test
A test of two identical versions. It shows how much difference chance alone makes (chapter 3).
Confidence
A number on the dashboard that shows how rarely chance alone would give such a lead (chapter 5).
Winner
The version that leads with 95% confidence or more at the end of the test.
Part 1 · no formulas

How a test works

Four questions about why a test is built the way it is: two groups at the same time, a coin, and many people. Each chapter starts with a question: guess first, then check it on a live picture.

1

Why test if there is "before and after"?

"We redesigned the site on 1 November, and there were 30% more orders in November than in October. Isn't that proof?"

The simplest way to check a change is to compare the month before and the month after. In October an online shop got 4,500 orders. On 1 November a new design went live, and November brought 5,850 orders, 30% more.

How many orders did the new design add?

November is Black Friday and the start of gift shopping. Last year, with no redesign at all, orders rose 29% from October to November. So the season gave almost the whole +30%, and the design may have added a little, nothing, or even hurt. Switch on last year below.These numbers can't tell. November is Black Friday and the start of gift shopping. Last year, with no redesign at all, orders rose 29% from October to November. So the season gave almost the whole +30%, and the design may have added a little, nothing, or even hurt. Switch on last year below.

Orders by month

this yearlast year● design launch

November vs October, this year+30%with the new design
November vs October, last year?with no changes at all

From one month to the next everything changes at once: the season, the weather, ads, competitors' prices, the news. "Before and after" adds them all into one number and credits it to the new design. An A/B test does it differently: on the same days, half the people see the old site and half see the new one. The season, the weather and the ads are the same for both halves, so the difference between them comes from the design. The half with the old version is called the control group.

How to judge a change when a test is impossible is the subject of the course "Does the feature work?".

2

Why does a coin split the groups?

"The new cart is seen by those who clicked "Try the new version" themselves. They buy 2.5 times as often. Shall we switch it on for everyone?"

A shop gets 1,000 visitors a week. Among them are 200 regular customers who buy often and 800 newcomers who mostly just look. A "Try the new cart" button appeared on the site, and 100 people clicked it.

Of those who clicked, 13 in 100 bought. Among the other 900, only 5 in 100.

Is the new cart better than the old one?

Regular customers are keener to try new things. They are 60 of the 100 who clicked, and only 140 of the other 900. Regulars buy more often with any cart. In this example the new cart changes nothing at all, and the 13 vs 5 gap appears anyway. See below who is in which group.Unknown. Regular customers are keener to try new things. They are 60 of the 100 who clicked, and only 140 of the other 900. Regulars buy more often with any cart. In this example the new cart changes nothing at all, and the 13 vs 5 gap appears anyway. See below who is in which group.

Who is in which group

regular customers: 20 in 100 buynewcomers: 2–3 in 100 buy

When people choose for themselves, different people end up in the groups, and the difference in purchases shows the people, not the versions. A coin knows nothing about people: regulars and newcomers land in A and B equally, with a little wobble. That is why in an A/B test each person's group is picked by chance, not by them and not by a manager.

Story In 1948 Britain's Medical Research Council tested streptomycin against tuberculosis. Which of the 107 patients got the drug was decided not by doctors but by random numbers in sealed envelopes. That way doctors could not, even unintentionally, give the drug to those who were more likely to recover anyway. It is counted among the first randomised trials in medicine. Source: Medical Research Council, "Streptomycin treatment of pulmonary tuberculosis", BMJ, 30 October 1948.
3

Can a difference come from nowhere?

"Pages A and B are identical. So where does a difference come from?"

The best way to understand a test is to run it on two identical pages. Such a check is called an A/A test. A coin splits the visitors, and both halves see the same page. On it, an of 5 people in 100 buy.

Each group got 100 visitors.

How often will one group have at least 3 more purchases than the other, say 4 against 7?

In about 41 tests out of 100, one of the identical groups beats the other by 3 purchases or more. And 4 vs 7 on a dashboard looks like "B is 75% better". Purchases are separate people, and in a small group each extra buyer moves the number noticeably. Run the test below a few times.Often: in about 41 tests out of 100, one of the identical groups beats the other by 3 purchases or more. And 4 vs 7 on a dashboard looks like "B is 75% better". Purchases are separate people, and in a small group each extra buyer moves the number noticeably. Run the test below a few times.

An A/A test: 100 visitors each on the same page

A

B

boughtdidn't buy

Tests run0
A gap of 3+ purchases–exactly: 41 tests in 100

Even when the versions are the same, the numbers in the groups differ: chance decides exactly who came and who bought. The fewer the people, the stronger this wobble. So a difference on a dashboard does not yet mean one version is better. The question is always the same: is this difference bigger than what chance alone gives?

The A/A test: two identical pages

The same page is shown as "A" and as "B", converting at 5%, with 1,000 visitors each. How often will one of two identical pages "win" by 20% or more?

4

How many people do you need?

"We have a thousand visitors per version. Isn't that enough?"

Now let B really be better. On the old page A, 5 people in 100 buy; on the new page B, 6 in 100. For a business that is a lot: one extra purchase for every five.

Note that there are two different percentages here. "5 in 100" and "6 in 100" are conversion rates: 5% and 6% of visitors bought. But the dashboard will say "B +20%": how much bigger B's number is than A's, since 6 is a fifth more than 5. It is the same gap, one purchase per 100 people, yet it can sound like "+1%" or like "+20%". When you see a lift on a dashboard, ask: from what to what?

The test runs until each version has been seen by 1,000 people. Then we compare where there are more purchases.

How often will the worse version A come out ahead?

A thousand people means on average 50 purchases on A and 60 on B. That is a gap of 10 purchases, while chance easily moves each number by 7–10 purchases either way. So in about 15 tests out of 100, the worse A is ahead. Change the number of people below.About 1 time in 7. A thousand people means on average 50 purchases on A and 60 on B. That is a gap of 10 purchases, while chance easily moves each number by 7–10 purchases either way. So in about 15 tests out of 100, the worse A is ahead. Change the number of people below.

100 tests where B really is better

people per version

B aheadthe worse A aheada tie

B ahead–
The worse A ahead–

A test sees a difference only when it is bigger than the wobble of chance. And the wobble fades slowly: to make it half as big you need four times as many people. Hence a simple rule: the smaller the difference you want to notice, the more people you need. Half the difference means four times the people.

Exactly how many is what sample-size calculators work out, and there are free ones. They need two things: the current conversion rate and the smallest difference you want to notice. For 5 vs 6 in 100 it comes to about 6,500 people per version, six and a half times as many as in our example.

The most dangerous equation

Disease is rarest in quiet rural counties. Clean air? Or something else?

What you know now "Before and after" mixes the change with the season (1), so two versions are compared at the same time and a coin splits the groups (2). Even identical versions give different numbers (3), and to notice a real difference you need many people (4). The second part is about how a dashboard tells a real difference from a chance one, and where that method can be broken.
Part 2 · still no formulas

How to read the result

What the number "95% confidence" promises, and three habits that quietly make that promise empty.

5

What does "95% confidence" mean?

"The dashboard says: B is ahead, confidence 95%. Is that a guarantee?"

The testing tool knows how the numbers wobble (chapter 3) and compares B's lead with that wobble. The bigger the lead and the more people, the higher the "confidence". A winner is usually declared once it reaches 95%.

To see what this threshold promises, take identical pages again, 1,000 people on each.

A and B are identical. How often will the test still show "B ahead, confidence 95%" or more?

That is exactly what 95% means: if the versions were the same, chance would give such a lead for B less than 1 time in 20 tests. It is not a guarantee but an agreement about risk: about one "winner" in twenty among identical versions will be fake. Run 20 tests below.About 1 time in 20. That is exactly what 95% means: if the versions were the same, chance would give such a lead for B less than 1 time in 20 tests. It is not a guarantee but an agreement about risk: about one "winner" in twenty among identical versions will be fake. Run 20 tests below.

20 A/A tests, 1,000 people per page

"winner": B ahead with 95%+ confidence

Tests run0
Fake winners–on average 1 in 20

The easiest way to picture the 95% threshold is as the setting of a smoke alarm. You can make it so sensitive that it hears every spark, but then it will beep at every burnt piece of toast. 95% is an agreement: at "toast", meaning chance alone, the test goes off falsely about 1 time in 20. And a real "fire", a real difference, it notices more often the bigger it is and the more people are in the test.

This is the alarm the calculator from chapter 4 sizes the test for. 6,500 per version is enough for a real gap of 5 vs 6 in 100 to reach 95% in about 8 tests out of 10.

The 95% threshold protects against chance, but only up to one in twenty. And the promise holds only if you play fair: the number of people is set in advance, the result is read once at the end, and one version is checked against one. The next three chapters are three ways to break that promise without noticing.

One more thing: 95% says nothing about the size of the gain. "B +27%, confidence 95%" does not promise +27% after launch (chapter 8). Some tools show a "" instead of confidence; it is computed differently, and a chapter of the course for marketers covers it.

Story Why 95% in particular? In 1926 the statistician Ronald Fisher, who worked with field trials at the Rothamsted agricultural station, wrote that he personally considered a result worth attention when chance would give it less than once in 20 times. It was his personal rule, not a law of nature. It stuck and now sits on most dashboards. Source: R. A. Fisher, "The Arrangement of Field Experiments", Journal of the Ministry of Agriculture 33 (1926).
6

When may you stop a test?

"The test is planned for 14 days, but on day three it is already at 95%. Why wait?"

The test is planned for 14 days, with 300 people seeing each version every day. The dashboard updates every morning, and every morning someone opens it. The agreement: as soon as confidence reaches 95%, the test stops and the winner is announced.

Take identical versions again, where there can be no winner.

How often will a fake winner appear within the 14 days?

In about 19 tests out of 100, four times as often as the threshold promises. Confidence wanders up and down every day, and each morning is a new chance to touch 95% by luck. Had the test not been stopped, most of these "winners" would have dropped back below by day 14. See how confidence wanders below.About 1 time in 5: in 19 tests out of 100, four times as often as the threshold promises. Confidence wanders up and down every day, and each morning is a new chance to touch 95% by luck. Had the test not been stopped, most of these "winners" would have dropped back below by day 14. See how confidence wanders below.

Confidence day by day, identical versions

confidence that B is betterthe 95% threshold

Tests run0
Touched 95% at least once–what daily checks would stop
95% on day 14–as the threshold promises

The 95% threshold is designed for one look at the end. Every daily check with the right to stop is one more try, and fake winners pile up. You may look at the dashboard: to spot a bug or a disaster. You may not stop the test because it has "already gone green".

Story In 2010 the developer Evan Miller published a short article, "How Not To Run an A/B Test". He showed that the habit of stopping at the first "significant" result turns the promised 5% of false wins into far more, and proposed a simple rule: fix the sample size in advance and don't stop earlier. Since then many testing tools have added protection against peeking. Source: Evan Miller, "How Not To Run an A/B Test", evanmiller.org, 2010.

Peeking at an A/B test

Two identical pages, a 30-day test, a check every evening and a stop at the first "95%". How often is one of the identical pages declared the winner?

7

Why not test 10 variants at once?

"AI wrote 10 headlines. We test them all against the old one, and one won with 95% confidence. Do we take it?"

The new headlines are no better than the old one: on each, the same 5 people in 100 buy. Each headline is seen by 2,000 people, the old one by 2,000 as well, and each new one is compared with the old.

How often will at least one of the 10 equally good headlines "win" with 95% confidence?

In about 24 tests out of 100. Each headline has its own 1-in-20 chance to beat the old one by luck, and there are ten headlines. The chances add up, and a "winner" turns up in every fourth test, though no headline is better. Run it below.About 1 time in 4: in 24 tests out of 100. Each headline has its own 1-in-20 chance to beat the old one by luck, and there are ten headlines. The chances add up, and a "winner" turns up in every fourth test, though no headline is better. Run it below.

10 equally good headlines against the old one

the tick is the 95% threshold"winner"

Tests run0
Tests with a "winner"–with one headline it would be 1 in 20

The same happens when one test's result is cut into pieces: mobile and desktop, new and returning, cities, days of the week. Each piece is one more try, and among a dozen pieces "B wins on Android in Kharkiv" is easy to find. The more tries, the surer one of them wins by luck.

Story In the xkcd comic "Significant" (2011), scientists check whether jelly beans cause acne. Overall, no. Then they check 20 colours one by one, and green ones are "linked to acne" with 95% confidence. A newspaper runs a headline about green jelly beans, though one hit in twenty is exactly what chance should give. Source: Randall Munroe, xkcd #882, "Significant", 2011.

Slice it until something wins

The new email is no better than the old one. The analyst checks the result in 20 countries. What is the chance at least one shows a "significant" difference?

8

Why is the effect smaller after launch?

"In the test B gave +20%, and after launch only +10%. Did someone make a mistake?"

This time B really is 10% better: 50 people in 1,000 buy on A, and 55 on B. Each version is seen by 5,000 people, and the test is fair: the number of people was set in advance and the result is read once at the end. The team runs many such tests and ships those where B won with 95% confidence.

What gain, on average, do the tests show where B won?

About +21% on average, twice the truth. Not every test produces a winner, only one where chance pushed B upward: without that push, +10% on 5,000 people rarely reaches 95%. After launch the push is gone, and the true +10% remains. Nobody made a mistake. Look at 100 tests below.More: about +21% on average, twice the truth. Not every test produces a winner, only one where chance pushed B upward: without that push, +10% on 5,000 people rarely reaches 95%. After launch the push is gone, and the true +10% remains. Nobody made a mistake. Look at 100 tests below.

100 fair tests where B really is 10% better

B wonno winnerthe truth, +10%the winners' average

Tests where B won–of 100
Their average gain–really +10%

This is called the winner's curse: when you pick the best, you also pick the lucky ones. The fewer people in a test, the bigger the push needed to win, and the more the winner exaggerates.

There is a second reason, with no chance involved: the novelty effect. A new bright button draws regular customers' attention because they haven't seen it before. In a few weeks they get used to it, and the difference fades. So a test that ran only a few days can show an effect that will be gone in a month.

Story At Microsoft, which runs thousands of online experiments a year, analysts go by "Twyman's law": any figure that looks interesting or different is usually wrong. Ron Kohavi, who led experimentation there for years, advises checking a surprisingly big win as carefully as a bug. Source: Ron Kohavi, Diane Tang, Ya Xu, "Trustworthy Online Controlled Experiments" (2020), chapter 3.

The winner's curse

Ten bidders honestly estimate a jar of coins worth 100 dollars and bid their estimates. On average, what does the auction winner make?

9

No winner. Now what?

"The test is over, and the dashboard is grey: B +4%, confidence 70%. So B doesn't work?"

The most common result of an A/B test is neither a win nor a loss but a grey "no winner". Here is such a test. It was sized honestly with the calculator from chapter 4: 6,500 people per version, to notice a gap of 5 vs 6 in 100. The test ran to its end, and the result was read once.

Test: new button textday 14 of 14
A325 purchases of 6,500 B338 purchases of 6,500
B +4%confidence 70%

What does such a result say?

The test is sized for a +20% gap, and it catches that 8 times in 10. So a big difference here is unlikely. But it sees a small one poorly: if B really were 4% better, the test would find a winner in only 13 cases out of 100. "No winner" means "the test couldn't tell", not "there is no difference". And running the test until 95% is the peeking from chapter 6. Play below with what is really true.No. The test is sized for a +20% gap, and it catches that 8 times in 10. So a big difference here is unlikely. But it sees a small one poorly: if B really were 4% better, the test would find a winner in only 13 cases out of 100. "No winner" means "the test couldn't tell", not "there is no difference" and not "B is better". And running the test until 95% is the peeking from chapter 6. Play below with what is really true.

100 tests just like it, 6,500 people each

B wonno winnerA "won"

B won–
No winner–

A grey result is neither a failure nor wasted work. It says something useful: the big difference the test was sized for is most likely not there. A small one may well be, it just needs far more people.

Story Ron Kohavi and colleagues write that at Microsoft only about a third of the ideas tested in experiments improved the metric they were designed to improve. The rest made no noticeable difference or did harm. So a grey dashboard is an ordinary day for a team that tests honestly. Source: Ron Kohavi, Diane Tang, Ya Xu, "Trustworthy Online Controlled Experiments" (2020), chapter 1.
What you know now "95% confidence" means chance gives such a lead less than 1 time in 20 (5). That promise breaks when you stop the test as soon as it goes green (6) and when you sift through many variants or segments (7). And even a fair winner shows more in the test than it will deliver after launch (8). And if there is no winner, that means "the test couldn't tell", not "there is no difference" (9). What remains is the exam: seven dashboards, and then an answer for the boss from the start of the course.
Finale

The exam and an answer for the boss

Everything from the course is now in dashboards that could land in your work chat.

10

Exam: seven dashboards

"Here are seven results. What do we do with them?"

Six dashboards hold one trap or question from the course each, and one is clean. Choose what to do. After you answer, an explanation appears with a link to the chapter that covered it.

Dashboard 1

Email subject linea test send
A5 opens of 60 B9 opens of 60
B +80%

Proposal: send subject B to the whole list, 40,000 addresses.

Too few people. 5 vs 9 opens is a gap of 4 people, and on 60 addresses chance gives that too (chapter 3). "+80%" sounds loud here only because the numbers are small. To notice a real difference, the test send needs thousands of addresses (chapter 4).

Dashboard 2

A new home-page bannersince 1 December
Nov3,200 sales Dec4,320 sales
+35%after the banner launch

Proposal: put such banners on every page.

This is a comparison with the past, not a test. December is gift month, and sales rise in it even without a banner (chapter 1). To learn what the banner gave, show it to a random half of visitors and the page without it to the other half, on the same days.

Dashboard 3

A delivery price testday 3 of 14
A45 orders of 900 B62 orders of 900
B +38%confidence 95%

Proposal: stop the test today and switch B on for everyone.

Too early. The test is planned for 14 days, and 95% on day three is exactly when identical versions often touch the threshold (chapter 6). Wait for the planned end and read the result then.

Dashboard 4

A new product descriptionday 21 of 21
A1,070 purchases of 21,400 B1,180 purchases of 21,350
B +11%confidence 99%

The testing tool split the groups at random. Size and length follow a calculator written down before the start. One variant against one. Proposal: switch on B.

You can ship it. There is no trap here: the groups were split at random (chapter 2), the number of people was set in advance (chapter 4), the result was read at the planned end (chapter 6), and there is one variant (chapter 7). Just don't promise the boss exactly +11%: the real gain is most likely a bit smaller (chapter 8).

Dashboard 5

A new sign-up form12 segments
AllB +1%, confidence 58% 1 of 12B +24%, confidence 96%
Android, Kharkiv

The result was cut into 12 segments after the test. Proposal: show the new form to Android users in Kharkiv.

Many tries. Among 12 segments, one often "wins" by luck, especially when there is no difference overall (chapter 7). If this segment really matters, check it in a separate test, writing that down before the start.

Dashboard 6

A new landing page4 weeks
A3.1 sign-ups in 100 B4.7 sign-ups in 100
B +52%confidence 99%

The new page B is seen by those who came from the newsletter, and the old page A by everyone else. Proposal: make B the main page for everyone.

The groups aren't random. Newsletter readers already know the shop and sign up more readily on any page (chapter 2). The 99% confidence saves nothing here: it separates a difference from chance, not from different people being in the groups. Split visitors by coin and repeat.

Dashboard 7

A support chat on the product pageday 28 of 28
A1,240 purchases of 24,800 B1,262 purchases of 24,800
B +2%confidence 67%

The test was sized in advance, and the tool split the groups at random. The chat costs next to nothing, and customers thank the team in it. The team's conclusion: "the chat doesn't affect sales, switch it off".

No visible difference, so decide on other grounds. "No winner" doesn't prove the chat has no effect: the test just couldn't tell a small difference (chapter 9). The chat most likely does sales no big harm, costs little and customers like it. Those are good reasons to keep it.

And now the dashboard from the start of the course

Test: a "Buy now" buttonday 3 of 14
A48 purchases of 1,000 B61 purchases of 1,000
B +27%confidence 90%

The answer for the boss: "Not yet. Let's come back to it in 11 days."

  • Day three of fourteen: deciding on early numbers raises the chance of a fake winner (chapter 6).
  • Confidence of 90% doesn't reach even the usual 95% threshold (chapter 5).
  • With 1,000 people, a gap of 13 purchases may well be chance, and a version truly better by 1 purchase in 100 loses about 1 time in 7 with that many people (chapters 3 and 4).
  • And if B wins at the end, the "+27%" will almost certainly shrink after launch (chapter 8).
✓

Before you believe an A/B test

Nine questions, one from each chapter. You can ask them of any dashboard without calculating anything yourself.

How the test is built

  1. Is there a control group on the same days? "Before and after" is not a test.
  2. Who split the groups? It should be chance, not the people and not a manager.
  3. Could A against A have shown such a gap? On small numbers, easily.
  4. Was the number of people worked out in advance? A sample-size calculator, before the start.

How to read the result

  1. 95% is a risk of 1 in 20, not a guarantee and not the size of the gain.
  2. Did the test reach its planned end? Don't stop as soon as it goes green.
  3. How many variants and segments were there? Check a winner picked from many separately.
  4. Expect a smaller effect after launch and keep a small group without the change.
  5. "No winner" is not "no difference": decide on other grounds rather than extending the test.

Ready for harder cases: revenue instead of purchases, a Bayesian "chance to beat", a test plan and a report for the boss? Next comes the course "A/B testing paradoxes", and you can check your own numbers with the "Check your test" tool.

The end of the course

Know a colleague to whom test dashboards look like Greek? Send them the course: it is only counting and a coin.

What next