14 / 22 · Limit Theorems
The central limit theorem
Why the normal distribution is everywhere: standardized sums of independent variables become normal whatever the distribution of the terms, why only the mean and the variance survive, error bars and the normal approximation to the binomial, how fast the approximation becomes good (Berry–Esseen), the four modes of convergence, and where the theorem fails.
On this page 12
The law of large numbers says that an average settles at the expectation, and the variance says that its typical distance from it is . The central limit theorem says much more: the shape of the fluctuations is almost always the same, the normal bell, whatever the distribution of the individual terms. A sum of exponential waiting times, a count of clicks, an average loss over a validation set and a measurement error made of many small disturbances are all close to normal. This is why the normal distribution is everywhere, and why error bars are computed from it.
Notation. are i.i.d. with mean and finite variance ; and . is the standardized average; is the standard normal CDF.
The theorem#
For every ,
The standardized average converges in distribution to . Undoing the standardization, for large
The only assumptions are independence, identical distribution and a finite variance. The terms can be discrete or continuous, symmetric or skewed. A single exponential variable is strongly skewed; standardized sums of a few of them already look much more symmetric:
A sum of exponential variables becomes normal
Why the normal#
Optional depth: a proof of the theorem with characteristic functions. The rest of the note does not depend on it.
The characteristic function explains the result in four lines. Let , with mean 0 and variance 1, so that . For independent terms the characteristic function of the sum is the product of theirs:
Near 0, a characteristic function with mean 0 and variance 1 expands as . Substituting ,
which is the characteristic function of . Lévy’s continuity theorem turns convergence of characteristic functions into convergence of distributions. The computation also shows why the limit is universal: after standardization, only the first two terms of the expansion survive, and they are the same for every distribution with a finite variance. The remainder needs nothing beyond the finite variance, and the argument gives no rate: with only a finite variance the convergence can be arbitrarily slow. Higher moments need not even exist. When the third absolute moment is finite, the Berry–Esseen theorem below bounds the error by order ; when more moments are finite and the terms do not live on a lattice, finer (Edgeworth) expansions show the skewness entering at order and the kurtosis at order .
Error bars#
The theorem turns the rule into probabilities. Since is approximately , the interval
contains with probability close to . A classifier that scores 0.9 on 1,000 independent test examples has an error bar of . For an A/B test of click rates 2.0% and 2.3% with 20,000 users in each group, the difference has standard error
so the observed difference of is standard errors from zero; if the two true rates were equal, a difference at least that large in either direction would arise with probability . The confidence intervals note and the hypothesis tests note make these two statements precise and list what they do not mean.
The binomial. A binomial count is a sum of independent indicators, so , the de Moivre–Laplace theorem and the first version of the central limit theorem, going back to the 18th century. For 60 or more heads in 100 fair flips, the exact probability is ; the normal approximation is off because a discrete count is approximated by a continuous variable. Counting the bar at 60 from its left edge, , almost removes the error; this continuity correction is standard for counts.
How fast#
The theorem is a limit, and is always finite. The Berry–Esseen theorem bounds the error in the CDF for every :
The bound falls like , and its size is set by the standardized third absolute moment, which grows with both asymmetry and heavy tails. For the sums of exponentials in the figure, the largest gap is for and for . Tails converge slowest: for the sum of 30 exponentials, against for the normal.
Skewed and rare-event counts need large . For , with mean 1, the probability of zero events is , and the normal approximation with continuity correction gives ; the Poisson approximation is the right one there. A common rule of thumb asks for and of at least about 10 before using the normal approximation for a proportion.
Modes of convergence#
The law of large numbers and the central limit theorem use different kinds of convergence, and the differences matter when reading statements about estimators and algorithms.
- Almost surely: ; the realized sequence converges with probability 1. The strong law of large numbers.
- In mean square: . The variance proof of the law of large numbers, and the usual statement for estimators.
- In probability: for every . The weak law of large numbers, and consistency of estimators.
- In distribution: at every point where the limit CDF is continuous. The central limit theorem.
Modes of convergence of random variables
Convergence in distribution is the weakest: it says nothing about the random variables themselves, only about their distributions. The standardized averages do not approach any particular random variable; and are only partly correlated however large is. The law of large numbers note showed an example of convergence in probability without almost sure convergence; a sequence that converges in distribution to but not in probability to is for a standard normal , which has the distribution of for every and never comes close to itself. It does converge in probability, to . A sequence with no limit in probability at all is : every is standard normal, so it converges in distribution, but never shrinks.
When the theorem fails#
- Infinite variance. The average of standard Cauchy variables is again standard Cauchy; nothing becomes normal. For tails like with sums do converge after centring and rescaling, but by instead of and to a heavy-tailed stable distribution rather than the normal.
- A few terms dominate. For independent but not identically distributed terms, the Lindeberg condition requires that no single term carries a non-negligible share of the total variance. A sum of one huge measurement error and many small ones has the shape of the huge one.
- Strong dependence. Weakly dependent sequences, such as most Markov chains, still satisfy a central limit theorem with a different, usually inflated, variance; strongly dependent ones, for example sums of a slowly varying trend, need not.
What changed#
| Law of large numbers | Central limit theorem | |
|---|---|---|
| Statement | in distribution | |
| What it gives | where the average goes | the shape and size of its fluctuations |
| Use | consistency, Monte Carlo | error bars, tests, the normal approximation to counts |
| Rate | Berry–Esseen: CDF error |
Limitations#
- “Large ” depends on the distribution. Skewed terms, rare events and tail probabilities need much larger samples than the bell shape near the centre suggests.
- Independence is the strongest assumption. Clustered data (several examples per user, per document, per hospital) make the real standard error larger than ; error bars must then be computed per cluster.
- The theorem is about sums. Statistics that are not sums need their own analysis; a maximum, for instance, converges to an extreme-value distribution, not to a normal.
What you should remember#
- For i.i.d. terms with finite variance, in distribution: .
- Only the mean and the variance of the terms matter in the limit; finite variance alone gives no rate, and with a finite third absolute moment the CDF error is of order (Berry–Esseen).
- Error bar of an average: for about 95%; for counts, use the continuity correction.
- Berry–Esseen: the CDF error is at most ; tails and skewed terms converge slowly.
- Almost surely or in mean square ⇒ in probability ⇒ in distribution; the CLT is a statement in distribution.
- No finite variance (Cauchy, heavy tails), dominating terms or strong dependence break the theorem.
Code#
The figure’s gaps from exact gamma distributions, the error bars, the normal approximation to the binomial, and a simulation:
import numpy as np, math
from scipy import stats
# standardized sums of n exponentials: the largest CDF gap to the normal, and P(Z > 2)
for n in (1, 2, 5, 30):
S = stats.gamma(n) # the sum of n independent Exp(1)
z = np.linspace(-6, 8, 140_001)
gap = np.abs(S.cdf(n + math.sqrt(n) * z) - stats.norm.cdf(z)).max()
print(n, round(float(gap), 3), round(float(S.sf(n + 2 * math.sqrt(n))), 4))
print(round(float(stats.norm.sf(2)), 4))
# 1 0.159 0.0498 | 2 0.094 0.0466 | 5 0.06 0.041 | 30 0.024 0.0316 | normal 0.0228
# error bar for accuracy 0.9 on 1,000 examples; A/B test of click rates 2.0% and 2.3%, 20,000 users each
print(round(1.96 * math.sqrt(0.9 * 0.1 / 1000), 4)) # 0.0186
se = math.sqrt(0.02 * 0.98 / 20_000 + 0.023 * 0.977 / 20_000)
print(round(se, 5), round(0.003 / se, 2), round(float(2 * stats.norm.sf(0.003 / se)), 3)) # 0.00145 2.07 0.039
# 60 or more heads in 100 flips: exact, normal, normal with continuity correction
print(round(float(stats.binom(100, 0.5).sf(59)), 4), round(float(stats.norm.sf(2)), 4), round(float(stats.norm.sf(1.9)), 4)) # 0.0284 0.0228 0.0287
# a rare event is far from normal: Bin(1000, 0.001), P(X = 0) exact and by the normal approximation
print(round(float(stats.binom(1000, 0.001).pmf(0)), 3), round(float(stats.norm.cdf(-0.5 / math.sqrt(0.999))), 3)) # 0.368 0.308
# simulation: standardized sums of 30 exponentials
rng = np.random.default_rng(0)
s = (rng.exponential(size=(200_000, 30)).sum(axis=1) - 30) / math.sqrt(30)
print(round(float((np.abs(s) < 1.96).mean()), 4), round(float((s > 2).mean()), 4)) # 0.9522 0.0311
Next#
The limit theorems are about averages of samples from a known distribution. Statistics turns the question around: from the samples, what can be said about the distribution? The next note opens the section on statistics with estimators, the functions of data that guess a parameter, and the bias, variance and mean squared error that measure how well they do it.
References#
- J. K. Blitzstein, J. Hwang. Introduction to Probability, 2nd ed. CRC Press, 2019. Chapter 10 (the central limit theorem).
- W. Feller. An Introduction to Probability Theory and Its Applications, Vol. 2, 2nd ed. Wiley, 1971. Chapter XV (characteristic functions and the central limit theorem), Chapter XVI (Berry–Esseen).
- A. N. Shiryaev. Probability-1, 3rd ed. Springer, 2016. Chapter 3 (the central limit theorem, Lindeberg’s condition, the rate of convergence).
- I. Shevtsova. On the absolute constants in the Berry–Esseen type inequalities for identically distributed summands. arXiv:1111.6554, 2011. The constant 0.4748.