i.i.d. samples#
The most important assumption in classical statistics: independent and identically distributed (i.i.d.). A sequence is i.i.d. if:
- Identically distributed: each has the same CDF/PMF/PDF, so they are draws from the same population.
- Independent: knowing tells you nothing about .
Think of repeatedly rolling the same die, or drawing with replacement from a population. The i.i.d. assumption makes the sample mean a simple, well-behaved statistic.
Why it matters: both the Law of Large Numbers and the Central Limit Theorem require i.i.d. (or at least weak dependence + identical marginals). When data are dependent (time series, spatial data, within-subject repeats), the standard formulas underestimate uncertainty.
Law of large numbers#
The Weak Law of Large Numbers (LLN): as , the sample mean converges in probability to the true mean :
In plain language: with enough samples, the sample average is almost certainly close to the population mean. The probability of a deviation larger than any fixed shrinks to zero.
Why convergence in probability, not convergence of the sequence? The are random: each repetition of the experiment gives a different path. The LLN says that the probability of being far from vanishes; it does not say that a particular realised sequence must converge. (The Strong Law does, but we use the Weak Law here as it is sufficient for our purposes.)
Monte Carlo integration is a direct application: to estimate , sample and compute . The LLN guarantees this converges to the true expectation. This is how many Bayesian computations and reinforcement learning value estimates work.
Worked example: coin flips. Flip a fair coin times; let for heads, 0 for tails. . The sample proportion of heads converges to 0.5:
- : might be anywhere from 0.2 to 0.8.
- : usually within 0.4–0.6.
- : almost always within 0.49–0.51.
The LLN tells us that concentration happens, but not how fast. That is the role of the CLT and variance formulas.
Central limit theorem#
The law of large numbers says the sample mean converges to the true mean; the central limit theorem says more: the fluctuations around it become Gaussian, with width shrinking like . That is where confidence intervals and MLE asymptotics come from.
The Central Limit Theorem (CLT) is deeper: it describes the shape of the sampling distribution of the mean. For i.i.d. with mean and finite variance :
"" means convergence in distribution: the CDF of the standardised mean approaches the standard normal CDF.
What the CLT says:
- The sample mean is approximately .
- The approximation improves as grows.
- The original distribution of can be anything (discrete, skewed, bounded, multimodal): as long as the variance is finite, sums become Gaussian.
- The rate of convergence is roughly (Berry–Esseen theorem).
CLT in practice: standard error. The standard deviation of is , called the standard error. It shrinks at rate , so to halve your error, you need four times as many samples.
Worked example: exponential population. . Then , . For , the standard error is . So is approximately . About 95% of sample means will fall in , or .
Notice that the original exponential data is far from normal: it is skewed right, with a sharp peak at 0. Yet the distribution of the mean of 100 such observations is nearly bell-shaped. That is the CLT's power.
Sampling distribution of the mean#
The sampling distribution of a statistic is the distribution of that statistic over repeated samples of size from the same population.
For the sample mean:
- Mean of sampling distribution: (unbiased).
- Variance of sampling distribution: (shrinks with ).
- Shape: approximately normal for large (CLT), exactly normal for any if the are themselves normal.
Degrees-of-freedom intuition: why ? When we average independent observations, their individual fluctuations partly cancel. The variance of a sum of independent variables is the sum of variances: . Dividing by gives .
Limitations#
The CLT is powerful but not magical. It fails or misleads in important cases:
- Heavy tails (infinite variance): If (e.g., Cauchy distribution), the CLT does not apply. Sums of Cauchy variables remain Cauchy, not Gaussian, so the sample mean never concentrates.
- Small with skewed data: For , the sampling distribution of the mean from an exponential population is still noticeably skewed. The guarantee does not say what happens at .
- Dependence: If are not independent (e.g., stock returns on consecutive days), the standard error is wrong (usually an underestimate). Time series methods (autocorrelation, block bootstrap) are needed.
- Extreme quantiles: The CLT describes the centre of the distribution, not the tails. For a 99.9% VaR calculation, normality of the mean is insufficient, since tail behaviour depends on the original distribution's tail.
The pragmatic rule: for "nice" distributions (finite variance, not pathologically skewed) with , the normal approximation is usually adequate for central intervals. For confidence intervals on the mean, the CLT is the workhorse, but always check your data's tail behaviour before trusting extreme quantiles.
If X_i are i.i.d. with variance σ² = 9, what is the variance of the sample mean of n = 36 observations?
Knowledge check#
Which theorem ensures that the sample mean approaches the population mean as n → ∞?
Browser lab#
Show the LLN (running mean vs n) and CLT (histogram of many sample means) for uniform and exponential populations.
import numpy as np
import matplotlib.pyplot as plt
rng = np.random.default_rng(42)
pop_size = 5000
n_means = 2000
fig, axes = plt.subplots(2, 3, figsize=(14, 8))
for row, (dist_name, dist_fn, mu_true, sigma_true) in enumerate([
("Uniform(2, 6)", lambda sz: rng.uniform(2, 6, size=sz), 4.0, np.sqrt(16/12)),
("Exponential(λ=1)", lambda sz: rng.exponential(1, size=sz), 1.0, 1.0),
]):
# LLN: single long sequence
samples = dist_fn(pop_size)
running_mean = np.cumsum(samples) / np.arange(1, pop_size + 1)
ax = axes[row, 0]
ax.plot(running_mean, linewidth=0.8)
ax.axhline(mu_true, color="tab:red", linestyle="--", label=f"μ = {mu_true}")
ax.set_xscale("log"); ax.set_xlabel("n (log scale)")
ax.set_ylabel("Running mean")
ax.set_title(f"LLN — {dist_name}")
ax.legend()
# CLT: many sample means for a fixed n
for col_idx, n in enumerate([5, 30]):
means = np.array([dist_fn(n).mean() for _ in range(n_means)])
ax = axes[row, 1 + col_idx]
ax.hist(means, bins=50, density=True, alpha=0.7)
x_grid = np.linspace(means.min(), means.max(), 200)
se = sigma_true / np.sqrt(n)
normal_approx = (1/(np.sqrt(2*np.pi)*se)) * np.exp(-0.5*((x_grid - mu_true)/se)**2)
ax.plot(x_grid, normal_approx, "tab:red", linewidth=2, label="CLT approx")
ax.set_title(f"CLT — n={n}, {dist_name}")
ax.set_xlabel("Sample mean"); ax.legend()
plt.tight_layout()
plt.show()
print("LLN + CLT demo complete.")
print("Uniform: μ=4.0, σ/√30 ≈ {:.3f}".format(np.sqrt(16/12)/np.sqrt(30)))
print("Exponential: μ=1.0, σ/√30 ≈ {:.3f}".format(1.0/np.sqrt(30)))
print("Notice: the standardised sample means converge to σ/√30 ≈ 0.211 (uniform) and 0.183 (exponential), whatever the shape of the underlying draws.")
Key takeaways#
- The i.i.d. assumption (identical distribution and independence) is what makes the sample mean well-behaved. Dependence breaks the standard error formulas.
- The weak law of large numbers says the sample mean converges in probability to the true mean. This is what licenses Monte Carlo estimation of expectations.
- The central limit theorem says the standardised sample mean converges in distribution to a standard normal, whatever the shape of the population, as long as the variance is finite.
- The standard error is , so halving the error requires four times the data.
- The CLT fails for infinite-variance distributions, is unreliable at small with skewed data, and says nothing about the tails.
- For central intervals with around 30 or more and finite variance, the normal approximation is usually adequate; check the tails before trusting extreme quantiles.
Further reading#
- Joseph K. Blitzstein & Jessica Hwang, Introduction to Probability (2nd ed., CRC Press, 2019): the law of large numbers and central limit theorem with simulation-based intuition.
- Larry Wasserman, All of Statistics (Springer, 2004): Chapter 5 covers convergence in probability and distribution.
- George Casella & Roger L. Berger, Statistical Inference (2nd ed., Duxbury, 2002): the limit-theorem chapter with full proofs.
Reading is free. PDF and ePub unlock with the newsletter. Join once and every lesson opens in this browser.