Unit 5, lesson 31

The Law of Large Numbers

What the law of large numbers says about sample averages of independent and identically distributed observations, what convergence in probability means, how Chebyshev's inequality proves it, and why the gambler's fallacy fails.

  • Video 31
  • Sampling Distributions

Toss a fair coin again and again, independently, and keep track of the proportion of heads. After 10 tosses it might be 0.7, after 100 tosses 0.46 and after 1000 tosses 0.508. The running proportion wanders and sometimes moves away from 0.5, yet over long runs it is very likely to be close to 0.5. This lesson states precisely what that settling means, which assumptions produce it, and what it does not promise about streaks, biased measurements or the shape of a distribution.

Key terms

Independent and identically distributed

Definition Random variables X1,…,XnX_1, \dots, X_n are independent if, for any choice of events, one about each variable, the probability that all of them happen equals the product of their separate probabilities. An infinite sequence X1,X2,…X_1, X_2, \dots is independent if every finite group of its variables is. The variables are identically distributed if they all have the same probability distribution. Together these conditions are abbreviated iid. For iid discrete observations, the conditional probability of any value for a new observation, given earlier values that have positive probability, equals its unconditional probability.

In plain words Each new observation is a fresh draw from the same probability model. The earlier outcomes neither change the model nor carry information about the next outcome.

Example Random draws with replacement from a fixed population are iid, each with the population distribution. So are the success indicators of independent trials with a common success probability pp, each Bernoulli⁡(p)\operatorname{Bernoulli}(p). Draws without replacement from a population of distinct cards are identically distributed but not independent, since the second card cannot repeat the first. A data file in which one trial’s outcome has been copied into every row is identically distributed too, but completely dependent. Readings from an instrument whose calibration drifts over time are not identically distributed.

Convergence in probability

Definition A sequence of random variables Y1,Y2,…Y_1, Y_2, \dots converges in probability to a constant cc if, for every ε>0\varepsilon > 0,

lim⁡n→∞P(∣Yn−c∣≥ε)=0.\lim_{n \to \infty} P\bigl(\lvert Y_n - c \rvert \ge \varepsilon\bigr) = 0 .

The number ε\varepsilon is a tolerance fixed before nn grows, and the condition must hold for every positive tolerance, however small.

In plain words Choose any margin around the target. Far enough along the sequence, the probability of landing outside that margin is as small as you like. A smaller margin can require going much farther along. The definition does not say that a realized sequence of values moves steadily closer to cc, and it does not promise that any particular YnY_n equals cc.

Example Let YnY_n equal 11 with probability 1/n1/n and 00 otherwise. For a tolerance with 0<ε≤10 < \varepsilon \le 1, the probability P(∣Yn∣≥ε)P(\lvert Y_n \rvert \ge \varepsilon) equals 1/n1/n, which tends to 00, and for ε>1\varepsilon > 1 it is 00. So YnY_n converges in probability to 00. Yet the value 11 keeps a positive probability at every nn, so the convergence is a statement about probabilities, not a guarantee for a particular nn.

Chebyshev’s inequality

Definition If a random variable YY has mean μY\mu_Y and finite variance σY2\sigma_Y^2, then for every ε>0\varepsilon > 0

P(∣Y−μY∣≥ε)≤σY2ε2.P\bigl(\lvert Y - \mu_Y \rvert \ge \varepsilon\bigr) \le \frac{\sigma_Y^2}{\varepsilon^2} .

It holds for every distribution with a finite variance, with no assumption about shape. For the mean Xˉn\bar{X}_n of nn iid observations with mean μ\mu and variance σ2\sigma^2, the variance of Xˉn\bar{X}_n is σ2/n\sigma^2/n, so

P(∣Xˉn−μ∣≥ε)≤σ2nε2.P\bigl(\lvert \bar{X}_n - \mu \rvert \ge \varepsilon\bigr) \le \frac{\sigma^2}{n\varepsilon^2} .

In plain words A random quantity with a small variance is unlikely to land far from its mean. The bound is often much larger than the true probability, but it needs nothing about the distribution beyond its variance.

Example For independent trials with success probability 0.40.4, coded as ones and zeros, each indicator has variance 0.4⋅0.6=0.240.4 \cdot 0.6 = 0.24. With tolerance ε=0.2\varepsilon = 0.2 the bound for the sample proportion is

0.24n⋅0.04=6n,\frac{0.24}{n \cdot 0.04} = \frac{6}{n} ,

which is 0.240.24 at n=25n = 25 and 0.060.06 at n=100n = 100. At n=4n = 4 the bound is 1.51.5, which is true but says nothing, since every probability is at most 11.

Law of large numbers

Definition Let X1,X2,…X_1, X_2, \dots be independent and identically distributed with mean μ\mu and finite variance σ2\sigma^2, and let Xˉn\bar{X}_n be the mean of the first nn of them. The weak law of large numbers says that Xˉn\bar{X}_n converges in probability to μ\mu. That is, for every ε>0\varepsilon > 0,

