Samples wobble: how much, and why size matters
Draw thousands of samples from a known 4% rate with a fixed seed and watch how far sample rates stray at three sample sizes.
2 parts · 7 and 2 min
Free course. Your Maestro, an AI, .
In the checkout test from the previous page, the current version converted 80 of 2,000 sessions (4.0%) and the redesigned version converted 92 of 2,000 sessions (4.6%). Before comparing those two arms against each other, look at a single Glossary word on its own: if the true conversion rate never changed at all, would 2,000 sessions always give you 80 orders?
In everyday work, you see only the one sample you collected, while the underlying conversion rate stays hidden. A simulation flips that around. You set a known truth where every session has an exact 4% (0.04) chance of converting, and have Python draw 10,000 separate samples of n sessions each. Because nothing changes from one draw to the next, every shift away from 4% comes from random sampling variation alone.
How the code runs the experiment
np.random.default_rng(7)starts a random number generator with seed 7. A seed does not make the simulation more accurate or pull results closer to 4%; it fixes the starting point of the generator so every run produces the exact same simulated numbers.rng.binomial(n, true_rate, size=10_000) / ndraws 10,000 samples ofnsessions at the 0.04 rate and divides the order counts bynto get 10,000 sample conversion rates.np.percentile(rates, [2.5, 97.5])finds the boundaries of the middle 95% of those sample rates, andrates.std()computes their Glossary word.
Try it
Run the starter code for 2,000 sessions first. Then loop over [2000, 500, 8000] in that order so the seeded generator prints all three sample sizes. If your loop gives different numbers or you get stuck, ask your Maestro.
Running the three sizes in the order 2,000, 500, and 8,000 with np.random.default_rng(7) produces these spreads around the 0.04 (4.0%) true rate:
Sample size (n) | Middle 95% of sample rates | Standard deviation (sd) |
|---|---|---|
| 2,000 sessions | 0.032 to 0.049 (3.2% to 4.9%) | 0.0044 |
| 500 sessions | 0.024 to 0.058 | 0.0087 |
| 8,000 sessions | 0.0357 to 0.0444 | 0.0022 |
What the three sizes show
First, a sample of 2,000 sessions does not lock in the true rate to the decimal. Even when every session converts with an unchanging 4.0% probability, the middle 95% of 2,000-session samples runs from 0.032 to 0.049 (3.2% to 4.9%). Landing away from 4.0% inside that window is routine wobble when nothing has changed.
Second, notice how sample size changes that wobble. Moving from 500 to 2,000 sessions multiplies the sample by four, and the standard deviation drops to about half, from 0.0087 to 0.0044 (while the middle 95% narrows from 0.024–0.058 to 0.032–0.049). Multiplying the sample by four again, from 2,000 to 8,000 sessions, cuts the standard deviation in half once more, from 0.0044 to 0.0022 (and narrows the middle 95% to 0.0357–0.0444). Ask your Maestro if you want to explore why random ups and downs shrink with the square root of the sample size.
Common mistake: Two common traps
Doubling a sample does not halve the spread: because random highs and lows only partly cancel out as you add sessions, cutting the spread in half takes four times as many sessions. Fixing a random seed does not reduce the spread either; it only makes the same random draw repeatable.
A good place to stop. Up next: Back to the checkout test · 2 min
Back to the checkout test
In our checkout test, the current version landed at 4.0% and the new version landed at 4.6%, each from 2,000 sessions. Each arm's result is one draw from a sample that wobbles on its own, and 4.6% sits well inside the 3.2% to 4.9% range that a 4.0% true rate produces across 2,000 sessions.
That raises the question you actually have to answer when comparing two groups: if both checkouts had the exact same true rate and both wobbled at the same time, would a 0.6-point gap between the two arms still be ordinary? That is what the next page tests.