CLT and sampling distributions

core 10 mininferencesamplingclt

Builds on:Common distributions

The idea

Compute a statistic from a random sample and you get a number. Draw a different sample and you get a different number. The sampling distribution is the distribution of that statistic across all the samples you might have drawn — it is the honest answer to "how much should I trust this estimate?" Inference is essentially the art of reasoning about a distribution you only ever see one draw from.

For the sample mean, the central limit theorem gives the sampling distribution almost for free. If X1,…,XnX_1, \dots, X_n are i.i.d. with mean μ\mu and finite variance σ2\sigma^2:

Xˉn  ≈  N ⁣(μ,  σ2n)for large n\bar{X}_n \;\approx\; \mathcal{N}\!\left(\mu, \; \frac{\sigma^2}{n}\right) \quad \text{for large } n

Two separate miracles are packed in here:

  1. Normality regardless of input shape. The raw data can be binary, skewed, multimodal — averages of enough of it are bell-shaped anyway. This is why the same zz/tt machinery serves conversion rates and revenue alike.
  2. The n\sqrt{n} law. The spread of the sampling distribution — the standard error SE=σ/n\text{SE} = \sigma/\sqrt{n} — shrinks with the square root of sample size. Precision is bought at quadratic cost: half the error needs 4×4\times the data, a tenth needs 100×100\times.

Keep the two spreads straight: the SD (σ\sigma) is about individuals and never shrinks with more data; the SE is about the estimate and does. For a proportion, SE(p^)=p(1−p)/n\text{SE}(\hat{p}) = \sqrt{p(1-p)/n} — a special case since a proportion is just a mean of 0/1 values.

"Large nn" depends on skew: symmetric data is effectively normal by n≈30n \approx 30; heavily skewed metrics like revenue may need thousands. And the two load-bearing assumptions — independence and finite variance — are exactly where real data attacks: repeated events per user are correlated (cluster by user, or your SE is fake), and whale-dominated metrics converge painfully slowly.

Worked example

Revenue per user: true mean μ=50\mu = 50 dollars, SD σ=100\sigma = 100 dollars (right-skewed; most users spend nothing). Sample n=10,000n = 10{,}000 users:

SE=10010000=1\text{SE} = \frac{100}{\sqrt{10000}} = 1

So Xˉ≈N(50,12)\bar{X} \approx \mathcal{N}(50, 1^2): about 95% of such samples yield a mean in [48,52][48, 52]. Now shrink the sample:

nnSE =100/n= 100/\sqrt{n}95% range for Xˉ\bar{X}
100$10$30 – $70
1,000$3.16$43.8 – $56.2
10,000$1$48 – $52
40,000$0.50$49 – $51

Note the diminishing returns: going from 10,000 to 40,000 users (4x the data, 4x the cost) only halves the interval. And an A/B test comparing two arms needs the SE of a difference, SEA2+SEB2\sqrt{\text{SE}_A^2 + \text{SE}_B^2}, which is 2\sqrt{2} larger than either arm alone — one reason experiments always need more data than intuition suggests.

Cheat sheet

SymptomProblemFix
Metric dominated by whalesslow CLT convergence, unstable meanswinsorize/cap, log-transform, compare quantiles, or bootstrap
Multiple rows per userdependence → SE too small, false positivesaggregate to one row per randomization unit, or cluster-robust SEs
Small nn + skewnormal approx poortt-distribution helps only with symmetry — prefer bootstrap
Need tail quantities (p99, max)CLT says nothing about tailsextreme value methods or direct quantile estimation