Privacy note: We capture your IP address to provide customised and focused services. See our Privacy Policy.

Data Science & Statistics with Python — Alpha School

Lesson 9: Sampling and the Central Limit Idea

You rarely get to measure a whole population. Instead you take a sample — a smaller group drawn from it — and use the sample to say something about the whole. That leap, from the few to the many, is the heart of statistics, and it only works if the sample is like the population it came from. A sample of volunteers, of the easiest people to reach, or of the loudest voices will mislead you, however large it is. A random sample, where every member of the population has the same chance of being picked, is the gold standard, because randomness is the only selection method that does not favour anyone.

Even a good random sample is not the population. Its average will differ from the population's average by a little, just by chance, and that difference is called sampling error. The bigger the sample, the smaller the error tends to be — but the improvement slows down: quadrupling the sample only halves the error. That is why surveys of a few thousand people can describe a country of millions quite well, and why a survey of twenty people cannot, however carefully chosen.

The Central Limit Idea

Here is the most useful idea in statistics. Take many random samples from a population, compute the average of each sample, and look at the distribution of those averages. However strange the population's own distribution — skewed, lumpy, two-peaked — the distribution of the sample averages will look roughly normal, like a bell curve, provided the samples are large enough. That is the central limit idea, and it is what makes inference possible: it tells us how sample averages behave, even when we know nothing about the shape of the population.

The spread of those sample averages has a name: the standard error. It is the standard deviation divided by the square root of the sample size, and it shrinks as the sample grows. The standard error is the yardstick for every conclusion in the next lessons: a difference between two groups only matters if it is large compared with the standard error, and a confidence interval is built from it.

Seeing It by Simulation

You can watch the central limit idea work with a short simulation: draw many samples from a skewed distribution — for example, the roll of a single die, repeated — and average each sample. The individual rolls are flat, with each face equally likely, but the averages of samples of thirty rolls form a bell curve. The simulation does in seconds what the mathematics takes a page to prove, and it builds the intuition that makes the next lessons feel natural rather than magical.

How Big Is Big Enough?

The question of sample size has no single answer, but there is a useful way to think about it: a sample is big enough when the uncertainty around your answer is smaller than the difference you care about. If you need to know whether a new timetable improves scores by at least five points, and your interval is ten points wide, your sample is too small — the answer is lost in the noise. If the interval is two points wide, you can decide. This way of thinking turns sample size from a guessing game into a calculation: decide the difference that matters, then work out — or simulate — how large a sample makes the interval narrow enough.

It also explains why small samples can still be useful. If the effect you are looking for is large — a new treatment that doubles recovery, say — even a modest sample will show it clearly. And if the effect is small, no reasonable sample will pin it down, and the honest conclusion is that the data cannot tell. The size of the sample and the size of the effect belong together in every judgement about whether a study was big enough.

Key Terms

Sample
A smaller group drawn from a population, used to learn about the whole.
Population
The whole group a question is about.
Random sample
A sample where every member of the population has the same chance of being picked.
Sampling error
The difference between a sample's result and the population's true value, caused by chance.
Central limit idea
The fact that averages of large random samples are roughly normally distributed, whatever the population's shape.
Standard error
The spread of sample averages; the standard deviation divided by the square root of the sample size.

Discussion Questions

  1. A survey interviews 1,000 volunteers at a shopping centre. Why might it mislead, even though 1,000 is a large number?
  2. Why does quadrupling a sample only halve the sampling error? What does that mean for survey design?
  3. If sample averages are roughly normal even when the population is not, what does that buy us?

Practice Questions

  1. What is a random sample, and why is it the gold standard?
  2. What is sampling error?
  3. A sample of 100 has a standard error of 4. Roughly what is the standard error of a sample of 400?
  4. What does the central limit idea say?
  5. Why can a survey of a few thousand people describe a country of millions?
Show answers
  1. A sample where every member of the population has the same chance of being picked. Randomness does not favour anyone, so the sample tends to resemble the population.
  2. The difference between a sample's result and the population's true value, caused by chance alone. Even a good sample differs a little from the population.
  3. About 2. The standard error shrinks with the square root of the sample size, so quadrupling the sample halves it.
  4. That the averages of large random samples are roughly normally distributed, whatever the shape of the population.
  5. Because sampling error depends mostly on the size of the sample, not the size of the population — a few thousand gives a small standard error.
Keep reading to complete this lesson