Tool

CLT simulator

Choose a population, the size n of each sample and how many samples to draw. Each sample's values drop out of the population, their mean falls into the histogram below, and the histogram builds up against the normal curve the central limit theorem predicts, N(μ, σ/√n). The axis never changes, so a larger n visibly narrows the histogram.

Goes with chapter 10. Sampling distributions and the CLT

Population

Every value from 0 to 10 equally likely: no peak at all.

n = 5

Sample size n

Number of samples

Run number 1
Playback speed

  • Population
  • One sample's values
  • Its mean
  • Histogram of the sample means
  • N(μ, σ/√n)

After 500 samples of n = 5, the means average 5.0446, and their standard deviation, the observed standard error, is 1.2637; the CLT predicts σ/√n = 1.2910.

Predicted and observed

Quantity Predicted by the theory Observed in this run
Mean of the sample meansμ = 5.00005.0446
Standard errorσ/√n = 1.29101.2637
Skewness of the sample meansγ/√n = 0.00000.0702
Share within 1.96 standard errors of μ0.95000.9620
σ = 2.8868 is the population's standard deviation and γ its skewness. The observed figures move from run to run; the predicted ones do not.

rng.uniform(0, 10, size=(500, 5)).mean(axis=1)

What to look for

  • Choose the exponential and move n from 1 to 50. At n = 1 the histogram is the population itself, skewed to the right; by n = 30 it is close to the bell, though its right tail is still a little longer than the curve's.
  • Keep the population and watch the width: the axis is fixed, so as n grows the histogram narrows. The observed standard error follows σ/√n: quadruple n and it halves.
  • Choose the normal and set n = 2: the means are already a perfect bell, because the mean of normal values is exactly normal.
  • Choose the bimodal: hardly any single value lies near its mean of 5, yet by n = 10 the sample means pile up right there.
  • Change the number of samples, not n: 100 samples give a ragged histogram and 2,000 a smooth one, but its width stays the same. n is the knob the theorem is about.
An unhandled error has occurred. Reload 🗙

Reconnecting…

Your connection to Introduction to Probability Lab dropped, probably a Wi-Fi blip. Hold on while it reconnects.

The connection could not be restored. The page will reload in a few seconds.