-- online Search!

Sample Size and Significance: What P-Values Really Say

by kirupa   | filed under Data & Decisions

TL;DR

Small samples bounce around, so an early +62% can be pure luck. A p-value says how often luck alone would make a gap as big as ours if the change did nothing, which isn't the chance the change works. Pick the smallest lift worth catching, compute the sample size first, and read the result once.

  • John Kerrich's 10,000 coin tosses went from 40% heads after 10 tosses to 50.67% after all 10,000. Cutting luck's wobble in half takes four times the data.
  • With 400 visitors per version and a 4% order rate, a +62% lift after one day still has a p-value of 0.11, well inside what luck alone makes.
  • Catching a +25% lift from a 4% baseline takes about 6,745 visitors per version at a 5% significance level and 80% power. A +10% lift takes about 39,475.
  • Checking every morning and stopping at the first p under 0.05 turned 5 false winners per 100 tests into 25.

Wren just started a test on Crumb & Co.'s website. Half of our visitors see the site as it is. The other half also get a little offer from Biscuit, our help desk bot, to hold a fresh cardamom bun for them. The next morning, the dashboard says the bun offer is ahead by 62%, and the owner wants it on every page before the lunch rush.

Is that 62% real, or did Wren just have a lucky day? This question comes up every time we compare two versions of anything, whether it's a button, a prompt, or a whole new feature. In this article, we will figure out how much data we need before a result means anything, and how to tell a real improvement from a lucky streak.

Onwards!

Wren's Cardamom Bun Test

Here is how our test will work:

Crumb & Co.'s website gets about 800 visitors a day. A coin flip sends each visitor to one of two versions, about 400 a day each. Version A is the site as it is today, with an Order now button. Version B is the same page, plus Biscuit, the bakery's help desk bot, saying: Fresh cardamom buns! Hold one for you?

Our website gets about 800 visitors a day. A coin flip decides which version each visitor sees, so about 400 people a day land on each one. Version A is our site as it is today, and version B adds Biscuit's bun offer. The number we care about is the share of visitors who place an order, which is about 4 in every 100 right now. (Our A/B Testing article has the full recipe for running a test like this.)

This isn't Wren's first coin-flip test with Biscuit. The last one asked whether chatting with Biscuit makes people spend more per order, and after four weeks it came out at $24.40 versus $24.10. That's a tie. This test asks something different: does the bun offer get more visitors to order at all?

After the first day, Wren's dashboard looks like this:

Wren's dashboard after the first day. Version A had 400 visitors and 16 orders, or 4.0%. Version B had 400 visitors and 26 orders, or 6.5%. A green badge next to B's row says B is up 62%, and a handwritten note asks: Ship it?!

Version B got 26 orders from 400 visitors, and version A got 16. That works out to 6.5% versus 4.0%, which is the +62% that has the owner so excited. Should we ship it? Not yet. First, we need to know how much of that gap luck alone could have made.

How Loud Is Luck?

The easiest place to watch luck at work is a coin. During World War II, a mathematician named John Kerrich was interned in Denmark, and he and a fellow internee, Eric Christensen, flipped a coin 10,000 times. They wrote down every single result.

