What are the main sampling methods: simple random, stratified, cluster and systematic?
Simple random gives everyone an equal chance; stratified splits the population into groups and samples each; cluster picks whole groups at random; systematic takes every kth item. Each trades cost against precision.
Explain it simply
Suppose you want opinions from 6,000 students across 4 branches.
- Simple random: draw names from a hat. Fair, but a small branch might be missed by chance.
- Stratified: treat each branch as a stratum and sample from each in proportion to its size. Best when groups differ and you need every group represented.
- Cluster: randomly pick a few hostels or classrooms and survey everyone inside. Cheap and practical, but the sample is less varied.
- Systematic: from a sorted list, pick every 50th student after a random start. Easy, but hidden patterns in the list can bias it.
Example
import pandas as pd
df = pd.DataFrame({"branch": ["CS"] * 6 + ["ME"] * 4, "id": range(10)})
s = df.groupby("branch", group_keys=False).sample(frac=0.5, random_state=1)
print(s["branch"].value_counts().to_dict()) # {'CS': 3, 'ME': 2}Half of each branch is drawn, so both are represented in proportion.
What to say in the interview
"Simple random sampling is the baseline. Stratified reduces variance and guarantees subgroup coverage. Cluster sampling is used when a list of individuals is not available or travel cost matters, and systematic sampling is convenient but risks periodic bias. The choice depends on cost, available frame and the subgroups I must compare."
Common mistakes
- Confusing strata with clusters: strata are sampled from every group, clusters are sampled as whole groups.