Skip to content

Sampling

Sampling is how you pick your sample. The four types: simple random, systematic (one in every so many), stratified (random within each group) and cluster.

Select any words here to ask your Maestro about them.

You pick 20 employees at random from all 300; 15 work at South. If you run the draw 10 times, in how many does nobody from South come up?

Each dot is an employee; the faint ones weren't picked. Example data.

What it's for: a sample only speaks for everyone if you pick it well. The types of sampling are the ways to pick it:

  • Simple random: everyone has the same chance, like drawing names from a hat.
  • Systematic: one in every so many on a list, starting from one picked at random.
  • Stratified: you split people into groups (branch, age, region) and pick at random within each one.
  • Cluster: you pick whole groups at random, like schools or branches, and measure everyone in them.

All four are probability samples: everyone has a known chance of being picked. A convenience sample, asking whoever's around, isn't, which is why its confidence interval means nothing.

Small groups make numbers jump around: see Why do small towns have the highest (and lowest) rates?.

To check a new table with a random sample of its rows, see What does a row in a table represent, and how do I check?.

How it's used

How to draw each kind

Your employees in the table df

  1. marked: df.sample(20, random_state=1)Simple random: everyone has the same chance.
  2. df.iloc[6::15]Systematic: from the seventh row on, one in every 15.
  3. df.groupby("branch").sample(frac=1/15, random_state=1)Stratified: one in 15 from each branch, at random: 13, 6 and 1, as in the chart.
  4. df[df.branch.isin(["North", "South"])]Cluster: whole branches picked at random; here North and South came up.
In Excel, you do the stratified one by sorting by branch and then by a column of =RAND(), and taking the first rows of each branch. A convenience sample, like asking whoever's around, isn't any of these: it isn't random.

When to look closer

Sample by branch, report for the company

5 people surveyed at each branch

  1. marked: Downtown (190 employees): 80% satisfied
  2. marked: North (95): 60%
  3. marked: South (15): 20%

You surveyed 5 people at each branch. What share of the whole company is satisfied?

Ask your Maestro about Sampling

It answers from the free course page closest to this word, the way it answers while you study.

Example

You: What does "Sampling" mean, in plain words?

Your Maestro: I'll explain it with a case of yours: it sticks better than a definition. Which small group at work gets left out of surveys?

Asking about: Answers from the page "How do I show each group's total next to every row in SQL?"

Only this browser keeps what you ask here. How it works

Learn more

  • Population and sample

    The population is the whole group you want to know about; the sample is the part of it you actually measure to estimate the rest.

  • Confidence interval

    A confidence interval is the range where the whole population's number probably falls, worked out from a sample: 52% ± 5 runs from 47% to 57%.

  • Weighted average

    A weighted average gives each value a weight for how much it counts, instead of treating them all the same: multiply each value by its weight, add them up and divide by the sum of the weights.

  • Spot check

    Taking a few rows spread across the data (from the start, the middle and the end) and comparing them by hand with what you expect.

The whole glossary