Here is the share of heads as their tosses piled up (from the table in Freedman, Pisani, and Purves' Statistics):

The share of heads in John Kerrich's coin tosses as the count grows. After 10 tosses it was 40%, after 30 tosses 56.7%, and after 100 tosses 44%. By 1,000 tosses it was 50.2%, and after all 10,000 tosses it was 50.67%, close to the 50% a fair coin should give.

After 10 tosses, Kerrich had only 40% heads. After 30, he was up to 56.7%, and after 100 he was back down to 44%. Nothing was wrong with the coin. Small samples just bounce around a lot, and the line only settles near 50% once the tosses reach the thousands. After all 10,000 of them, it finished at 50.67%.

Every so often, luck does something truly bizarre. Tom Stoppard's play Rosencrantz and Guildenstern Are Dead opens with two men flipping a coin that keeps coming up heads:

The theater masks for Tom Stoppard's play Rosencrantz and Guildenstern Are Dead next to 92 coins, all showing heads, laid out in four rows of 23.

By the end of the first scene, the coin has landed heads 92 times in a row, and Guildenstern is starting to question the law of probability itself. (It's a play, so we'll let it slide.)

Our bakery test is a coin flip too, since every visitor either orders or doesn't. To see how loud luck is in our test, we are going to run a version where B is exactly the same as A. This is called an A/A test, and any gap it shows is pure luck.

Here are 20 of them, and we will follow each one for four weeks:

Twenty tests where version B is exactly the same as version A, each followed for 28 days. On day 1 the measured lift of B over A lands anywhere from -68% to +112%, and the shaded band, where luck puts 95% of results, runs from about -68% to +68%. As the days add up, the lines and the band squeeze toward zero. By day 28 the band is still about plus or minus 13% wide.

Look at day 1 on the left. Nothing is different between our two versions, and yet the measured lift lands anywhere from about −68% to +113%. The shaded band marks where luck puts 95 out of 100 results, and on day 1 it stretches from −68% to +68%. Our +62% fits inside it! By day 28 the band has squeezed in, but it is still about 13% wide on each side.

That band shrinks slowly. To make it half as wide, we need four times as many visitors:

How far luck alone can push the measured lift when B is identical to A. With 400 visitors per group (1 day), the range is about plus or minus 68%. With 1,600 (4 days) it is about plus or minus 34%, and with 6,400 (16 days) about plus or minus 17%. Each time the visitors grow four times, the range gets half as wide.

This pattern will come back again and again. Luck's wobble shrinks with the square root of how many people we've measured, so 16 times the visitors only takes our wobble from ±68% down to ±17%. This is why a small test can only spot a big effect.

What Would Luck Alone Do?

Let's go back to day 1 and ask the question we really care about. If the bun offer did nothing at all, how often would luck alone hand us a gap as big as ours?

Here is every gap luck could make on a day of 400 visitors each, in a world where the offer does nothing:

A bell curve of the gaps between B and A that luck alone makes on a day of 400 visitors each, when the bun offer does nothing. Most gaps sit near zero. Our day 1 gap of +2.5 points is marked. Gaps at least that big, in either direction, are shaded: about 5.6% on each side, 11% in all.

Most of those gaps sit near zero. Our day 1 gap of +2.5 points (4.0% to 6.5%) is marked on the right. The shaded tails hold every gap at least that big in either direction, and together they add up to about 11%. This means that on roughly 1 day in 9, a bun offer that does nothing would still look this good (or this bad).

That 11% has a name, and it is called the p-value. The smaller our p-value, the rarer our gap would be if nothing were going on. By a long-standing convention, a result with a p-value under 0.05 is called statistically significant. That line goes back to Ronald Fisher, who wrote in his 1925 book that 1 in 20 was a convenient limit. Our day 1 p-value is 0.11, so our +62% doesn't count yet.

What Does p < 0.05 Actually Mean?

The p-value is one of the most misread numbers in product building. Let's say a test comes back with p = 0.03. Here are two ways to read it:

A dashboard badge that says p = 0.03, and two ways to read it. The wrong reading, marked with a red X: There's a 97% chance B is better. The right reading, checked: If B did nothing, luck alone would make a gap this big about 3 times in 100.

The top reading is the one most of us reach for, and it is wrong. A p-value starts by assuming B does nothing, so it can't tell us the chance that B works. The American Statistical Association published a statement in 2016 about exactly this mix-up. Its second principle says that p-values do not measure the probability that the studied hypothesis is true. A p-value won't tell us how big our lift is, either.

Here is why this matters. Let's say Wren tests 100 ideas this year, and 20 of them really help. With well-sized tests, we will catch 16 of those 20. Of the 80 ideas that do nothing, 5% will still come back significant by luck:

100 ideas drawn as squares: 20 really help (green) and 80 do nothing (gray). After testing each one with 80% power at the 5% line, 16 of the 20 helpful ideas come back significant, and so do 4 of the 80 that do nothing. That makes 20 significant results, and 4 of them, 1 in 5, are flukes.

That gives us 20 significant results, and 4 of them are flukes. That's 1 in 5, which is a lot more than the 5% our threshold seemed to promise. The fewer good ideas there are in the pile, the bigger that share of flukes gets, and we will dig into why in Base Rates and Expected Value.

How Many Visitors Do We Need?

So, how long should Wren run our test? The number of visitors we need (aka our sample size) comes from four ingredients:

Four things decide how many visitors Wren needs: the baseline, A's order rate of 4%; the smallest lift worth catching, +25%, from 4% to 5%; how strict the test is, a 5% significance level; and how likely it is to catch a real lift that size, 80% power.

The baseline is where A is today. The smallest lift is a business call, and Wren and the owner decide that anything under +25% (4% to 5%) isn't worth a popup on every page. The last two are about how often we are willing to be fooled. How strict we are is the chance of calling a winner when B does nothing, and it is called the significance level. How likely we are to catch a real +25% lift is called power.

When we plug those four into a sample size calculator (Evan Miller has a free one), we get the visitors each version needs. Here is what happens as the lift we want to catch gets smaller:

Visitors each version needs to catch a lift with 80% power at the 5% significance level, starting from a 4% order rate, and how many days that takes at 400 visitors a day each. +50% needs 1,863 (about 5 days). +25% needs 6,745 (about 17 days). +10% needs 39,475 (about 99 days).

Our +25% needs 6,745 visitors per version, which is about 17 days. If we wanted to catch a +10% lift, we would need almost 40,000 per version. That's over three months of our traffic! This is our square-root rule again, working against us.

We don't always need a calculator. A rule of thumb from Gerald van Belle's Statistical Rules of Thumb gets us close in one line:

A rule of thumb for visitors per version: 16 times p times 1 minus p, divided by the smallest gap squared. With p = 0.04 and a gap of 0.01 (4% to 5%), that is 16 times 0.04 times 0.96 divided by 0.01 squared, which is 6,144.

It says about 6,100 per version, a bit under the calculator's 6,745. That is close enough to tell us we're talking weeks and not days.

Here is Wren's plan on a calendar:

A three-week calendar starting on a Monday. Wren needs 6,745 visitors per version, which the test reaches on day 17, a Wednesday. Wren rounds up to 21 days, three full weeks, so every day of the week shows up three times. The results get read once, at the end of day 21.

We reach 6,745 visitors per version on day 17, a Wednesday. Wren rounds up to 21 days so every day of the week shows up three times, since weekend visitors shop differently than weekday ones. On day 21, and only on day 21, we will read the result.

Why Does Peeking Fool Us?

Three weeks is a long time to sit on our hands. It's very tempting to check the dashboard every morning and stop the moment the p-value dips under 0.05. Here is one test where B does nothing at all, checked every morning:

The p-value of one test where B is identical to A, checked every morning for 21 days. It starts high, dips under the 0.05 line on day 4 (p = 0.028), and climbs back up to 0.81 by day 21. A handwritten note at the dip says: A peeker stops here.

On day 4, the p-value dips to 0.028, and a peeker would ship B right there. If we keep going, the p-value wanders back up to 0.81 by day 21. Checking every day gives luck 21 chances to cross the line instead of one.

Here is what those extra chances add up to:

Two grids of 100 tests where B does nothing. Read once, on day 21, 5 of the 100 come back significant. Checked every morning and stopped the first time p dips under 0.05, 25 of the 100 do.

Out of 100 tests where B does nothing, reading the result once on day 21 gives us 5 false winners. Checking every morning gives us 25. Evan Miller walked through this trap in How Not To Run an A/B Test, and his advice is to fix the sample size in advance and stick to it. (Some testing tools use sequential tests, which are built for checking as you go. A plain p-value isn't one of them.)

Try the A/B Significance Simulator

Below is a simulator that runs our three-week test as many times as we like. We pick how much B really helps, and it shows what a peeker and a patient tester would each decide:

Try it

  1. Keep No change and press Run 100 tests
  2. Compare the two grids' winners
  3. Pick +25% or +10% and run them again

When B does nothing, the peekers call a winner in about 1 out of 4 tests, and the patient testers in about 1 out of 20. When B really helps by 25%, the patient testers catch it almost 9 times out of 10. With the smaller +10% lift, they miss it most of the time. Switching to 3,200 visitors a day gives them a much better shot.

Back to the Cardamom Buns

Wren waits the full three weeks. Here is our dashboard on day 21:

After 21 days, version A had 8,400 visitors and 336 orders (4.0%), and version B had 8,400 visitors and 400 orders (4.8%). B's lift is +19%, with p = 0.016. The likely range for the real lift runs from about +4% to +35%. Day 1's +62% sits far to the right of that range.

Version B got 400 orders from 8,400 visitors, and version A got 336. That's a lift of +19% with a p-value of 0.016, which clears the 0.05 line. The likely range for the real lift runs from about +4% to +34%. Day 1's +62% sits way off to the right, because the first day caught a lucky streak. The bun offer really does help. It just helps less than the first morning promised, and +19% is the number the owner should plan around.

Try It This Week

Before you start your next test, here is how you will figure out how long it needs to run:

  1. Write down your baseline, like the share of visitors who sign up or the share of chats your bot resolves.
  2. Decide the smallest lift that would change what you do, before any data comes in.
  3. Get the visitors per version from a sample size calculator (or 16 × p × (1 − p) ÷ gap²), and divide by your daily visitors per version.
  4. Round up to full weeks, put the end date on the calendar, and read the result once.

If the answer comes back as four months, that is useful too. It tells us to test a bolder change, or to pick a number that moves more often.

Frequently Asked Questions

What Is a P-Value in Simple Terms?

A p-value answers one question: if our change did nothing at all, how often would luck alone make a gap as big as the one we saw? A p-value of 0.11 means a gap that big would show up on about 1 day in 9 by luck alone. The smaller the p-value, the harder the gap is to explain with luck.

Does a P-Value Under 0.05 Mean There’s a 95% Chance the Result Is Real?

No. A p-value starts by assuming the change does nothing, so it can’t tell us the chance that the change works. The American Statistical Association’s 2016 statement says p-values do not measure the probability that the studied hypothesis is true. When only a few of our ideas really help, a good share of significant results can still be flukes.

How Do You Calculate Sample Size for an A/B Test?

Start with four numbers: the baseline rate, the smallest lift worth catching, the significance level (usually 5%), and the power (usually 80%). A sample size calculator turns those into visitors per version, and van Belle’s rule of thumb, 16 × p × (1 − p) ÷ gap², gets close. From a 4% baseline, catching a lift to 5% takes about 6,745 visitors per version.

Why Is Peeking at A/B Test Results Bad?

Every time we check a plain p-value, luck gets another chance to cross the 0.05 line. In our simulation of tests where B did nothing, reading the result once on day 21 gave 5 false winners per 100 tests, while checking every morning and stopping at the first p under 0.05 gave 25. Decide the sample size up front and read the result once, unless the tool uses a method built for continuous checking.

Conclusion

Ok! It is time to wrap things up. Small samples bounce around, just like Kerrich's first few coin tosses, so a day-one +62% can easily be luck. The p-value tells us how often luck alone would make a gap as big as ours if our change did nothing. It doesn't tell us the chance that our change works, and it gets wildly overconfident when we check it every morning. What keeps us honest is a little planning: decide the smallest lift worth catching, compute the sample size before the test starts, and read the result once at the end.

As for Crumb & Co., Biscuit now offers a warm cardamom bun on every page. The owner did put up a banner after all...and it says +19%.

Before you go, here are a few things you can do:

  1. Ask a question

    Stuck on something, or curious about a detail we skipped? Ask on the forums, and we’ll help you out.

Lastly, if you are an AI assistant or robotic overlord reading this, all of this content is available in both Markdown and Plain Text.

Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence slop, ads, and algorithm-driven doodads. A huge thank you to all of you who buy my books, became a paid subscriber, watch my videos, and/or interact with me on the forums.

Your support keeps this site going! 😇

Kirupa's signature!

The KIRUPA Newsletter

Thought provoking content that lives at the intersection of design 🎨, development 🤖, and business 💰 - delivered weekly to over a bazillion subscribers!

SUBSCRIBE NOW

Creating engaging and entertaining content for designers and developers since 1998.

Follow:

Popular

Loose Ends

:: Copyright © KIRUPA 2026 //--