Pick a population, draw a sample of n values, and drop its average into the histogram below. Repeat a thousand times and the averages pile up around the population mean with spread \(\sigma/\sqrt{n}\), close to a normal curve even when the population is far from normal.
← All labsBased on Chapter 5, A/B Testing, of Polson and Sokolov, Bayes, Artificial Intelligence, and Deep Learning (vsokolov.org/html/_book).
The Mint tests a batch of n = 2,500 coins. Each should weigh 100 grams, with a tolerance of ±1 gram per coin. The Trial allowed the batch average the same ±1 gram, which means the whole box could be off by \(n \times 1 = 2{,}500\) grams. If each coin varies with SD \(\sigma = 1\) gram, the box total varies with SD \(\sigma\sqrt{n} = 50\) grams, so an honest box never comes close to that limit. A Master of the Mint can shave gold off every coin and still pass. These are illustrative numbers.
| Mint rule | √n rule | |
|---|---|---|
| Allowed error on the total | – | – |
| Allowed error on the average | – | – |
| P(honest box passes) | – | – |
| P(shaved box passes) | – | – |
| Largest δ that passes 95% of the time | – | – |
| Weighed boxes that passed | – | – |
Each draw has variance \(\sigma^2\). The mean of n independent draws has variance \(\sigma^2/n\), so its SD, the standard error, is \(\sigma/\sqrt{n}\). To halve the standard error you need four times the data.
Across many datasets of size n, \(\bar x\) is centered on \(\mu\) and is close to normal once n is moderate. Skewed populations need a larger n: the skewness of \(\bar x\) shrinks like \(1/\sqrt{n}\). In practice \(\sigma\) is unknown and \(s\) replaces it.
A classic exercise asks for 10,000 simulated A/B tests with 5,000 users per arm and 3% conversion. One arm's conversion rate is the mean of 5,000 \(\text{Bernoulli}(0.03)\) draws. Its histogram is the sampling distribution that the Z-test relies on.