Statistics Sampling Methods
Sampling methods are the strategies statisticians use to select a manageable, representative subset from a larger population.
Why Sampling Methods Matter
Studying an entire population is often too slow, too expensive, or simply impossible, so statisticians study a sample instead — a smaller subset meant to represent the whole. How that sample is chosen determines whether conclusions drawn from it can be trusted, which is why the sampling method matters just as much as the sample size.
Simple Random Sampling
In simple random sampling, every member of the population has an equal, independent chance of being selected — much like drawing names out of a hat. It's the most straightforward method to reason about statistically, but it requires a complete list of the population to draw from.
Simulating Simple Random Sampling
import random
population = list(range(1, 1001)) # 1000 customer IDs
random.seed(42) # reproducible results
sample = random.sample(population, k=20)
print(f"Population size: {len(population)}")
print(f"Sample size: {len(sample)}")
print(f"First 5 IDs sampled: {sorted(sample)[:5]}")Stratified Sampling
Stratified sampling first divides the population into non-overlapping subgroups, or strata, based on a shared characteristic — department, age group, or income bracket, for instance. A random sample is then drawn from each stratum, usually in proportion to that stratum's share of the population, guaranteeing every subgroup is represented rather than leaving it to chance.
Simulating Stratified Sampling
import random
random.seed(1)
engineers = list(range(1, 301)) # 300 engineers
sales = list(range(301, 501)) # 200 sales staff
sample_fraction = 0.10
engineer_sample = random.sample(engineers, k=int(len(engineers) * sample_fraction))
sales_sample = random.sample(sales, k=int(len(sales) * sample_fraction))
stratified_sample = engineer_sample + sales_sample
print(f"Engineers sampled: {len(engineer_sample)} of {len(engineers)}")
print(f"Sales staff sampled: {len(sales_sample)} of {len(sales)}")
print(f"Total stratified sample: {len(stratified_sample)}")Systematic and Cluster Sampling
Systematic sampling picks a random starting point in an ordered list, then selects every k-th member after that — for example, every 10th name on a roster. Cluster sampling instead divides the population into naturally occurring groups, or clusters, such as schools or city blocks, randomly selects a handful of whole clusters, and then samples members within just those chosen clusters rather than across the entire population.