Confidence Interval Lab
Sketch any population, draw samples from it, and watch the sample mean, the sample variance and the 95% confidence interval settle down. Then repeat the experiment many times to see the sample means become normal and about 95% of the intervals catch the true mean.
How it works and what to try
How it works: In three steps. (1) Sketch a population density; its true mean μ and variance σ² are computed exactly. (2) Draw one run of n samples and watch X̄n, Sn² and the t-interval settle as samples arrive, with the interval narrowing like 1/√n. (3) Repeat for hundreds or thousands of runs: the sample means pile up as N(μ, σ²/n), and about 95% of the intervals contain μ.
Try this: Use a skewed population with small n (say 5) and see coverage fall short of 95%; then increase n and watch it recover. Compare a bimodal population with a uniform one: the histogram of means looks normal either way.
STEP 1The population
Drag across the plot to sketch a density on [a, b]. The page computes its true mean μ and variance σ² exactly and samples from it by inverting its CDF. Changing the shape clears all runs.
STEP 2One run of n samples
STEP 3Many runs
Each run draws n fresh samples and keeps only its mean X̄n and its 95% interval. By the central limit theorem the means pile up as N(μ, σ²/n), whatever the population looks like, and roughly 95% of the intervals contain μ. Each completed run from step 2 is added here too.
With a small n and a skewed population, coverage tends to fall a little short of 95%: the t interval is exact only for normal data, and the approximation improves as n grows.