Sub topic 6
Reading the numbers: sample size and uncertainty
This chapter assumes you have run a landing-page test and have a count of visitors and signups. You should also have a success threshold written down before the test started. Here you will learn what those counts do and do not tell you.
Why one conversion rate is not enough
Say 400 visitors saw your page and 18 signed up. The conversion rate is 18 / 400 = 4.5%. That number describes the visitors you had. It does not tell you the rate you would see with the next 400 visitors, because chance moves the count up or down each time.
Your real question is about the underlying rate. If you kept sending the same kind of traffic, what share would sign up? A small sample gives only a rough estimate of that rate. A confidence interval shows how rough.
A 95% confidence interval is a range computed so that, if you repeated the test many times, about 95% of the ranges would contain the true rate. In practice, read it as the set of rates your data cannot rule out.
Computing the interval
The simple textbook formula behaves badly when the sample is small or the rate is near 0%. The Wilson interval handles those cases better, so use it for landing-page tests.
import math
def wilson_interval(successes, n, z=1.96):
if n == 0:
return (0.0, 0.0)
p = successes / n
denom = 1 + z**2 / n
centre = (p + z**2 / (2 * n)) / denom
margin = z * math.sqrt(p * (1 - p) / n + z**2 / (4 * n**2)) / denom
return (centre - margin, centre + margin)
low, high = wilson_interval(18, 400)
print(f"conversion 4.5%, 95% interval {low:.1%} to {high:.1%}")The output is conversion 4.5%, 95% interval 2.9% to 7.0%. The true rate could plausibly be anywhere from about 3% to 7%.
Comparing the interval with your threshold
Suppose your hypothesis said: "At least 5% of visitors from the newsletter will join the waitlist." The observed 4.5% is below 5%, but the interval runs from 2.9% to 7.0%. That range contains 5%, so the test has not shown the threshold was missed or met.
Use three outcomes, not two:
| Interval compared with threshold | Reading | Next step |
|---|---|---|
| Entire interval above the threshold | Passed | Move to the next experiment |
| Entire interval below the threshold | Failed | Change the idea, segment, or promise |
| Threshold inside the interval | Inconclusive | Collect more visitors, or accept the risk and decide |
How many visitors you need
The interval narrows as the sample grows, but slowly. A quick estimate of the half-width is 1.96 × √(p(1 − p) / n). For a rate near 5%:
- About 456 visitors give a margin of roughly ±2 percentage points.
- About 1,825 visitors give roughly ±1 point. Four times the traffic only halves the margin.
Decide the margin you need before you buy traffic. If your threshold is 5% and you need to tell 4% from 6%, a few hundred visitors are enough. If the decision depends on telling 4.5% from 5.5%, you need thousands, and a landing-page test may not be the cheapest way to get there.
Common errors
- Reading a small sample as a result. Three signups from 20 visitors is 15%, but the interval spans roughly 5% to 36%. That range is too wide to support any decision.
- Zero signups is not zero demand. With 0 of 50 visitors, the upper end of the interval is still about 7%. Run
wilson_interval(0, 50)to check. - Mixing sources. The hidden
sourcefield in your signup form exists so you can compute one interval per traffic source. Pooling a friendly newsletter with cold ads gives a rate that describes neither. - Moving the threshold afterward. If 4.5% feels fine once you see it, you have changed the question to fit the answer.
The interval covers only random variation. It says nothing about bias, such as visitors who were never your target customers. That problem is covered in the pitfalls chapter.
Exercise
Your threshold is 5%. A test with 120 visitors gives 9 signups (7.5%). Without running code, which of the three outcomes in the table is most likely, and why? Then name two ways to move toward a clear answer.
Show answer
Inconclusive. With only 120 visitors, the 95% interval is wide (roughly 4% to 13%), and the lower end falls below 5%, so the threshold sits inside the interval. To get a clearer answer, collect more visitors, since about 450 or more would cut the margin to about ±2 points. You could also run the same test on a better-matched traffic source. You must not lower the threshold after seeing the result.
Exercise
A page gets 0 signups from 30 visitors. A teammate says demand is zero. Explain why that conclusion is not supported.
Show answer
With only 30 visitors, a true rate of several percent would often produce zero signups by chance. The upper end of the 95% interval is roughly 11%. The data rule out high demand but cannot rule out a rate near or above a typical threshold, so more traffic or a better traffic source is needed.