Sub topic 7
How many users and how long: sample size and time box
This chapter assumes you have a hypothesis and a primary metric with a target and a floor, as in the previous chapters. It also assumes you can read a percentage as "successes out of users". Here you will fix two more numbers before launch: the minimum sample and the time box.
Why a minimum sample belongs in the criteria
A rate from a few users is noisy. If 12 of 40 sign-ups activate, the observed rate is 30%. The true rate could still be much lower or higher. A Wilson score interval gives a plausible range for the true rate.
import math
def wilson_interval(successes, n, z=1.96):
"""95% Wilson score interval for a proportion."""
if n == 0:
return (0.0, 1.0)
p = successes / n
denom = 1 + z**2 / n
centre = p + z**2 / (2 * n)
margin = z * math.sqrt((p * (1 - p) + z**2 / (4 * n)) / n)
return ((centre - margin) / denom, (centre + margin) / denom)
for successes, n in [(12, 40), (30, 100), (120, high = wilson_interval(successes, n)
print(f"{successes}/{n}: observed 30%, plausible range {low:.0%}")Running it prints:
12/40: observed 30%, plausible range 18% to 45%
30/100: observed 30% to 40%
120/400: observed 30%, plausible range 26% to 35%The observed rate is the same in all three cases. The range narrows as users are added. At 40 users, the range includes both your 10% floor's neighbourhood and rates well above your 30% target, so the data cannot separate "persevere" from "iterate".
Choosing the minimum sample
You do not need a formal power calculation for an early MVP. Use these steps:
- Pick the decision that matters most. Usually it is the gap between your floor and your target, for example 10% versus 30%.
- Choose a sample where the plausible range at the target is clearly above the floor. At 100 users, an observed 30% has a lower bound of 22%, which is well above 10%.
- Check that you can reach that sample. A minimum sample you cannot collect is a wish.
- Write the number in the criteria document as
minimum_sample.
Setting the time box
A time box is a fixed end date for the experiment. Without it, a weak result always looks like it needs "just a few more weeks". Three things determine its length:
- Sign-up rate. How many users arrive per week from your channels.
- Outcome window. Your metric counts reminders sent within 7 days of sign-up. A user who signs up on the last day has not had time to activate.
- Cost of waiting. Each week of runway spent on a weak idea is a week you cannot spend on another test.
The code below estimates the days needed. The last cohort must sign up at least one outcome window before the end.
def days_needed(min_users, signups_per_week, window_days):
"""Days from launch until the last needed user has finished the window."""
signup_days = -(-min_users * 7 // signups_per_week) # ceiling division
return signup_days + window_days
for rate in (10, 20):
needed = days_needed(min_users=100, signups_per_week=rate, window_days=7)
verdict = "fits" if needed <= 42 else "does not fit"
print(f"{rate} sign-ups/week: {needed} days, {verdict} a 42-day box")It prints 77 days, does not fit a 42-day box for 10 sign-ups per week. For 20 sign-ups per week it prints 42 days, fits a 42-day box. If your channels give only 10 per week, change the plan before launch. You could add acquisition effort, lower the sample, or accept a wider range and say so in the document.
Common errors
- Stopping early on a good number. Checking daily and stopping when the rate looks high inflates false wins. Decide on the decision date, once the sample is reached.
- Extending without limit. If the sample is not reached, extend once, write the new date down, and say why.
- Counting users who had no time to activate. Exclude sign-ups whose 7-day window is still open, or wait for them.
- Mixing cohorts. If you change the product mid-test, the earlier users answer a different question. Restart the count or analyse the cohorts separately.
Exercise
Your criteria say minimumsample is 100 and the time box is 42 days. You expect 15 sign-ups per week and a 7-day activation window. Using daysneeded, will you reach the sample inside the time box? What is one change you could make before launch?
Show answer
days_needed gives ceil(100 * 7 / 15) = 47 sign-up days, plus 7 window days, which is 54 days. That exceeds the 42-day box. Before launch you could raise sign-ups to about 20 per week, extend the time box to at least 54 days, or lower the minimum sample and accept a wider plausible range. Write the chosen option in the criteria document.