ML Systems Lab Open interactive version →
Foundational 24 min read CLTconfidence intervalsbootstrapstandard error

Sampling Distributions & CLT

CLT, standard error, confidence intervals, bootstrap

You run an A/B test. Treatment group (n=500) has CTR 4.3%. Control (n=500) has CTR 3.8%. The difference is 0.5 percentage points. Is this a real effect or just sampling noise? To answer, you need to know: if the true CTRs were equal, how variable would a 0.5% difference be purely from random sampling? The sampling distribution — the distribution of a statistic's value across many hypothetical repeats of the same sampling process — of (CTR_treatment - CTR_control) under the null hypothesis answers this exactly.

The sample mean X̄ of n i.i.d. draws from a population with mean μ and variance σ² has: E[X̄] = μ and Var[X̄] = σ²/n. Standard error = σ/√n. By the Central Limit Theorem, for large n, X̄ ≈ N(μ, σ²/n) regardless of the shape of the original distribution. This is why t-tests and z-tests work asymptotically for any distribution — they operate on means, and means become approximately normal.

The t-distribution: when σ is unknown and estimated from data as the sample standard deviation s, the statistic (X̄ - μ)/(s/√n) follows a t-distribution with n-1 degrees of freedom. The t-distribution has heavier tails than N(0,1) for small n, reflecting the extra uncertainty introduced by estimating σ. At n=30 or more, t(n-1) is nearly indistinguishable from N(0,1) — a separate convergence fact from (but numerically close to) the informal n≥30 rule of thumb often cited for the CLT itself; the two thresholds are not the same claim and neither derives the other.

Bootstrap sampling distribution: the empirical alternative to analytical formulas. Draw n samples with replacement from your data, compute the statistic, repeat 10,000 times. The distribution of the statistic across bootstrap samples is the sampling distribution. Works for any statistic — AUC, precision@K, NDCG — with no formula required.

NOT this. The CLT applies to any distribution for large n is not unconditionally true. The CLT requires finite mean and finite variance. For heavy-tailed distributions — Pareto with tail index less than 2, some financial return distributions — the variance does not exist and the CLT does not apply. The sample mean does not converge to a Gaussian; it converges to a stable distribution with heavier tails. For web latency, transaction sizes, and other power-law distributed data, checking whether the CLT applies before running a t-test is not paranoia — it is necessary.

Back to the A/B test: pooled CTR under the null is (0.043·500 + 0.038·500)/1000 = 0.0405, so SE of the difference = √(0.0405·0.9595·(1/500+1/500)) ≈ 0.0125, or 1.25 percentage points. The observed 0.5-point gap is about 0.4 standard errors from zero (z ≈ 0.40, two-sided p ≈ 0.69) — nowhere near the ~2 SE needed for significance, so this particular 0.5pp gap is comfortably explained by sampling noise alone, not a real effect.

Key points

Takeaway

The sampling distribution tells you how much a statistic varies across repeated samples. The CLT makes sample means approximately normal for large n — but large depends on tail behavior. Always verify the CLT assumption holds before running t-tests or z-tests on data with heavy tails.

Recap

Check your understanding

Q1. X₁,...,Xₙ ~ N(μ,σ²). Which two of the following statements about the sampling distribution of S² are correct?

Q2. If X̄ ~ N(μ, σ²/n), what does the Central Limit Theorem say about non-Gaussian X, and when does it break down?

Q3. The t-distribution has heavier tails than the normal. Why does this matter when computing confidence intervals with small samples?

Try it interactively

ML Systems Lab is a free interview-prep platform for ML engineers — work through the full interactive module, quizzes, and drills.

Open ML Systems Lab →