Statistics · easy

What is the law of large numbers, and how is it different from the Central Limit Theorem?

Asked in Data Scientist interviews, in the Statistics round.

Short answer

The law of large numbers says the sample mean converges to the true mean as n grows. The CLT says how it gets there: the sampling distribution of the mean becomes normal with spread sigma over root n.

Law of large numbersCentral Limit Theorem
SaysThe sample mean converges to the true meanThe sample mean is normally distributed
AboutWhere the estimate goesThe shape and spread around it
Gives youConfidence the estimate is not biasedA standard error, so intervals and tests
NeedsA finite meanFinite variance and enough samples
Without itYou could not trust any averageYou could not put an interval on one
One says where the average lands. The other says what its distribution looks like.

How to answer it

Definition

Two different promises about the sample mean. The law of large numbers says where it ends up. The central limit theorem says what its distribution looks like along the way. The table above compares them.

Formula

LLN:   sample mean  ->  mu                            as n grows

CLT:   sample mean  ~  Normal(mu, sigma / sqrt(n))    for large n

Example

import numpy as np
rng = np.random.default_rng(0)

# LLN: one growing sample, watch the mean settle
for n in [10, 100, 10_000, 1_000_000]:
    print(n, round(rng.exponential(50, n).mean(), 2))

# CLT: many samples of fixed size, look at the SHAPE of their means
means = [rng.exponential(50, 200).mean() for _ in range(5000)]

Output

10       61.44
100      46.82
10000    50.31
1000000  49.98        <- LLN: converging on 50

means: bell shaped, centred 50, sd ~= 50/sqrt(200) = 3.54   <- CLT

Why both are needed

The LLN alone tells you the estimate is going to the right place, but not how far off it is today. Without the CLT there is no standard error, so no confidence interval and no test. The LLN justifies averaging at all; the CLT is what lets you quantify the uncertainty of the average.

Key points

FAQ

The 30-second answer

They answer different questions about the same quantity. The law of large numbers says the sample mean converges to the true mean as the sample grows, so averaging is worth doing at all. The central limit theorem says the distribution of that sample mean is approximately normal, centred on the true mean with a standard deviation of sigma over root n.
So one tells me where the estimate lands and the other tells me how far off it is likely to be right now. Without the central limit theorem I would have no standard error, and so no confidence interval and no test.
The requirements differ too: the law of large numbers just needs a finite mean, while the central limit theorem needs finite variance as well.

In the interview

Practice this for real