Sample Types
How you choose a sample matters more than how big it is. A well-chosen sample of 500 can describe a country; a badly chosen sample of 500,000 can be useless. Sampling methods fall into two groups: probability sampling, where every member has a known, non-zero chance of selection, and non-probability sampling, where they don't.
Probability sampling methods
| Method | How it works | Example |
|---|---|---|
| Simple random | every possible sample of size n is equally likely |
draw 100 student IDs out of a hat |
| Systematic | pick a random start, then every k-th member | every 20th customer through the door |
| Stratified | split the population into groups (strata), take a random sample from each | sample 10% of each school year |
| Cluster | split into groups (clusters), randomly pick whole clusters | pick 8 classrooms at random, survey every pupil in them |
Probability samples let you calculate margins of error, because the randomness is under your control.
Non-probability sampling
- Convenience sampling: whoever is easy to reach (people walking past your stall).
- Voluntary response: people choose to take part (online polls, product reviews).
- Snowball sampling: participants recruit other participants (useful for hard-to-reach groups).
- Quota sampling: fill fixed numbers per group, but choose people non-randomly.
These are cheap and sometimes unavoidable, but you cannot reliably quantify their error, and they are prone to bias.
Simple random and systematic samples in Python
Imagine a school with 1,200 pupils, numbered 0–1199:
import numpy as np
rng = np.random.default_rng(10)
pupils = np.arange(1200)
simple = rng.choice(pupils, size=8, replace=False)
print("simple random:", sorted(simple.tolist()))
k = 1200 // 8 # sampling interval
start = rng.integers(0, k) # random start inside the first interval
systematic = pupils[start::k]
print("interval k =", k, "start =", start)
print("systematic: ", systematic.tolist())simple random: [179, 248, 315, 617, 926, 948, 992, 1141]
interval k = 150 start = 126
systematic: [126, 276, 426, 576, 726, 876, 1026, 1176]
Systematic sampling is simple to carry out on a list, but it can go wrong if the list has a repeating pattern with the same period as k (for instance, if every 150th pupil on the register happened to be a class captain).
Stratified sampling
Stratified sampling guarantees that every subgroup is represented in proportion. Here the school has three year groups of different sizes, and we want a 5% sample from each:
import numpy as np
import pandas as pd
rng = np.random.default_rng(10)
school = pd.DataFrame({
"pupil": np.arange(1200),
"year": np.repeat(["Year 7", "Year 8", "Year 9"], [500, 400, 300]),
})
sample = school.groupby("year").sample(frac=0.05, random_state=1)
print(sample["year"].value_counts().sort_index())
print("total sampled:", len(sample))year
Year 7 25
Year 8 20
Year 9 15
Name: count, dtype: int64
total sampled: 60
Each year group contributes exactly 5% of its pupils, so the sample mirrors the school's composition (25 + 20 + 15 = 60 pupils).
Why stratification helps
When the strata differ a lot from one another, stratified samples give more stable estimates than simple random ones of the same size. Below, the year groups have very different average reading hours per week. We repeat each sampling method 2,000 times and compare how much the estimated school average varies:
import numpy as np
rng = np.random.default_rng(3)
sizes = [500, 400, 300]
centres = [2.0, 4.0, 7.0] # very different average hours per year group
hours = [rng.normal(c, 1.0, s) for c, s in zip(centres, sizes)]
everyone = np.concatenate(hours)
print(f"true school mean: {everyone.mean():.3f}")
simple_means, strat_means = [], []
for _ in range(2000):
simple_means.append(rng.choice(everyone, 60, replace=False).mean())
parts = [rng.choice(h, n, replace=False) for h, n in zip(hours, [25, 20, 15])]
strat_means.append(np.concatenate(parts).mean())
print(f"simple random: spread of estimates = {np.std(simple_means):.3f}")
print(f"stratified: spread of estimates = {np.std(strat_means):.3f}")true school mean: 3.949
simple random: spread of estimates = 0.276
stratified: spread of estimates = 0.129
Both methods are centred on the truth, but the stratified estimates are much less spread out, because the large differences between years no longer add randomness.
Choosing a method
- Have a full list of the population and no important subgroups? Simple random sampling.
- Important subgroups that must be represented? Stratified.
- Population naturally grouped and spread out (schools, villages)? Cluster sampling saves travel and cost, at the price of more variability.
- Can only reach volunteers? Be honest that the results may not generalise.
Test yourself
A researcher randomly selects 6 of a city's 40 hospitals and interviews every nurse in those 6. Which method is this?
- Stratified sampling
- Cluster sampling
- Systematic sampling
- Convenience sampling
Why is a voluntary online poll a non-probability sample?
- It uses the internet
- Participants select themselves, so selection chances are unknown and uneven
- It has too few questions
- It is always too small
When does stratified sampling give a clear advantage over simple random sampling?
- When the strata are very similar
- When the strata differ a lot on the variable being measured
- Never
- Only when the population is tiny