Contents/ Part VII · Probability Distributions/ Chapter 41

Sampling Distributions & the Central Limit Theorem

A sample mean is not a fixed fact, it is a random variable with its own distribution. Understanding that distribution, and the remarkable theorem that makes it normal, is what turns a single sample into a confident statement about the world.

⏱️ ~16 min read
🐍 Notebook included
📊 Chapter 41

Every statistic you compute, a sample mean, a proportion, a difference, comes from one sample out of countless possible ones. Draw a different sample and you would get a slightly different number. The pattern in those differences is the single most important idea in statistics.

The sampling distribution of a statistic is the distribution of its values across all possible samples. The Central Limit Theorem says the sampling distribution of the mean becomes normal as the sample size grows, whatever the population's shape.
🎯
Statistic vs parameter

A parameter (like the true mean μ) is a fixed but usually unknown property of the whole population. A statistic (like the sample mean x̄) is computed from data and varies from sample to sample. Inference is the art of using the varying statistic to pin down the fixed parameter, and the sampling distribution is what makes it possible.

1

The Sampling Distribution of the Mean

Imagine drawing many samples of the same size, computing each one's mean, and collecting all those means. They form their own distribution, tighter than the population and centered on the true mean.

A skewed population, but a tight, symmetric distribution of means population (one draw at a time) means of samples (n = 30) same center μ

In the notebook, a heavily skewed population with mean 2 produces sample means that cluster in a tight bell, also centered on 2, with a spread of just 0.365. The means vary far less than individual values, which is the whole reason a sample can tell you something reliable about a population.

2

The Central Limit Theorem

Here is the theorem that holds statistics together. No matter how strange the population's shape, the sampling distribution of the mean approaches a normal distribution as the sample size n grows.

As n grows, the distribution of means becomes normal n = 1 n = 5 n = 30 normal

By n = 30 the means of a moderately skewed population already trace a clean bell, the familiar n ≥ 30 rule of thumb. Treat it as a floor, not a guarantee: genuinely heavy-tailed or extremely skewed populations need more, sometimes n in the hundreds, before the bell is tight. Still, the pull toward normality is relentless, which is why the normal distribution is so ubiquitous: anything that is effectively an average of many small influences ends up normal. It is also the license that lets statistical inference assume normality almost everywhere, even when the raw data is anything but.

3

The Standard Error and the √n Law

The spread of the sampling distribution has a name: the standard error. For the mean it is SE = σ/√n. The square root is the catch: precision improves only with the root of the sample size.

SE = σ/√n: steep gains early, diminishing returns later SE sample size n → n=50 n=200 n=800

To halve the standard error you must quadruple the sample (25 to 100 to 400 each halves it). This diminishing return is the central economics of data: early data is enormously valuable, but past a point, "just collect more" stops paying off. The same √n law governs how fast Monte Carlo estimates and poll margins shrink.

4

The Bridge to Inference

Put the pieces together. The CLT says the sample mean is approximately normal; the standard error says how wide; and the empirical rule (see The Normal Distribution in Depth) says 95% of a normal sits within ±1.96 standard deviations. Combine them and a single sample yields a margin of error.

🧮
The 95% confidence interval

x̄ ± 1.96 × SE

Because the sample mean is normal with spread SE, this interval captures the true mean about 95% of the time. In the notebook, 20,000 simulated intervals contained the true mean 95.3% of the time, matching the theory. This is the template for nearly every confidence interval and hypothesis test in the chapters ahead.

That is the payoff of this Part: the leap from "here is my one sample" to "here is what I can responsibly claim about the world, and how sure I am". The Central Limit Theorem is the plank that bridges probability and inference.

5

Sampling & the CLT in Machine Learning & AI

The sampling distribution is not a statistics-class abstraction; it runs quietly inside the training loop and every reported metric. Whenever a machine-learning quantity is an average, the CLT and the standard error describe its noise.

Idea (this chapter)In ML / AI it appears asConcrete example
Mean of a sampleThe mini-batch gradientan average of per-example gradients, so a sample mean
Standard error σ/√nGradient noise vs batch sizebigger batches give smoother updates (noise ∝ 1/√batch)
Sampling distributionUncertainty in a reported metricaccuracy 0.92 on 2,000 examples is really 0.92 ± 0.012
CLT averagingEnsembles and baggingaveraging many models reduces variance
√n diminishing returnsThe economics of more dataquadrupling data only halves the error
🤖
Why this matters for AI research

A mini-batch gradient is the average of per-example gradients, which makes it a sample mean with standard error σ/√(batch size). That single fact explains why larger batches give smoother, less noisy updates, and why the extra noise of small batches can actually aid generalization. The same logic makes ensembles work: averaging many models is averaging many estimates, so by the CLT their combined variance drops. And it forces honesty about evaluation: a test accuracy is itself a sample statistic, so "92%" without a margin of error is an incomplete claim, the SE tells you whether a 1% improvement is real or just sampling noise. The sampling distribution is the difference between a result and a reliable result.

🐍

Watch the CLT happen in Python

The companion notebook builds the sampling distribution of the mean from a skewed population, animates the Central Limit Theorem across n = 1, 2, 5, 30, measures the standard error and its √n law, verifies that 95% confidence intervals capture the true mean 95% of the time, and shows the very same math governing mini-batch gradient noise and a reported accuracy's margin of error.

📓 View Notebook (code & outputs) ▶ Open in Colab ⬇ View / Download on GitHub

View opens the rendered notebook instantly (no setup). Open in Colab runs & edits it live in your browser. To run locally, install numpy and matplotlib and launch jupyter notebook.

🎓 Key Takeaways

  • A statistic is random: the sampling distribution is how a statistic (like x̄) varies across samples; a parameter is fixed.
  • The Central Limit Theorem: the sampling distribution of the mean becomes normal as n grows, whatever the population's shape.
  • Standard error SE = σ/√n is the spread of the sample mean; halving it takes 4× the data.
  • The 95% interval x̄ ± 1.96 × SE captures the true mean about 95% of the time, the template for inference.
  • In ML/AI: mini-batch gradients, ensemble variance, and a metric's margin of error are all sampling-distribution phenomena.
6

Practice Challenges

Five short challenges, beginner to intermediate. Try them on paper or with SciPy before checking the solutions.

1

Standard error

A population has standard deviation 20. Find the standard error of the sample mean for n = 100 and n = 400.

Hint: SE = σ/√n.
2

CLT in action

Daily sales have mean 500 and sd 120 (skewed). For a sample of 36 days, find P(sample mean > 540).

Hint: the mean is approximately normal with SE = 120/√36 = 20; then use z.
3

The √n law

Your sample gives a standard error of 4 and you want to cut it to 1. By what factor must the sample size grow?

Hint: SE ∝ 1/√n, so dividing SE by 4 needs n × 4².
4

Confidence interval

A sample of 64 has mean 50 and population sd 16. Build an approximate 95% confidence interval for the true mean.

Hint: x̄ ± 1.96 × SE, with SE = 16/√64.
5

A poll's margin

A poll of 1,000 finds 60% support. Find the standard error of the proportion and the 95% margin of error.

Hint: SE = √(p(1−p)/n); margin = 1.96 × SE.
Check your work

A fully-worked solutions notebook walks through all five challenges, each verified in code. Try them yourself first, then compare.

📓 View Solutions ▶ Open Solutions in Colab ⬇ View / Download on GitHub
7

Quiz: Test Yourself

Eight quick questions on sampling distributions and the CLT. Answer them, hit Check Answers, and keep refining until you score 100%. Your progress is saved, so you can hop back to the chapter and return anytime.