lim⁡n→∞P(∣Xˉn−μ∣≥ε)=0.\lim_{n \to \infty} P\bigl(\lvert \bar{X}_n - \mu \rvert \ge \varepsilon\bigr) = 0 .

The proof applies Chebyshev’s inequality to Xˉn\bar{X}_n, whose bound σ2/(nε2)\sigma^2/(n\varepsilon^2) tends to 00 for each fixed ε>0\varepsilon > 0. These conditions are sufficient, not necessary. For iid observations a finite mean is already enough, and other versions allow some dependence or observations that are not identically distributed. In the language of estimation, the sample mean is a consistent estimator of μ\mu.

In plain words Under these conditions, a large enough sample makes it very likely that the average lies within any chosen tolerance of the expectation. The law does not say that the average improves with every new observation, it does not promise that the average equals μ\mu at any finite nn, and it says nothing about the shape of the distribution of Xˉn\bar{X}_n, which is the subject of the central limit theorem. The target is the expectation of the values actually recorded, so a biased measurement or selection process makes the average settle near the wrong value.

Example For the independent trials with success probability 0.40.4 and tolerance 0.20.2, let XX be the number of successes. With n=25n = 25 the event ∣p^−0.4∣≥0.2\lvert \hat{p} - 0.4 \rvert \ge 0.2 means X≤5X \le 5 or X≥15X \ge 15, and its exact binomial probability is about 0.06380.0638. With n=100n = 100 it means X≤20X \le 20 or X≥60X \ge 60, with probability about 0.00005890.0000589. Both lie well below the Chebyshev bounds 0.240.24 and 0.060.06. These finite calculations illustrate the law, but no list of finite cases proves it.

Gambler’s fallacy

Definition The gambler’s fallacy is the mistaken belief that, in independent trials, a run of one outcome makes the other outcome more likely on the next trial, as if the sequence had to even out. For independent trials with success probability pp, the conditional probability of success on the next trial, given any possible earlier results, is still pp. The law of large numbers works by dilution, not compensation. An early surplus of successes keeps the same expected size, while it becomes a smaller and smaller fraction of the growing total.

In plain words Independent trials have no memory. A streak does not create a debt that later outcomes must repay, and the average settles because the many ordinary outcomes that follow outweigh the early ones.

Example Suppose the first 1010 independent trials with success probability 0.40.4 give 88 successes, four more than the expected 44. The next trial still succeeds with probability 0.40.4. After 100100 further trials the expected number of successes is 8+40=488 + 40 = 48 out of 110110, a proportion of about 0.4360.436. After 10001000 further trials it is 408408 out of 10101010, about 0.4040.404. In both cases the expected surplus over 0.40.4 times the total is still 44, so the expected proportion approaches 0.40.4 because the total grows, not because later trials fall short.

Check yourself

  1. A fair coin is tossed independently nn times. Use Chebyshev’s inequality to bound the probability that the proportion of heads differs from 0.50.5 by at least 0.10.1. How large must nn be for the bound to be at most 0.010.01? At n=100n = 100 the exact probability is about 0.05690.0569. How does the bound compare?
Show the answer

Each toss has variance 0.5⋅0.5=0.250.5 \cdot 0.5 = 0.25, so the bound is

0.25n⋅0.01=25n.\frac{0.25}{n \cdot 0.01} = \frac{25}{n} .

It is at most 0.010.01 when n≥2500n \ge 2500. At n=100n = 100 the bound is 0.250.25, more than four times the exact probability 0.05690.0569. The bound is valid but loose, which is typical, since it uses nothing about the distribution except its variance.

  1. A fair coin has landed heads seven times in a row in independent tosses. A friend says tails is now more likely, because the law of large numbers has to balance the heads out. What is the probability of tails on the next toss, and what is the expected proportion of heads after 993993 further tosses?
Show the answer

The next toss is independent of the first seven, so tails has probability 0.50.5. The friend is committing the gambler’s fallacy.

After 993993 further tosses the expected number of heads is 7+496.5=503.57 + 496.5 = 503.5 out of 10001000, a proportion of 0.50350.5035. The expected surplus of 3.53.5 heads over half the total is never repaid. It simply becomes a small fraction of a large total.

  1. A thermometer adds a fixed 0.30.3 degrees to every reading, and apart from that its readings have independent, identically distributed random errors with mean 00 and standard deviation 0.20.2 degrees. The true temperature TT does not change. Does the average of 10,00010{,}000 readings get close to TT?
Show the answer

The readings are iid with mean T+0.3T + 0.3 and variance 0.040.04, so the law of large numbers makes the average converge in probability to T+0.3T + 0.3, not to TT. Chebyshev’s inequality with ε=0.01\varepsilon = 0.01 gives

0.0410,000⋅0.0001=0.04,\frac{0.04}{10{,}000 \cdot 0.0001} = 0.04 ,

so with probability at least 0.960.96 the average lies within 0.010.01 degrees of T+0.3T + 0.3, and therefore more than 0.290.29 degrees above TT. More readings make the average more precise around the wrong value. Removing the bias needs calibration, not more data.

How this lesson connects