Stage I · Bachelor's: Foundations
Part 6 of 65The Laws of Averages
Why does averaging work, how fast, and when does it fail?
At a Plymouth livestock fair, 787 legible guesses at the dressed weight of an ox have a median of 1,207 lb against a true 1,198. The part proves why a crowd can do that: Markov, Chebyshev and Jensen, then the weak law in three lines, with Bernoulli's 1713 urn and his 25,550 trials set against modern bounds. The central limit theorem is seen by exact convolution and on a Galton board, then proved by expanding the log-MGF. The part turns when the folklore 'n at least 30' is tested: for the World's Pareto-tailed incomes the usual 95% interval still falls short at a thousand observations, and Berry-Esseen says how slowly the bell may arrive. The delta method and Slutsky's theorem make the normal approximation usable for every later part; Cauchy running means, which never settle, show where it stops. It ends with Hoeffding's inequality, the three laws of maxima, Port Pirie's 65 annual sea-level maxima, and van Dantzig's dike height after the 1953 North Sea flood.
What you need. Calculus (limits, Taylor expansions), and the expectations, moment generating functions and joint laws of Parts 3 to 5.
- Hook
- Galton's ox, 1907
- Mathematics
- Markov and Chebyshev, the weak law, the CLT by MGFs, the delta method, "n ≥ 30" tested, heavy tails, extremes
- Built
- a Galton board
What you will be able to do
Bachelor's
- Compute a sample size three ways (Chebyshev, Hoeffding, the normal approximation) and say which answers are guarantees.
- Explain what the weak law and the central limit theorem each claim, and use the continuity correction for a binomial count.
Master's
- Prove the weak law from Chebyshev's inequality and the central limit theorem by expanding the log-MGF, and state what that proof assumed.
- Derive the delta method, and use it with Slutsky's theorem to show that the t statistic is asymptotically normal without normal data.
PhD
- Prove Hoeffding's inequality by Chernoff's trick and Hoeffding's lemma, and state what the Lindeberg-Feller, stable and extreme-value limit theorems each require.
Practice
- Judge from the skewness over root n, not from n = 30, whether a normal interval for a mean can be trusted, and say on which side it will miss.
- Report a return level from annual maxima with a profile-likelihood interval, and name the stationarity assumption it rests on.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Bachelor's 28 min · Master's 52 min · PhD 57 min · Practice 33 min.
- 0Galton's oxBachelor's2 min
- 1Markov, Chebyshev, JensenBachelor's4 min
- 2The weak lawBachelor's4 min
- 3Kinds of convergenceMaster's4 min
- 4The central limit theorem, seenBachelor's3 min
- 5The central limit theorem, provedMaster's4 min
- 6Using it: de Moivre and LaplaceBachelor's3 min
- 7Is thirty enough?Bachelor's4 min
- 8The delta methodMaster's5 min
- 9Slutsky and continuous mappingMaster's3 min
- 10When averages failBachelor's4 min
- 11ConcentrationPhD4 min
- 12The law of maximaMaster's3 min
- 13Floods and return levelsPractice5 min
- Recap, problems, and the road aheadAll tracks3 min
Also on this page: Lecture · Key results · Try it · Lab · Problems · Notes and sources · Build the film.
Lecture
The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film. A dashed box stands for a number the film computes when it is rendered (hover over it to see what is computed); the README's figures for each chapter, where it lists them, follow the chapter's text.
Galton's oxBachelor's2 min
In 1906, at a livestock fair in Plymouth, a fat ox stood on display, and for sixpence you could guess its weight once it had been slaughtered and dressed. Eight hundred people bought tickets: butchers and farmers who knew cattle, and plenty of others who didn't. Francis Galton, now in his eighties, obtained the tickets afterwards; seven hundred and eighty-seven were legible. He wanted to know how trustworthy a popular judgment is, and he wasn't expecting much. He published what he found in Nature in March 1907, under the title Vox Populi: the voice of the people.
Galton sorted the guesses from lowest to highest and printed every twentieth part of the line: the fifth percentile, the tenth, and so on. Here they are. Plotted against their position, they make an S-shaped curve, which Galton called an ogive. The middle guess, the median, was one thousand two hundred and seven pounds. The ox weighed one thousand one hundred and ninety-eight. The crowd was nine pounds high: less than one percent. The middle half of the guesses spanned seventy-four pounds; half of that, thirty-seven, is what Galton called the probable error. He drew the normal curve with that spread, in gold, and it fits the middle well, though the low guesses straggle further than the high ones. Three weeks later, in a letter, he gave the mean: eleven hundred and ninety-seven, one pound light.
Why should a crowd do so well? Here's a toy version. Suppose every guess is the truth plus an independent error of about seventy-five pounds. Average n guesses, and the typical error shrinks like seventy-five over root n: a straight line on these log scales, falling by a factor of ten for every hundredfold increase in the crowd. But suppose everyone shares a bias, say twenty pounds, because the ox looked heavier than it was. Then the error stops falling at twenty, Part 5's lesson about shared noise. This part asks three questions. Why does averaging work? How fast? And when does it fail?
What it does: Vox populi (1907): the percentile table as an ogive, with a normal of Galton's probable error; a simulated crowd whose error falls like 75/√n until a shared bias stops it; the objectives.; Numbers (computed): median 1,207 vs 1,198 lb (+0.75%); quartiles 1,162 and 1,236; mean 1,197
1Markov, Chebyshev, JensenBachelor's4 min
Suppose all you know about a quantity is that it can't be negative, and its mean. How much can it stray? Draw the line y equals x, and under it a step: zero until some level a, then a. The step never rises above the line, for any non-negative x. So a times the indicator that X is at least a is at most X itself. Take expectations of both sides; the expectation of an indicator is a probability. So the chance that X reaches a is at most its mean over a. That's Markov's inequality, named for Andrey Markov, who published it in the 1880s; his teacher Chebyshev had used the idea first. A quantity can't often be ten times its mean: at most one time in ten.
Test it on the World's incomes. In red, Markov's bound, one over a. In green, the share of adults earning at least a times the mean. Twice the mean: percent, against a bound of fifty. Three times: percent, against a third. The bound always holds, and it's always far from the truth, because it uses nothing but the mean. That's the price of a guarantee that needs only nonnegativity and a finite mean. We'll sharpen it by feeding it more.
Feed it the variance. The event that X is k standard deviations or more from its mean is the same as the event that the squared deviation is at least k squared sigma squared. Apply Markov to the squared deviation, which can't be negative. Its mean is the variance, so the chance is at most one over k squared. That's Chebyshev's inequality, found by Irénée-Jules Bienaymé in 1853 and by Pafnuty Chebyshev in 1867. Two standard deviations: at most a quarter. The World's heights, which are nearly normal, stray that far percent of the time; its incomes, percent. Both far below the bound.
Is Chebyshev's bound simply careless? No: it can't be improved. Here's a variable that meets it exactly. It equals its mean three quarters of the time, and otherwise jumps two standard deviations up or down, an eighth of the time each. Its variance is exactly sigma squared. And it lands two standard deviations away with probability a quarter, exactly the bound. So no inequality that uses only the mean and the variance can do better. To do better you must know more: that the variable is normal, which gives four point six percent, or that it's bounded, which gives the exponential bounds of chapter eleven.
The third inequality is about curves. A convex function is one whose chords lie above it. Let X take two values with equal chance. The average of phi of X is the midpoint of the chord; phi of the average is the curve below it. So for convex phi, phi of the mean is at most the mean of phi: Johan Jensen's inequality, 1906, and by approximation it holds for general integrable X when the expectations are well defined. With phi equal to x squared it says the variance can't be negative. With minus the logarithm, applied to the World's incomes: the mean of the log is below the log of the mean, so the geometric mean income, about forty thousand, is below the ordinary mean, forty-nine thousand. Jensen will turn up again whenever a logarithm meets an expectation.
What it does: Markov by the step under the line; tested on the World's incomes; Chebyshev from Markov; the three-point law that attains it; Jensen by chords, with the World's geometric and arithmetic mean incomes.; Numbers (computed): at 3× mean: 2.3% vs bound 33%; 2σ: heights 3.5%, incomes 1.7% vs 25%; geometric mean 39.6k < 49.5k
2The weak lawBachelor's4 min
With Chebyshev's inequality the law of large numbers takes three lines. The variance of an average of n independent variables, each with variance sigma squared, is sigma squared over n: the covariances vanish, as in Part 5. Apply Chebyshev to the average. The chance that it misses the mean by epsilon or more is at most sigma squared over n epsilon squared. For any fixed epsilon, however small, that goes to zero as n grows. That's the weak law: the average converges to the mean in probability. Notice how little it needed: a common mean and variance and pairwise zero covariance. For i.i.d. observations, even a finite absolute first moment suffices, as the strong law in chapter three implies.
Here's the law at work. Forty people each toss a fair coin four thousand times, and track the share of heads so far. The horizontal scale is logarithmic. Early on the shares wander all over the place. Then they're squeezed into a funnel around a half. The gold lines are two standard deviations of the share, one over root n either side. The funnel narrows like one over root n: to be ten times more precise, toss a hundred times as often. That square root is the exchange rate of all of statistics.
Now a trap. If the share of heads is drawn to a half, surely a run of tails must be made up by extra heads later? Plot not the share but the count: heads minus half the tosses. It is not forced to compensate for earlier tosses. It can return to zero, and for a fair coin does so infinitely often; yet at a fixed large n its typical size is about root n over two, the gold curves. The share converges only because the wandering count is divided by n, which grows faster. The coin has no memory and owes you nothing. Believing it does is the gambler's fallacy, and the law of large numbers gives it no support at all.
The first proof of a law of large numbers is far older than Chebyshev's. Jacob Bernoulli worked on it for twenty years, and it was published in 1713, eight years after his death, in his Art of Conjecturing. He called it his golden theorem. His example: an urn with three white tokens to every two black. How many draws, with replacement, before you're morally certain, which he took to mean odds of a thousand to one, that the observed share is within a fiftieth of three fifths? His answer: twenty-five thousand five hundred and fifty. It was an enormous number for the time; historians have wondered whether it is why he left the book unfinished.
How good was his answer? Chebyshev's inequality, applied to the same question, asks for six hundred thousand draws, worse than Bernoulli by a factor of twenty-three. Bernoulli's own bound, twenty-five thousand five hundred and fifty, was cleverer: he bounded the binomial tails directly. Wassily Hoeffding's inequality of 1963, which we meet in chapter eleven, needs nine and a half thousand. The normal approximation says about , and summing the binomial exactly, is enough. Bernoulli was four times too cautious, but his number was a proof, and the approximation is not.
What it does: Chebyshev's three-line proof; 40 coin paths in the √n funnel; the count of extra heads wanders (no gambler's compensation); Bernoulli's golden theorem and his 25,550 against modern bounds.; Numbers (computed): Chebyshev 600,600; Bernoulli 25,550; Hoeffding 9,503; normal 6,498; exact 6,520
3Kinds of convergenceMaster's4 min
What it means for random things to converge. A sequence of numbers converges if it gets and stays close to its limit. For random variables there are several ways to say that, and the difference matters. In probability: the chance of being more than epsilon away goes to zero. That's what the weak law gave us. In distribution: the CDFs converge, at least where the limit's CDF has no jump. This only compares the shapes of the distributions, and it's what the central limit theorem will deliver. Almost surely: for almost every outcome of the whole infinite experiment, the sequence of numbers it produces converges. That's the strong law.
Convergence in distribution is the weakest of the three. Take a standard normal X, and let every X n be minus X. Minus X has exactly the same distribution as X, so the sequence converges to X in distribution: trivially, it's already there. But X n and X are never close: they're mirror images, and the gap, twice the size of X, never shrinks. Convergence in distribution is a statement about the shape of a histogram, not about the values. That's exactly what we need to compute probabilities, and nothing more.
And convergence in probability is weaker than almost sure convergence. Here's the classic example, sometimes called the typewriter. Pick a uniform random point omega in the unit interval. A block sweeps across the interval: first one block the whole width, then two halves in turn, then four quarters, then eight eighths. X n is one if omega is under the n-th block. The blocks shrink, so the chance that X n is one goes to zero: X n converges to zero in probability. But every sweep passes over every point, so for every omega, X n keeps returning to one, forever, however rarely. The sequence of values converges for no omega at all. A small chance at each time is not the same as eventually never.
For averages, the stronger statement is also true. Toss two thousand coins twenty thousand times each. In blue, the share of sequences whose running share of heads is outside a half, plus or minus point oh two, at toss m: the weak law says this goes to zero. In purple, the share that stray outside after m but before our finite run ends. The corresponding infinite-horizon probability goes to zero by the strong law. That's a much bigger event, but it goes to zero too: after ten thousand tosses, only one sequence in two thousand leaves the band again before the run ends. That's the strong law of large numbers: almost every sequence eventually stays inside any band. Émile Borel proved it for coins in 1909 and Andrey Kolmogorov in general around 1930; the proof needs the measure theory of Part 43.
Here's how they fit together. Almost sure convergence implies convergence in probability. So does convergence in mean square, that the expected squared distance goes to zero, by Chebyshev's argument. And convergence in probability implies convergence in distribution. None of the arrows reverses: the mirror and the typewriter give two counterexamples. For convergence in probability without mean-square convergence, take square root n times the indicator that a uniform U is below one over n: the event gets rare but its expected square stays one. With one useful exception: if the limit is a constant, convergence in distribution does imply convergence in probability, and chapter nine will use that.
What it does: In probability, in distribution, almost surely; the mirror X_n = −X; the typewriter sequence; the strong law, seen in 2,000 sequences; the hierarchy.; Numbers (computed): outside 0.5 ± 0.02 after toss 10,000: 1 sequence in 2,000
4The central limit theorem, seenBachelor's3 min
Start with a lopsided law: a variable that's zero half the time, five a fifth of the time, and occasionally something in between. Its distribution looks nothing like a bell: two spikes at the ends. Add two independent copies, and compute the distribution of the sum exactly, by convolution, with Part 2's engine. Rescale it to mean zero and standard deviation one. Three copies. Five. Ten. Thirty. The gold curve is the standard normal density. The shape we started with is gone, and the bell has taken its place. The number on the right, the largest gap between the two CDFs, falls steadily as n grows; unlike a continuity-corrected comparison, this checks both sides of every discrete CDF jump.
For laws with an MGF near zero, Part 3 gives an explanation using cumulants. More general laws need the characteristic-function proof. For a sum of independent variables, every cumulant adds: the r-th cumulant of the sum is n times that of one variable. Now standardize. Skewness is the third cumulant over the variance to the power three halves; for the sum it's the original skewness divided by root n. Excess kurtosis, the fourth, is divided by n. Every cumulant beyond the second dies away, the higher ones faster. And the only distribution whose third, fourth and all higher cumulants are zero is the normal. That's the mechanism behind the theorem in this setting, and also a warning: skewness is the last feature to disappear, at the slow rate of one over root n.
Francis Galton built a machine to show this, which he called the quincunx. Here's ours. Balls fall through twelve rows of pegs. At each peg a ball bounces left or right, with equal chance, independently. The bin it lands in counts its rightward bounces, so the bin is a sum of twelve coin flips: a binomial. Watch the first few. Most balls take a mixed route and land near the middle; to reach an end bin, a ball must bounce the same way twelve times running, which happens once in four thousand and ninety-six for each end. Six hundred balls, and the pile takes the shape of the bell. Galton wrote that the law of error reigns with serenity in the midst of the wildest confusion.
The remarkable thing is that the ingredient hardly matters. Flat, uniform numbers; steeply skewed exponential waiting times; our lopsided law. Sum thirty of any of them, standardize, and the histogram follows the same gold curve. Abraham de Moivre found the bell in 1733 for coin tosses; Pierre-Simon Laplace saw in 1810 that it holds for sums of almost anything. Almost: the summands must be independent and identically distributed with finite positive variance; no universal finite sample size guarantees a close normal approximation. Chapter ten shows what happens when it isn't.
What it does: Exact convolution powers of a lopsided law on {0,…,5}; cumulants: skewness/√n, kurtosis/n; the Galton board; uniform, exponential and lopsided sums of 30.; Numbers (computed): sup|F_n − Φ|: 0.298 (n = 1) → 0.031 (n = 30)
5The central limit theorem, provedMaster's4 min
Here is the theorem: for independent, identically distributed variables with finite positive variance, the standardized sum converges in distribution to the standard normal. We'll prove it assuming a little more, that the moment generating function exists near zero. Standardize each term first: Y has mean zero and variance one, and Z n is the sum of the Y's divided by root n. The moment generating function of Z n is the expectation of e to the t Z n. Because the terms are independent, the expectation of the product is the product of the expectations: the MGF of Y at t over root n, raised to the n-th power. Take logarithms. Everything now depends on the log-MGF of Y at a point that's approaching zero.
Expand the log-MGF in its cumulant series, from Part 3. The first cumulant, the mean, is zero; the second, the variance, is one. So it starts u squared over two, then the third cumulant times u cubed over six, and so on. Put u equal to t over root n and multiply by n. The n cancels against the u squared, leaving t squared over two. The next term, from the skewness, shrinks like one over root n; the rest faster. So the MGF of Z n converges to e to the t squared over two, the MGF of the standard normal. Finally, a theorem of John Curtiss from 1942: if MGFs converge on an interval around zero, the distributions converge. And that's the proof. Notice that the error term, kappa three over six root n, is the same skewness we saw dying in chapter four.
Here's the convergence itself. On the left, a centred exponential; on the right, our lopsided law. Each coloured curve is n times the log-MGF at t over root n, for n equal to one, two, five, twenty and a hundred. They close in on the gold parabola, t squared over two. The exponential's skewness is two, so it approaches from above on the right and below on the left, and it gets there slowly. Its MGF is infinite beyond one, so for a single term the curve simply stops: a reminder that this proof leans on an assumption we'll want to drop.
The full theorem needs only a finite variance. Our proof assumed more: an MGF near zero. The lognormal's MGF is infinite for every positive t, and so is Student's t's, so the proof as given doesn't cover them, though the theorem covers the lognormal and Student laws with more than two degrees of freedom. The repair is to replace e to the t X by e to the i t X: the characteristic function of Part 3, which always exists, since its size is one. Finite variance gives a second-order expansion with a remainder smaller than u squared; no third or fourth moment is needed. Levy's continuity theorem then supplies convergence in distribution. Nor do the terms need to be identically distributed. Aleksandr Lyapunov proved a version in 1901, and Jarl Lindeberg found the right condition in 1922: the normalized sum of variance contributions from terms whose magnitude exceeds epsilon times the total standard deviation must vanish for every positive epsilon. This is stronger than saying no single term dominates the variance. William Feller showed in 1935 that, when no term dominates, Lindeberg's condition is also necessary. Part 43 proves all of it.
The name comes from George Pólya, who in 1920 called it the central limit theorem of probability: central as in of central importance. It had taken almost two centuries, from de Moivre's coins, through Laplace, to Lyapunov, Lindeberg, Lévy and Feller, who pinned down exactly when it holds. Many asymptotic confidence intervals and tests in the next fifteen parts lean on it.
What it does: M_Y(t/√n)^n; the cumulant expansion; Curtiss's continuity theorem; n log M(t/√n) → t²/2 drawn for the exponential and the lopsided law; Lindeberg–Lévy, Lyapunov, Lindeberg, Feller; Pólya's name.
6Using it: de Moivre and LaplaceBachelor's3 min
The first central limit theorem was a theorem about coins. In November 1733 Abraham de Moivre, a French Protestant refugee living in London, printed a seven-page pamphlet in Latin for his friends. He wanted the sum of the middle terms of the binomial for large n, too many to add by hand. He made his living tutoring mathematics and advising gamblers, and he had worked on the problem for twelve years. With the constant root two pi, which his friend James Stirling supplied, he found that the binomial terms fall away from the middle like e to the minus two x squared over n: the first appearance of the normal curve.
Here's what he found, for a hundred fair tosses. The blue bars are the exact binomial probabilities. The gold curve is the normal density with the same mean, fifty, and the same standard deviation, five. De Moivre's approximation: put Stirling's formula into each factorial, expand the logarithm to second order, and the binomial term becomes the normal density at k. At the centre the exact chance of fifty heads is ; the curve's height is . Laplace extended the result to any p in 1812, which is why it's called the de Moivre–Laplace theorem.
Now a tail probability: sixty heads or more. Exactly, adding the bars, it's , about one chance in thirty-five. The naive approximation takes the area under the curve from sixty upwards: two standard deviations, , twenty percent too small. The fault is ours, not the theorem's. Each bar is one unit wide and centred on its integer, so the bar for sixty starts at fifty-nine and a half. Take the area from there and you get , within one percent. That's the continuity correction: when a continuous curve stands in for a discrete distribution, match the bars, not their labels.
The approximation has limits. A hundred trials, each succeeding with chance three percent: the expected count is only three, and the distribution is visibly skewed. The normal curve spills below zero and misses the shape. For six or more successes, the corrected normal gives against an exact , while Part 3's Poisson approximation, the green dots, gives . The skewness, one minus two p over root n p q, tells you how far you are from the bell. A common rule of thumb asks for n p q of ten or more; for rare events, use the Poisson.
What it does: De Moivre's 1733 pamphlet; the local approximation; the continuity correction; a rare-event binomial where the Poisson wins.; Numbers (computed): P(S = 50) 0.0796 vs 0.0798; P(S ≥ 60) 0.0284 exact, 0.0228 plain, 0.0287 corrected; p = 0.03: 0.081 exact, 0.071 normal, 0.084 Poisson
7Is thirty enough?Bachelor's4 min
Every introductory course has a rule: once the sample has thirty observations, you may treat its mean as normal. Where does thirty come from? Nobody quite knows; one story is that printed tables of Student's t stopped at thirty degrees of freedom. Let's test it. Draw samples of the World's adult heights, of five, thirty and three hundred people, twenty thousand samples of each, and standardize the means. Heights are close to normal already, so even at five the means are indistinguishable from the bell: the largest gap between the CDFs is under one percent. For heights, thirty is generous.
Now do the same with incomes. The World's incomes are far from normal: a skewed body and a Pareto tail, so that the top one percent earn about a fifteenth of all the income. With five people, the means are piled on the left, with a long tail to the right: most samples miss the rare high earners, and a few catch one. With thirty, it's hardly better. Even with a thousand people the histogram still leans, and the gap between the CDFs is still nearly seven percent. The central limit theorem holds, since the variance is finite; it's just very slow.
What does this do to a confidence interval? Part 11 will build them properly; for now take the usual one, the mean plus or minus about two standard errors, which promises ninety-five percent. For heights the promise is kept at every sample size. For a lognormal with the World's spread, it's a little short for small samples and fine by a hundred. For the World's incomes, the interval covers the true mean only percent of the time with thirty people, and percent with a thousand. And the misses are lopsided: nearly always the interval is too low, because the sample has missed the rare high incomes that pull the true mean up.
Is there a guarantee? Yes, if the third absolute moment is finite: the Berry–Esseen theorem, proved by Andrew Berry in 1941 and Carl-Gustav Esseen in 1942. The gap between the CDFs is at most a constant times the third absolute moment over sigma cubed, over root n. Irina Shevtsova showed in 2011 that the constant can be taken below point four eight. For the lognormal, the bound, in red, falls like one over root n. The truth, in purple, is far below it: the bound is safe but cautious. For the finite World, every moment exists, but its third absolute moment makes the bound very loose. The unbounded Pareto model that generated the tail has index two point one and no third moment, so Berry--Esseen gives that idealized model no bound. The green simulation here samples the finite World.
So what's the right rule? Chapter four told us: the skewness of the mean is the skewness of one observation divided by root n. Heights have none to speak of. The lognormal's is about two, so a few dozen observations bring it down to a third. The World's incomes have a large finite-population skewness. In the underlying unbounded Pareto model the third moment is infinite, so a sample skewness can be unstable and does not estimate a finite population value. There is no magic number. Transformations can help when the transformed quantity answers the question; a mean log income is not the log of mean income. The bootstrap in Part 16 also needs care with rare tails, since resampling cannot invent unseen high earners. Another option is to model the tail, as chapter twelve begins to. And remember that a heavy tail is a warning: your sample may simply not have met it yet.
What it does: Means of heights (normal at n = 5) and of incomes (skewed at n = 1,000); t-interval coverage; Berry–Esseen with Shevtsova's constant; the skewness/√n rule.; Numbers (computed): income coverage 87.4% (n = 5), 89.5% (30), 92.9% (1,000), misses almost all low; lognormal BE bound 0.219 vs actual 0.029 at n = 30
8The delta methodMaster's5 min
The central limit theorem is about averages. But we rarely want the average itself: we want its square root, its logarithm, a ratio of two averages. The delta method carries the theorem through any smooth function. Here's the idea in one picture. The sample mean is nearly normal, concentrated in a narrow band around mu. Push it through a smooth curve g, here the square root. Over such a narrow band the curve is almost straight: it's its tangent line. And a straight line maps a normal to a normal, stretching its width by the slope. So g of the mean is nearly normal too, centred at g of mu, with standard deviation the absolute value of g-prime of mu times sigma over root n.
In symbols. Expand g around mu to first order. The remainder is smaller than the deviation of the mean, which is itself of size one over root n. Multiply through by root n. The central limit theorem says root n times the deviation tends to a normal with variance sigma squared; multiplying by g-prime of mu scales the variance by its square. The remainder vanishes in the limit, by the theorem of the next chapter. That's the delta method, and it works whenever g has a non-zero derivative at mu.
One of the delta method's best uses explains a trick from Part 1. A Poisson count has variance equal to its mean: big counts are noisier, which makes comparisons awkward. Take the square root. The derivative of root x at lambda is one over two root lambda; squared and multiplied by lambda, the first-order variance approximation is a quarter, becoming accurate for large lambda. Computed exactly: the raw variance, in blue, climbs with lambda; the variance of the square root, in orange, settles onto a quarter once lambda is above about five. That's a variance-stabilizing transformation, and it's why Part 1 took square roots of counts.
The same idea works for proportions. A sample proportion has variance p times one minus p over n, which depends on the very p we're estimating. Look for a g whose derivative squared times p times one minus p is constant. The answer is the arcsine of the square root, and the constant is a quarter. So the variance of the arcsine-root of a proportion is about one over four n, whatever p is. Here it is computed exactly for samples of fifty: the raw variance, in blue, is a hump; the transformed one, in orange, is flat across the middle and only bends up near zero and one, where the approximation is strained.
With several averages at once, the derivative becomes a gradient. For a smooth function of a vector of means, the limit is normal with variance gradient transpose Sigma gradient: Part 4's quadratic form, with Part 5's covariance matrix. For a ratio of two means, that gives this formula, which every survey statistician uses: ratio estimates in Part 18, odds ratios in Part 14. And a check: the standard deviation of the log of the mean of fifty of the World's heights. The delta method predicts sigma over mu root n; the simulation agrees to the third significant figure.
What if the derivative is zero at mu? If g is twice differentiable there, the linear term disappears. A nonzero second derivative makes the quadratic term lead; if it too vanishes, higher order is needed. Multiply by n instead of root n, and the limit is a scaled chi-squared with one degree of freedom: the square of a normal, from Part 3. The simplest case: the squared mean of variables whose mean is zero. It shrinks faster, like one over n, and its limit is skewed, not normal. Tests based on likelihoods, in Part 10, live exactly here.
What it does: The tangent-line picture; the derivation; √ of a Poisson (variance → 1/4); arcsine of a share (1/4n); several means and ratios; log of a mean; second order and χ²₁.; Numbers (computed): Var √X 0.251 at λ = 64; sd(log x̄) 0.00782 predicted vs 0.00780 simulated
9Slutsky and continuous mappingMaster's3 min
Limits would be useless if we couldn't combine them. Two theorems let us. The continuous mapping theorem: if X n converges, in distribution or in probability, so does any continuous function of it, to the same function of the limit. Henry Mann and Abraham Wald proved it in 1943. Slutsky's theorem: if X n converges in distribution and Y n converges in probability to a constant, then their sum, product and ratio converge to what you'd expect. Evgeny Slutsky, better known to economists, published it in 1925. One more word. An estimator that converges in probability to the quantity it estimates is called consistent. The weak law says the sample mean is consistent for the population mean.
Here's the most important use. In practice we don't know sigma, so we divide by the sample standard deviation instead. That's the t statistic. Split it into two factors: the standardized mean, which tends to a standard normal by the central limit theorem, and sigma over S n. S n squared is built from the averages of X squared and of X; by the finite-first-moment weak law for i.i.d. variables, both converge to their expectations, and by continuous mapping S n converges to sigma. So the second factor tends to one. By Slutsky, the t statistic tends to a standard normal, for i.i.d. data with finite, positive variance. For normal data, Part 8 will show it has Student's t distribution exactly, at every sample size.
Let's see it. For samples of ten heights, the t statistic is already very close to normal; at ten, the t with nine degrees of freedom reference is a little wider, so the histogram's tails sit just above the curve. For incomes it's a different story. The t statistic leans hard to the left, because a sample that happens to include a high earner has both a big mean and a big standard deviation, and the second shrinks the ratio. With a hundred people it's still visibly skewed, and the interval still falls short. Slutsky tells us where the statistic ends up, not how fast it gets there.
Why does Slutsky insist on a constant? Let X n be a standard normal Z, and Y n be minus Z. Both converge in distribution to a standard normal. Adding the two marginal normal laws as if they were independent would give variance two, but the marginal limits do not justify that independence. But their sum is zero, always. Convergence in distribution describes each variable alone; it forgets how they're joined. A constant can only be joined one way, which is why Slutsky's theorem works. In general you need the joint limit, which is Part 5's lesson in a new setting.
What it does: The two theorems; consistency; the t statistic without normality; t for heights and incomes; why Slutsky needs a constant (X_n = Z, Y_n = −Z).; Numbers (computed): coverage: heights 94.6% (n = 10); incomes 86.8% (10), 91.4% (100)
10When averages failBachelor's4 min
Every theorem so far assumed something: a finite mean, a finite variance. Here's what happens without them. On the left, running means of standard normal draws: six sequences of ten thousand, settling quickly onto zero. On the right, running means of Cauchy draws: Part 3's lighthouse, the ratio of two normals. They never settle. Every so often a single huge draw jerks the average somewhere new, and after ten thousand draws it's no more settled than after ten. The Cauchy has no mean, so there is nothing for the average to converge to.
It's worse than slow. The Cauchy's characteristic function is e to the minus the absolute value of t. The mean of n independent copies has characteristic function that, at t over n, raised to the n-th power: which is e to the minus absolute t again. So the average of n Cauchy variables is Cauchy, with exactly the same spread as a single one. Averaging buys nothing. The simulation agrees: the quartiles of the mean stay at minus one and plus one whether you average one, ten or a hundred.
Between the normal and the Cauchy lies a whole family of heavy tails. Take a Pareto variable with tail index one and a half: the chance of exceeding x falls like x to the minus one and a half. Its mean is three, but its variance is infinite. The running means do head for three, since the weak law needs only a finite mean, but slowly and in jumps, each time a big draw arrives. The central limit theorem fails: the errors shrink like n to the minus a third, not n to the minus a half, and their limit is not normal but a skewed law called stable. Recall that the unbounded model generating the World's income tail has index two point one: just inside the territory where the variance is finite, which is why chapter seven found them so slow.
There's a complete answer. If sums of independent, identically distributed variables converge to a non-degenerate law along the full sequence, after deterministic centring and scaling, the limit must be a stable law, a family with an index alpha between zero and two. Paul Lévy found them in 1925; Boris Gnedenko and Kolmogorov wrote the theory down in 1949. Index two is the normal, and it attracts everything with a finite positive variance, with the usual square-root normalization. Some infinite-variance laws also approach a normal limit, with a slowly varying correction to that scale. Between one and two, the mean exists, the variance doesn't, and the normalization is n to the one over alpha times a slowly varying factor, which is constant for a pure Pareto tail. At one, the symmetric Cauchy is one example where averaging buys nothing. Other index-one stable laws can be skewed and need different centring. Heavy tails are common in the real world: city sizes, insurance claims, fortunes; Benoit Mandelbrot argued in 1963 that cotton prices had them. Before you trust an average, look at the tail.
What it does: Running means of normals and Cauchys; the Cauchy mean is Cauchy (characteristic functions); Pareto α = 1.5: the law holds, the CLT fails; stable laws and the generalized CLT.; Numbers (computed): quartiles of the Cauchy mean ≈ ±1.0 for n = 1, 10, 100
11ConcentrationPhD4 min
The central limit theorem is a statement about the limit. Chebyshev's inequality holds for every n, but it's weak. Can we have both: a guarantee at every sample size, with exponential decay? For bounded variables, yes. Wassily Hoeffding proved in 1963 that if each variable lies between a and b, the chance that the mean misses by epsilon is at most twice e to the minus two n epsilon squared over b minus a squared. Chebyshev's bound falls like one over n. A normal approximation suggests exponential decay, but the CLT alone does not determine the rate at a fixed epsilon: the standardized threshold is moving into the tail. Hoeffding's falls exponentially and holds for every n, with no approximation at all.
The proof is Markov's inequality with a twist. Exponentiate first: the event that the sum exceeds its mean by t is the event that e to the lambda times the excess exceeds e to the lambda t. Apply Markov to that. This is Herman Chernoff's trick. By independence the expectation factors into one MGF per variable, and Hoeffding's lemma bounds the MGF of any centered variable confined to an interval of width b minus a by e to the lambda squared b minus a squared over eight. Now choose lambda to make the bound as small as possible: a quadratic in the exponent, minimized in one line. Put t equal to n epsilon and you have Hoeffding's inequality, for one tail; double it for both.
Compare them on a coin with p equal to point six, asking for the chance that the sample proportion misses by five points or more. The scale is logarithmic. Chebyshev's bound creeps down slowly: a straight line here would mean exponential decay, and its curve flattens. Hoeffding's is a straight line, falling a factor of ten every four hundred and sixty tosses. The exact probability, and the normal approximation that tracks it, fall faster still, because Hoeffding uses only the bounds of the variable, not its variance. At a thousand tosses: the truth is about one in seven hundred; Hoeffding guarantees one in seventy-four; Chebyshev, only one in ten.
Exponential tails have a remarkable consequence. Suppose you estimate m different proportions at once, and want all of them right. The chance that any one fails is at most the sum of the individual chances: m times Hoeffding's bound. To keep that below delta, n need only grow like the logarithm of m. Ten proportions to within five points, all at once, with ninety-five percent confidence: twelve hundred observations. A million proportions: only thirty-five hundred. With Chebyshev's polynomial tail it would be millions. That logarithm is the engine of machine-learning theory in Part 54, and of every result you'll read that holds with high probability.
How fast, exactly, do such tails fall? Harald Cramér answered in 1938. Take a coin that lands heads nine times in ten. The chance that the share of heads in n tosses reaches a fixed level a above p, or falls below a fixed a below p, decays like e to the minus n times a rate, I of a. For coins the rate is this expression, which Part 22 will recognize as the Kullback–Leibler divergence between a coin with chance a and one with chance p. Hoeffding's exponent, in purple, sits below it everywhere: a bound must be cautious. The normal approximation, in gold, matches Cramér's rate near p, but far from it, it's wrong in both directions: too optimistic below p, too pessimistic above. The central limit theorem describes typical deviations; large deviations need their own theory.
What it does: Hoeffding's inequality; its proof (Chernoff's trick, Hoeffding's lemma); against Chebyshev, the normal approximation and the exact tail; the union bound and log m; Cramér's large-deviation rate.; Numbers (computed): n = 1,000: exact 0.0014, Hoeffding 0.0135, Chebyshev 0.096; 10 → 10⁶ proportions: n = 1,199 → 3,501
12The law of maximaMaster's3 min
Averages are not the only thing we need to predict. A sea wall has to survive the highest tide of the century, not the average one; a bridge, the heaviest load; an insurer, the worst year. These are maxima, and they have their own law. The largest of n independent values is below x exactly when all of them are, so its CDF is F of x to the n-th power. For exponential waiting times: one value, ten, a hundred, a thousand. As n grows the curve slides to the right, by about two point three for every tenfold increase, but its shape stops changing. That's a hint that, once we follow it, the maximum has a limiting shape of its own.
Follow it, and the limit appears. Subtract log n from the maximum of n exponentials. e to the minus log n is one over n, so the CDF becomes one minus e to the minus x over n, to the n-th power. And that's the limit that defines e: it tends to e to the minus e to the minus x. This is the Gumbel distribution, named for Emil Gumbel, whose 1958 book taught a generation of engineers to design for floods.
Here it is. Twenty thousand maxima of ten exponentials, shifted by log ten. The gold curve is the Gumbel density. A hundred: a thousand. The histogram sits on the curve. Notice that it isn't symmetric: the maximum has a long upper tail, because occasionally one value in the batch is very large.
The Gumbel isn't the only possible limit. What happens depends on the tail of the original distribution. Light tails, like the exponential or the normal, give the Gumbel, after appropriate centring and scaling. Heavy, power-law tails, like the Pareto, give a different law, named for Maurice Fréchet: here the maximum must be scaled, not shifted, by root n for a Pareto with index two, and its limit has a power-law tail of its own. And a distribution with an endpoint with a power-law approach, as for the uniform or beta, gives a third, a reversed Weibull: the maximum creeps up to the ceiling, and its distance below it, times n, has an exponential limit.
In 1928 Ronald Fisher and Leonard Tippett, studying the strength of cotton threads, found that these three are the only possibilities: if the maximum, suitably shifted and scaled, converges to anything, it's one of the three. Boris Gnedenko proved it rigorously in 1943. They combine into one family, the generalized extreme value law, with a shape parameter xi. Positive xi gives Fréchet's heavy tail; xi equal to zero, the Gumbel; negative xi, the Weibull, with a ceiling. It's the central limit theorem for maxima, with one extra parameter to estimate. And one caution: for normal data the convergence is painfully slow, at the rate one over log n.
What it does: F^n; max − log n → Gumbel, derived and simulated; the three families (Gumbel, Fréchet, reversed Weibull); the GEV and Fisher–Tippett–Gnedenko.
13Floods and return levelsPractice5 min
On the night of the thirty-first of January 1953, a storm surge driven down the North Sea arrived with a spring tide. The dikes of the south-west Netherlands broke in dozens of places. Eighteen hundred and thirty-six people died in the Netherlands, and more than three hundred in England. The Dutch government set up the Delta Committee to decide how high the defences must be. Its mathematician, David van Dantzig, treated it as a problem of statistics and economics together. The standard that emerged for the heart of Holland: the design water level should have annual exceedance probability one in ten thousand. Exceeding that level and failure of the defences are different engineering events. To set a height for that, you must estimate a sea level that no one has ever seen.
We'll use a record that statisticians have studied for decades. Port Pirie, a harbour town in South Australia: the highest sea level of each year from 1923 to 1987, sixty-five values. These are maxima, each the largest of a whole year of tides, so a generalized extreme value law is a natural approximate model, rather than an automatic consequence for a finite, possibly changing record. We assume a stationary annual-maxima model here. The highest in the record, four point six nine metres, came in 1934.
Fit the three parameters, location, scale and shape, by maximum likelihood: find the values that make the observed maxima most probable. Part 9 builds that method; here a computer simply searches. The estimates: a location of three point eight seven metres, a scale of about twenty centimetres, and a shape of minus point oh five, slightly negative, so very close to the Gumbel. These match the published analysis in Stuart Coles's textbook. The fitted density, in gold, over the histogram of the sixty-five maxima.
Engineers speak of return levels. The T-year return level is the height exceeded in any one year with probability one over T. Inverting the fitted distribution gives a formula. Plotted against the return period on a log scale, it's a gently bending curve; the white dots are the sixty-five observed maxima at their empirical return periods. The hundred-year level: four point six nine metres, the height of the 1934 record. The ten-thousand-year level: five point three four. Note what a hundred-year level does not mean: assuming independent years with the same exceedance probability, the chance of at least one exceedance in thirty years is twenty-six percent. A changing climate can invalidate that stationarity assumption.
How sure can we be? For each candidate hundred-year level, refit the other two parameters as well as possible and record the best log-likelihood: the profile likelihood, which Part 22 develops. Levels where it falls less than about two units below its peak are plausible. The approximate likelihood-ratio cutoff gives a model-based interval from about four point four nine to five point two six metres: lopsided, because the data rule out low values more firmly than high ones. Sixty-five years of data asked about a hundred is already a stretch. The Delta Committee needed ten thousand. Extrapolation is where extreme-value statistics earns its keep, and where assumptions about stationarity, dependence and tail shape matter most. This interval does not cover all that model uncertainty.
Van Dantzig's own contribution was to turn the question into a decision. Above the current dike height, the chance that the sea goes over falls roughly exponentially with each extra metre: a Gumbel tail. The total cost of a height h is the cost of building, which grows with h, plus the expected flood losses for ever after, discounted, which fall with h. Set the derivative to zero, and the best height has a closed form: worth raising until the next metre costs more than the flood damage it prevents. The ten-thousand-year standard came out of reasoning like this, which is statistics as decision-making, the subject of Part 45.
What it does: The 1953 North Sea flood and the Delta Committee; Port Pirie's 65 annual maxima; the GEV fit by maximum likelihood; return levels; the profile likelihood of the 100-year level; van Dantzig's economic dike height.; Numbers (computed): (μ, σ, ξ) = (3.875, 0.198, −0.050); z₁₀₀ = 4.69 m, 95% profile interval [4.49, 5.26]; z₁₀₀₀₀ = 5.34 m
Recap, problems, and the road aheadAll tracks3 min
Part six in thirteen lines. Galton's crowd guessed the ox within one percent. Markov's inequality needs only a mean, Chebyshev's a variance, and Chebyshev's can't be improved; Jensen's says the mean of a convex function exceeds the function of the mean. The weak law follows in three lines, and the funnel narrows like one over root n. Random things converge in probability, in distribution, or almost surely, and the differences matter. The central limit theorem appears as the higher cumulants die away, and it's proved by expanding the log-MGF. De Moivre found it for coins, and the continuity correction makes it accurate. For skewed data, thirty observations are not enough. The delta method pushes the theorem through smooth functions, and Slutsky's theorem frees the t statistic from normality. Cauchy averages never settle, and stable laws take over when variances are infinite. Hoeffding's inequality gives exponential guarantees at every sample size. And maxima have their own three laws, which predict floods.
Where it comes back. Consistency is the first property we ask of every estimator, from Part 9 on. The central limit theorem stands behind many asymptotic intervals and tests in the next fifteen parts, and Part 43 proves it in full. Its speed returns with the bootstrap. The delta method gives the standard errors of almost every estimator you'll meet. Slutsky's theorem is used every time a nuisance parameter is estimated. Concentration inequalities are the language of high-dimensional statistics and learning theory. And heavy tails and extremes return with robust statistics and with spatial and survival models.
Six problems, with full solutions in the README. Markov's inequality, made tight; a poll's sample size three ways; the Poisson limit by moment generating functions; the delta method for an exponential rate; the maximum of uniforms; and the t statistic, theorem by theorem. Pause here if you want to try them.
The books and papers this part follows: Blitzstein and Hwang, Grimmett and Stirzaker, van der Vaart's Asymptotic Statistics, Vershynin on concentration, and Coles on extremes, along with the original papers from Bernoulli to van Dantzig.
Six parts of sixty-five. We now know why averages work, how fast, and when they don't. But every check in this part leaned on simulation: millions of random draws, from coins, normals, Cauchys and Paretos. Where do those random numbers come from, on a machine that can only follow instructions? John von Neumann said that anyone who considers arithmetical methods of producing random digits is in a state of sin. Part 7 commits that sin, carefully.
Where it goes next. Consistency is asked of every estimator from Part 9 on; the central limit theorem stands behind the intervals and tests of Parts 8, 10 and 11 and is proved in full in Part 43; its speed returns with the bootstrap in Part 16; the delta method gives the standard errors of Parts 9, 14, 18 and 22; concentration returns in Parts 51, 54 and 58, heavy tails in Parts 30 and 60, extremes in Parts 39 and 40.
Key results
The part's results in one place, for revision.
Try it
Lab 6 · The speed of the central limit theorem, and where it stops
Compute the exact distance between the law of a standardized sum of n exponentials and the normal, set it against the Berry-Esseen bound and the skewness-over-root-n rule, then average Cauchy draws and see the spread of the mean not shrink at all.
python -m videos.stats.labs 6
needs numpy, scipy, matplotlib · download lab06.py ·
source on GitHubn = 1: sup|F_n - Phi| 0.1587 Berry-Esseen bound 1.1464 skewness rule 0.1330
n = 30: sup|F_n - Phi| 0.0243 Berry-Esseen bound 0.2093 skewness rule 0.0243
n = 1000: sup|F_n - Phi| 0.0042 Berry-Esseen bound 0.0363 skewness rule 0.0042
n = 30, simulated (20,000 sums) 0.0278 (exact 0.0243)
half the interquartile range of the mean, n = 1 Cauchy 1.010 (theory 1) normal 0.668 (theory 0.674)
half the interquartile range of the mean, n = 10 Cauchy 1.000 (theory 1) normal 0.211 (theory 0.213)
half the interquartile range of the mean, n = 100 Cauchy 0.988 (theory 1) normal 0.067 (theory 0.067)
With a finite third moment the bell arrives at rate 1/sqrt(n), far inside the Berry-Esseen guarantee and at the size the skewness predicts; with no mean at all, the average of a hundred draws is as wild as one draw.
The code (77 lines; it asserts its own result)
"""Lab 6: measure how fast the bell arrives for sums of exponentials, and watch Cauchy means refuse to settle."""
import numpy as np
from scipy import stats
from videos.coursekit import labs
from explainer.stats.kit import limits
TITLE = "The speed of the central limit theorem, and where it stops"
GOAL = ("Compute the exact distance between the law of a standardized sum of n exponentials and the normal, set it "
"against the Berry-Esseen bound and the skewness-over-root-n rule, then average Cauchy draws and see the "
"spread of the mean not shrink at all.")
TASKS = [
"Replace the exponential by a Bernoulli(0.1) sum (limits.bernoulli_sum_atoms, limits.kolmogorov_lattice). Does "
"the distance still fall like 1/sqrt(n), and with what constant?",
"Replace the Cauchy by a Pareto with tail index 1.5 (rng.pareto(1.5) + 1, mean 3). Do the quartiles of the mean "
"shrink, and at what rate in n?",
"Use the n = 30 sums to check the delta method: compare the simulated sd of log(mean) with 1/sqrt(30).",
]
def run(seed=0):
rng = np.random.default_rng(seed)
lab = labs.Lab()
# 1. The speed, exactly: a sum of n Exp(1) is gamma(n), so sup |F_n - Phi| needs no simulation.
ns = np.array([1, 2, 5, 10, 30, 100, 300, 1000])
z = np.linspace(-6, 8, 7001)
rho = limits.third_abs_moment("exponential") # E|X - 1|^3 = 12/e - 2
exact = np.array([limits.kolmogorov(limits.exponential_sum_cdf(int(n)), stats.norm.cdf, z) for n in ns])
bound = np.array([limits.berry_esseen(rho, int(n)) for n in ns])
rule = 2 / (6 * np.sqrt(2 * np.pi * ns)) # skewness / (6 sqrt(2 pi n)): the first Edgeworth term at z = 0
reps = 20_000
sums = (rng.exponential(size=(reps, 30)).sum(1) - 30) / np.sqrt(30)
ecdf_gap = np.max(np.abs(np.searchsorted(np.sort(sums), z, side="right") / reps - stats.norm.cdf(z)))
for n, d, b in zip(ns, exact, bound):
if n in (1, 30, 1000):
lab.row(f"n = {n}: sup|F_n - Phi|", f"{d:.4f} Berry-Esseen bound {b:.4f} skewness rule {2 / (6 * np.sqrt(2 * np.pi * n)):.4f}")
lab.row("n = 30, simulated (20,000 sums)", f"{ecdf_gap:.4f} (exact {exact[4]:.4f})")
assert np.all(exact <= bound), "Berry-Esseen is a guarantee at every n"
assert np.all(np.diff(exact) < 0), "the distance falls as n grows"
assert abs(exact[-1] / rule[-1] - 1) < 0.05, "for large n the distance is skewness / (6 sqrt(2 pi n))"
assert abs(ecdf_gap - exact[4]) < 0.02, "the simulation agrees with the exact law"
# 2. Where it stops: the mean of n Cauchy draws is Cauchy again, quartiles at -1 and +1 for every n.
cauchy = rng.standard_cauchy(size=(reps, 100))
normal = rng.standard_normal(size=(reps, 100))
q_c, q_n = {}, {}
for n in (1, 10, 100):
q_c[n] = np.diff(np.quantile(cauchy[:, :n].mean(1), [0.25, 0.75]))[0] / 2
q_n[n] = np.diff(np.quantile(normal[:, :n].mean(1), [0.25, 0.75]))[0] / 2
lab.row(f"half the interquartile range of the mean, n = {n}",
f"Cauchy {q_c[n]:.3f} (theory 1) normal {q_n[n]:.3f} (theory {0.6745 / np.sqrt(n):.3f})")
assert abs(q_c[n] - 1) < 0.08, "averaging Cauchy draws buys nothing"
assert abs(q_n[n] * np.sqrt(n) / 0.6745 - 1) < 0.08, "normal means shrink like 1/sqrt(n)"
lab.note = ("With a finite third moment the bell arrives at rate 1/sqrt(n), far inside the Berry-Esseen guarantee "
"and at the size the skewness predicts; with no mean at all, the average of a hundred draws is as "
"wild as one draw.")
fig, ax = labs.figure(2, size=(11, 4.2))
ax[0].loglog(ns, bound, color=labs.RED, label="Berry-Esseen bound")
ax[0].loglog(ns, exact, "o-", color=labs.PURPLE, label="exact sup|F_n - Phi|")
ax[0].loglog(ns, rule, "--", color=labs.MUTED, label="skewness / (6 sqrt(2 pi n))")
ax[0].plot([30], [ecdf_gap], "s", color=labs.GREEN, label="simulated, n = 30")
ax[0].set(title="Sums of n exponentials: distance from the normal", xlabel="n", ylabel="largest gap between the CDFs")
ax[0].legend()
steps = np.arange(1, 5001)
for i in range(5):
ax[1].plot(steps, np.cumsum(rng.standard_cauchy(5000)) / steps, color=labs.RED, lw=1, alpha=0.8,
label="Cauchy" if i == 0 else None)
ax[1].plot(steps, np.cumsum(rng.standard_normal(5000)) / steps, color=labs.BLUE, lw=1, alpha=0.8,
label="normal" if i == 0 else None)
ax[1].set(title="Running means of five sequences each", xlabel="number of draws", ylabel="mean so far",
xscale="log", ylim=(-6, 6))
ax[1].legend()
lab.fig = fig
return lab
Now change it
- Replace the exponential by a Bernoulli(0.1) sum (limits.bernoulli_sum_atoms, limits.kolmogorov_lattice). Does the distance still fall like 1/sqrt(n), and with what constant?
- Replace the Cauchy by a Pareto with tail index 1.5 (rng.pareto(1.5) + 1, mean 3). Do the quartiles of the mean shrink, and at what rate in n?
- Use the n = 30 sums to check the delta method: compare the simulated sd of log(mean) with 1/sqrt(30).
Problems, with solutions
Try each problem before opening its solution.
1. Markov, made tight. X ≥ 0 with E X = 1.
Solution
By Markov, P(X ≥ 3) ≤ E X / 3 = 1/3. Equality: let X = 3 with probability 1/3 and 0 otherwise. Then E X = 1 and P(X ≥ 3) = 1/3. In general, equality in Markov's inequality needs X to take only the values 0 and a.
2. A poll's sample size. P(|p̂ − p| ≥ 0.03) ≤ 0.05.
Solution
- Chebyshev: P ≤ p(1 − p)/(n ε²) ≤ 1/(4n · 0.0009). Setting this ≤ 0.05 gives n ≥ 5,556.
- Hoeffding: 2 exp(−2n · 0.0009) ≤ 0.05 gives n ≥ log(40)/0.0018, so n ≥ 2,050.
- Normal approximation: 1.96 · √(1/(4n)) ≤ 0.03 gives n ≥ 1,068, the familiar "a thousand voters, ±3 points".
The first two are guarantees; the third is an approximation, and a good one here, since np(1 − p) is large.
3. Binomial to Poisson by MGFs. Use moment generating functions to show that \(\mathrm{Binomial}(n, \lambda/n) \to \mathrm{Poisson}(\lambda)\) in distribution.
Solution
The MGF of Binomial(n, λ/n) is (1 − λ/n + (λ/n)e^t)^n = (1 + λ(e^t − 1)/n)^n. As n → ∞ this tends to exp(λ(e^t − 1)) for every t, using (1 + y/n)^n → e^y. That is the Poisson(λ) MGF, and by Curtiss's theorem the distributions converge.
4. The delta method for a rate. X_i ~ Exponential(rate λ).
Solution
E X = 1/λ and Var X = 1/λ², so √n(X̄ − 1/λ) → N(0, 1/λ²). With g(x) = 1/x, g'(1/λ) = −λ², and the delta method gives
√n(1/X̄ − λ) → N(0, λ⁴ · 1/λ²) = N(0, λ²).
So 1/X̄, which is the maximum-likelihood estimator of λ (Part 9), has standard error about λ/√n.
5. The maximum of uniforms. \(U_1, \dots, U_n\) are i.i.d. uniform on \((0, 1)\). Show \(n\,(1 - \max_i U_i) \to \mathrm{Exp}(1)\) in distribution.
Solution
For 0 ≤ x ≤ n,
P(n(1 − max U_i) > x) = P(max U_i < 1 − x/n) = (1 − x/n)^n → e^{−x}.
So the limit is Exp(1): the reversed Weibull family, with shape 1.
6. The t statistic, theorem by theorem. Assume i.i.d. observations with finite positive variance.
Solution
- CLT: Z_n = √n(X̄ − μ)/σ → N(0, 1) in distribution.
- Weak law, twice: X̄ → μ and (1/n)ΣX_i² → E X² in probability (E X² < ∞).
- Continuous mapping: S_n² = (n/(n − 1))((1/n)ΣX_i² − X̄²) → E X² − μ² = σ² in probability, since n/(n − 1) → 1. Continuous mapping again (x ↦ σ/√x, continuous at σ² > 0) gives σ/S_n → 1 in probability.
- Slutsky: T_n = Z_n · (σ/S_n) → N(0, 1) · 1 = N(0, 1).
The weak law for X² needs only its finite first moment E X², not E X⁴. No normality was used; i.i.d. sampling with finite, non-zero variance.
Notes and sources
Where it comes back
| Idea | Returns in |
|---|---|
| the weak law, consistency | 9, 22, 47 |
| the central limit theorem | 8, 10, 11, 43 |
| the speed of the CLT, Berry–Esseen | 16, 47 |
| the delta method | 9, 14, 18, 22 |
| Slutsky, continuous mapping | 9, 10, 47 |
| concentration, Hoeffding, the union bound | 51, 54, 58 |
| heavy tails, stable laws | 30, 60 |
| extreme values, return levels, profile likelihood | 22, 39, 40 |
Sources
- Galton's ox. F. Galton, "Vox populi", Nature 75 (1907), 450–451, and "The ballot-box", Nature 75 (1907), 509; K. F. Wallis, "Revisiting Francis Galton's forecasting competition", Statistical Science 29 (2014).
- The weak law. J. Bernoulli, Ars Conjectandi (1713), Part IV; I.-J. Bienaymé (1853); P. Chebyshev, "Des valeurs moyennes" (1867); E. Borel (1909) and A. Kolmogorov for the strong law.
- The central limit theorem.
- A. de Moivre, Approximatio ad summam terminorum binomii (1733).
- P.-S. Laplace (1810; Théorie analytique des probabilités, 1812).
- A. Lyapunov (1901); J. W. Lindeberg (1922); W. Feller (1935).
- G. Pólya, "Über den zentralen Grenzwertsatz…" (1920); J. Curtiss, Ann. Math. Statist. 13 (1942).
- H. Fischer, A History of the Central Limit Theorem (2011).
- Speed. A. Berry (1941); C.-G. Esseen (1942); I. Shevtsova (2011), C ≤ 0.4748.
- Combining limits. E. Slutsky, Metron 5 (1925); H. Mann & A. Wald, Ann. Math. Statist. 14 (1943).
- Heavy tails. P. Lévy, Calcul des probabilités (1925); B. Gnedenko & A. Kolmogorov, Limit Distributions for Sums of Independent Random Variables (1949; English 1954); B. Mandelbrot, "The variation of certain speculative prices" (1963).
- Concentration. H. Chernoff (1952); W. Hoeffding, JASA 58 (1963); H. Cramér (1938).
- Extremes.
- R. A. Fisher & L. Tippett, Proc. Camb. Phil. Soc. 24 (1928); B. Gnedenko, Ann. Math. 44 (1943).
- E. J. Gumbel, Statistics of Extremes (1958); S. Coles, An Introduction to Statistical Modeling of Extreme Values (2001), §3.4.1 for Port Pirie.
- D. van Dantzig, "Economic decision problems for flood prevention", Econometrica 24 (1956).
- Textbooks.
- J. Blitzstein & J. Hwang, Introduction to Probability (2nd ed., 2019), chs. 10–11.
- G. Grimmett & D. Stirzaker, Probability and Random Processes (4th ed., 2020), ch. 7.
- G. Casella & R. Berger, Statistical Inference (2nd ed., 2002), §5.5.
- A. W. van der Vaart, Asymptotic Statistics (1998), chs. 2–3.
- R. Vershynin, High-Dimensional Probability (2018), ch. 2.
About this partfrom its README
Part 6 of a sixty-five-part course in statistics, from a first course to a PhD (see the series plan and the syllabus), in Stage I, Bachelor's: Foundations. Part 5 put several variables together; this part asks what happens when we average many of them. It asks three questions: why does averaging work, how fast, and when does it fail?
It opens with Francis Galton's ox (1907). At a Plymouth fair, 787 legible guesses at the dressed weight of an ox had a median of 1,207 lb, against a true 1,198. From there the part builds:
- the inequalities that make averaging work: Markov, Chebyshev and Jensen;
- the weak law, with Bernoulli's 1713 urn;
- the kinds of convergence;
- the central limit theorem, seen by exact convolution and on a Galton board, then proved under an MGF-near-zero assumption, with the finite-variance characteristic-function extension stated;
- the normal approximation and the continuity correction;
- the speed of the CLT, which for the World's Pareto-tailed incomes is alarmingly slow;
- the delta method and Slutsky's theorem;
- Cauchy and stable laws, where averaging fails;
- Hoeffding's inequality and large deviations;
- the law of maxima, and with it floods and return levels.
Every number on screen is computed in compute.py. The ox, Bernoulli's urn and the Port Pirie sea
levels are the Museum's (museum.OX_*, museum.BERNOULLI, museum.PORTPIRIE); incomes and heights are the World's
(seed 1662); everything else is a seeded simulation or an exact calculation, and is tagged as such.
Built in this part: the Galton board (GaltonBoard in
explainer/stats/viz.py). Balls fall through rows of pegs, bouncing left or
right, and stack in bins:
drops(scene, bits)animates balls along their zig-zag paths, each landing on the current pile;bars(counts)draws the pile for when there are too many balls to animate;curve(f, scale)overlays a density in the same units.
Chapter notes
| # | Chapter | What it does | Numbers (computed) |
|---|---|---|---|
| 0 | Galton's ox | Vox populi (1907): the percentile table as an ogive, with a normal of Galton's probable error; a simulated crowd whose error falls like 75/√n until a shared bias stops it; the objectives. | median 1,207 vs 1,198 lb (+0.75%); quartiles 1,162 and 1,236; mean 1,197 |
| 1 | Markov, Chebyshev, Jensen | Markov by the step under the line; tested on the World's incomes; Chebyshev from Markov; the three-point law that attains it; Jensen by chords, with the World's geometric and arithmetic mean incomes. | at 3× mean: 2.3% vs bound 33%; 2σ: heights 3.5%, incomes 1.7% vs 25%; geometric mean 39.6k < 49.5k |
| 2 | The weak law | Chebyshev's three-line proof; 40 coin paths in the √n funnel; the count of extra heads wanders (no gambler's compensation); Bernoulli's golden theorem and his 25,550 against modern bounds. | Chebyshev 600,600; Bernoulli 25,550; Hoeffding 9,503; normal 6,498; exact 6,520 |
| 3 | Kinds of convergence | In probability, in distribution, almost surely; the mirror X_n = −X; the typewriter sequence; the strong law, seen in 2,000 sequences; the hierarchy. | outside 0.5 ± 0.02 after toss 10,000: 1 sequence in 2,000 |
| 4 | The CLT, seen | Exact convolution powers of a lopsided law on {0,…,5}; cumulants: skewness/√n, kurtosis/n; the Galton board; uniform, exponential and lopsided sums of 30. | sup|F_n − Φ|: 0.298 (n = 1) → 0.031 (n = 30) |
| 5 | The CLT, proved | M_Y(t/√n)^n; the cumulant expansion; Curtiss's continuity theorem; n log M(t/√n) → t²/2 drawn for the exponential and the lopsided law; Lindeberg–Lévy, Lyapunov, Lindeberg, Feller; Pólya's name. | — |
| 6 | Using it | De Moivre's 1733 pamphlet; the local approximation; the continuity correction; a rare-event binomial where the Poisson wins. | P(S = 50) 0.0796 vs 0.0798; P(S ≥ 60) 0.0284 exact, 0.0228 plain, 0.0287 corrected; p = 0.03: 0.081 exact, 0.071 normal, 0.084 Poisson |
| 7 | Is thirty enough? | Means of heights (normal at n = 5) and of incomes (skewed at n = 1,000); t-interval coverage; Berry–Esseen with Shevtsova's constant; the skewness/√n rule. | income coverage 87.4% (n = 5), 89.5% (30), 92.9% (1,000), misses almost all low; lognormal BE bound 0.219 vs actual 0.029 at n = 30 |
| 8 | The delta method | The tangent-line picture; the derivation; √ of a Poisson (variance → 1/4); arcsine of a share (1/4n); several means and ratios; log of a mean; second order and χ²₁. | Var √X 0.251 at λ = 64; sd(log x̄) 0.00782 predicted vs 0.00780 simulated |
| 9 | Slutsky and continuous mapping | The two theorems; consistency; the t statistic without normality; t for heights and incomes; why Slutsky needs a constant (X_n = Z, Y_n = −Z). | coverage: heights 94.6% (n = 10); incomes 86.8% (10), 91.4% (100) |
| 10 | When averages fail | Running means of normals and Cauchys; the Cauchy mean is Cauchy (characteristic functions); Pareto α = 1.5: the law holds, the CLT fails; stable laws and the generalized CLT. | quartiles of the Cauchy mean ≈ ±1.0 for n = 1, 10, 100 |
| 11 | Concentration | Hoeffding's inequality; its proof (Chernoff's trick, Hoeffding's lemma); against Chebyshev, the normal approximation and the exact tail; the union bound and log m; Cramér's large-deviation rate. | n = 1,000: exact 0.0014, Hoeffding 0.0135, Chebyshev 0.096; 10 → 10⁶ proportions: n = 1,199 → 3,501 |
| 12 | The law of maxima | F^n; max − log n → Gumbel, derived and simulated; the three families (Gumbel, Fréchet, reversed Weibull); the GEV and Fisher–Tippett–Gnedenko. | — |
| 13 | Floods and return levels | The 1953 North Sea flood and the Delta Committee; Port Pirie's 65 annual maxima; the GEV fit by maximum likelihood; return levels; the profile likelihood of the 100-year level; van Dantzig's economic dike height. | (μ, σ, ξ) = (3.875, 0.198, −0.050); z₁₀₀ = 4.69 m, 95% profile interval [4.49, 5.26]; z₁₀₀₀₀ = 5.34 m |
| 14 | Outro | Recap, payoffs, problems, references, the Transcript, Part 7's question. | — |
The displayed CDF distances check both sides of every jump, without a continuity correction. Monte Carlo CDF distances are empirical diagnostics. Histogram densities retain omitted tails in their denominators; path segments leave the viewport rather than flattening onto its edge.
The World is a finite population and has finite moments of every order. Its income-tail generator uses an unbounded Pareto model with index 2.1, which has finite variance but no third moment. These are separate laws: the finite World's Berry--Esseen bound is valid but trivial at the shown sample sizes. The lognormal reference population is a fixed simulation of two million values.
The CLT concerns central deviations; fixed tail probabilities require concentration or large-deviation arguments. Stable and extreme-value limits require non-degenerate limits and appropriate centring/scaling. Return levels and the approximate profile interval assume the fitted stationary annual-maxima model; they do not incorporate all uncertainty in dependence, climate changes or the tail family.
The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
- Hook: Galton's ox (1907). 787 tickets; median 1,207 lb against 1,198 lb.
- Inequalities. Markov by area; Chebyshev; Jensen by chords.
- The weak law. Chebyshev's proof; Bernoulli's golden theorem (1713) and his 25,550 trials vs modern bounds.
- Convergence, informally. In probability vs in distribution; why "almost surely" needs Part 43.
- The CLT, seen. Convolution powers of a lopsided law; Built: the Galton board.
- The CLT, proved by MGFs. Taylor expansion of log M(t/√n); the limit e^{t²/2}; what the proof assumed (an MGF), flagged on the upgrade card for Part 43.
- Using it. The normal approximation and continuity correction; the de Moivre–Laplace theorem.
- "n ≥ 30", tested. The CLT's speed for skewed incomes, measured; Berry–Esseen, stated.
- The delta method. Derived; variance-stabilizing transforms (Part 1) explained.
- Slutsky and continuous mapping, stated and used.
- When averages fail. Cauchy running means never settle (computed); stable laws, previewed.
- Concentration, first look. Hoeffding's inequality, stated and checked against simulation.
- Maxima. The three extreme-value families; return levels; the 1953 flood and the Delta Works (van Dantzig 1956).
- Outro. The upgrade cards Part 43 will answer.
Build the film
python -m videos.stats.stats6.compute # the part's numbers, into .cache/stats6
python tools/build.py stats6 # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py stats6 Hook # one chapter, silent, with a contact sheet
Scenes: videos/stats/stats6. Setup: see the course page. Source of these notes: the README and the scenes' narration.
Build it
python -m videos.stats.stats6.compute # once: every computed item (seconds; cached in .cache/stats6)
python tools/build.py stats6 -q l # fast 480p preview
python tools/build.py stats6 # 1080p30 -> renders/stats6.mp4
python tools/qa_scene.py stats6 CLTSeen # one chapter, silent, with a contact sheet
python tools/lecture_length.py stats6 --floor 50