Interactive demo · Probabilistic Machine Learning · Chapter 2

Sums of random variables: convolution and the central limit theorem

If X1, …, XN are independent with density p, the sum SN has density p ⊗ p ⊗ … ⊗ p (N factors), computed here exactly on a grid by repeated discrete convolution. Standardising, ZN = (SN − Nμ)/(σ√N), the density approaches the standard normal curve. The left panel shows the standardised density against the Gaussian; the right panel shows the distribution-function gap FN(z) − Φ(z) and the Kolmogorov distance sup|FN − Φ|, which falls roughly like 1/√N. The histogram is the mean of simulated draws, as in the book's Figure 2.23.

Distribution of each X

Number of terms N

Histogram

Try these

Each density is sampled on 401 grid points over its support and normalised; N − 1 direct convolutions give the exact sum (up to the grid), whose standardised version is compared with the Gaussian. The Kolmogorov distance uses the grid distribution function (cumulative trapezoid). The histogram uses 4000 seeded draws of the mean, sampled from the grid distribution.

In the lecture notes