Law of Large Numbers

One simulation: random draws (with replacement) from a fixed population; the line is the cumulative sample mean after each draw. The horizontal dashed line is μ (population mean). The shaded band is the 95% CI for μ (two-sided p = 0.05) at each n, from the same draws: x̄n ± tn−1 · sn/√n, where sn is the sample SD of the first n draws.

What this chart is showing

Imagine a fixed pool of birth weights (our population). Each step we pick one weight at random, put it back, and pick again—so every draw is independent and the same population stays in play. After n draws, the black curve plots the running average of those weights: n = (sum of first n draws) / n. That is the sample mean so far, not the true mean of the pool.

The red dashed line is μ, the actual average of the whole population (all weights in the dataset). The law of large numbers says that as n grows, x̄n tends to settle down toward μ: early on the black line can swing a lot; with many draws it hugs the red line more closely.

The shaded band is not a “margin around μ.” At each n it is a 95% confidence interval for μ using only the first n draws: we compute their mean x̄n, their sample standard deviation sn, and plot x̄n ± t · sn/√n (two-sided p = 0.05). So the band is always centered on the black curve by construction. It answers: “How uncertain is our estimate of μ if we had only seen these n babies?” With small n, that uncertainty is large (wide band); as n increases, the interval typically narrows because we have more information.

Click New simulation to redraw the random sample. The red μ line and the population do not change; only the path and the band do, because they come from one new realization of the random draws.

Population: MASS birthwt (public; birth weights in kg from grams). Rebuild with python3 scripts/generate_birth_weights.py. Host on GitHub Pages from repo root.