Step 1: decide what the study must achieve
Sample size answers one of two questions, and they use different formulas:
- Precision: “I want to estimate the average (or percentage) to within ± some margin.” Typical of surveys and descriptive studies.
- Power: “I want a good chance of detecting an effect of a given size if it exists.” Typical of experiments, trials and studies comparing groups or testing relationships.
Step 2: sample size formula for a proportion
z is the critical value for your confidence level (1.96 for 95%), p is the expected proportion (0.5 if unknown) and e is the margin of error. Example: 95% confidence, ±5 points, p = 0.5 → 1.96² × 0.25 / 0.0025 = 384.2, so 385. This is Cochran's formula.
Step 3: sample size formula for a mean
Example: estimating mean systolic blood pressure to within ±3 mmHg, with σ ≈ 15 from earlier studies: (1.96 × 15 / 3)² = 96.04, so 97 participants.
Step 4: correct for a small population
If the population is 800 staff, the 385 above becomes 385 / (1 + 384/800) = 260.1, so 261. The correction matters once the sample would exceed about 5% of the population. Slovin's formula is a special case of this with fixed assumptions.
Step 5: sample size to compare two groups (power)
d is the standardised effect size (Cohen's d). With α = .05 (z = 1.96) and 80% power (z = 0.84), d = 0.5 gives 2 × (2.8)² / 0.25 = 62.8. The exact t-based answer is 64 per group, because the normal approximation slightly underestimates for small samples. The power analysis calculator uses the exact method.
Step 6: allow for dropout and non-response
Divide by the proportion you expect to retain: 64 per group with 20% attrition means recruiting 64 / 0.8 = 80 per group. For surveys, divide completed responses needed by the expected response rate.
Step 7: adjust for clustering
When participants are sampled in groups (classes, clinics, villages), multiply by the design effect DEFF = 1 + (m − 1)·ICC, where m is the cluster size and ICC the intraclass correlation. With classes of 25 and ICC = 0.05, DEFF = 2.2: you need more than twice the simple-random-sample size.
Common mistakes
- Using a survey formula for an experiment (or the reverse).
- Taking an effect size from one small, significant published study; these are usually inflated.
- Calculating power after the study from the observed effect (“post-hoc power”), which adds nothing to the p-value.
- Forgetting that each subgroup analysis needs its own adequate sample.
Frequently asked questions
What is the formula for sample size?
It depends on the goal. To estimate a proportion: n = z²p(1 − p)/e². To estimate a mean: n = (zσ/e)². To compare two means with power 1 − β: n per group = 2(z₁₋α/₂ + z₁₋β)²/d². Each can be adjusted for a finite population and expected dropout.
What sample size is enough for a thesis?
There is no universal number. Justify it: either by precision (margin of error) for descriptive studies, or by an a priori power analysis for studies that test hypotheses. Lakens (2022) lists six accepted ways to justify a sample size, including resource constraints stated honestly.
Is 30 a good sample size?
“n = 30” is a rule of thumb about when the sampling distribution of a mean becomes approximately normal, not a sample size justification. Thirty per group gives only about 48% power to detect a medium effect (d = 0.5) in a two-group comparison.
How do I calculate sample size for qualitative research?
Qualitative studies are sized by saturation or information power rather than formulas. Guest, Bunce and Johnson (2006) found most themes emerged within 12 interviews in a fairly homogeneous group.