Sample size calculation for medical research and MD/MS theses: formulas with worked examples
An undersized study cannot answer its own question: a real difference may go undetected, and a non-significant result tells the reader little. Ethics committees and thesis protocol reviewers therefore ask how the sample size was chosen, and reporting guidelines such as CONSORT and STROBE require authors to explain it. Yet "all patients during the study period" remains one of the most common justifications in Indian theses, and one of the most commonly queried.
This guide covers the formulas for the designs most often used in postgraduate research, with worked examples you can follow on a calculator.
The four things every calculation needs
- The primary outcome, and whether it is a proportion (for example, the percentage with anaemia) or a mean (for example, systolic blood pressure).
- An expected value from a previous study, pilot data or routine records: the expected prevalence, or the expected mean and standard deviation.
- The precision or difference that matters: how precisely you want to estimate a prevalence, or the smallest difference between groups that is clinically important.
- The error rates you accept: the significance level (α, usually 5%) and, for comparisons, the power (1 − β, usually 80% or 90%).
| Setting | Z value |
|---|---|
| Two-sided α = 0.10 (90% confidence) | 1.645 |
| Two-sided α = 0.05 (95% confidence) | 1.96 |
| Two-sided α = 0.01 (99% confidence) | 2.576 |
| Power 80% (β = 0.20) | 0.84 |
| Power 90% (β = 0.10) | 1.28 |
1. Estimating a prevalence or proportion
For a cross-sectional study whose main aim is to estimate a proportion:
n = Z² × p × (1 − p) / d²
where p is the expected proportion and d is the absolute precision (margin of error).
Worked example. A previous study found that 30% of antenatal women in a similar district were anaemic. You want to estimate the prevalence within ±5 percentage points with 95% confidence.
n = 1.96² × 0.30 × 0.70 / 0.05² = 3.8416 × 0.21 / 0.0025 = 322.7, so 323 women.
Precision matters a great deal: with d = 0.10 the same calculation gives 81, and with d = 0.03 it gives 897. Choose d deliberately and justify it; a common rule is that d should be much smaller than p itself when p is small.
2. Estimating a mean
n = Z² × σ² / d²
where σ is the expected standard deviation and d the precision in the same units.
Worked example. To estimate mean systolic blood pressure within ±2 mmHg, with an expected SD of 12 mmHg: n = 3.8416 × 144 / 4 = 138.3, so 139 participants.
3. Comparing two means
For a trial or comparative study with two independent groups of equal size and a continuous outcome:
n per group = 2 × (Zα/2 + Zβ)² × σ² / Δ²
where Δ is the smallest clinically important difference between means.
Worked example. You expect pain scores to have an SD of 10 points and consider a 5-point difference clinically important; α = 0.05, power 80%.
(1.96 + 0.84)² = 7.84, so n = 2 × 7.84 × 100 / 25 = 62.7, giving 63 per group (126 in total).
4. Comparing two proportions
n per group = (Zα/2 + Zβ)² × [p₁(1 − p₁) + p₂(1 − p₂)] / (p₁ − p₂)²
Worked example. The complication rate with standard care is 40% and you expect 25% with the new technique; α = 0.05, power 80%.
n = 7.85 × (0.24 + 0.1875) / 0.15² = 7.85 × 0.4275 / 0.0225 = 149.1, giving 150 per group.
This is the simple unpooled formula. Software using a pooled-variance or continuity-corrected formula may give a slightly larger number; report which method you used.
Adjusting the calculated number
For non-response or loss to follow-up
Divide by the expected retention: nfinal = n / (1 − dropout rate). With 323 participants and 10% expected non-response, 323 / 0.9 = 358.9, so recruit 359.
For a small, known population
When sampling from a finite population of size N, apply the finite population correction: nadj = n / [1 + (n − 1) / N]. For n = 323 drawn from a population of 1,000, nadj = 323 / 1.322 = 244.3, so 245.
For cluster sampling
If you sample villages, wards or schools rather than individuals, multiply by the design effect (often 1.5 to 2 in community surveys, ideally estimated from earlier studies).
Designs that need other methods
Paired designs, more than two groups, regression models, survival outcomes, diagnostic accuracy studies, non-inferiority trials and agreement studies each have their own formulas. Use dedicated software (G*Power, OpenEpi or R) or a statistician; the principle of specifying the outcome, expected values, important difference, α and power is the same.
How to report it
A reviewer should be able to reproduce your number from the methods section. A complete statement looks like this:
"Assuming a prevalence of anaemia of 30% based on a previous study in the district [ref], a sample of 323 was required to estimate prevalence with an absolute precision of 5% and 95% confidence. Allowing for 10% non-response, we aimed to recruit 359 women."
Sources and further reading
- OpenEpi, free sample-size calculators
- EQUATOR Network: CONSORT and STROBE items on sample size
Our statistical analysis service calculates and documents sample size for theses, protocols and ethics submissions, and analyses the data once it is collected.
Related guides and services
Frequently asked questions
Where do I get the expected values for the calculation?
From a published study in a similar population, a pilot study, or routine data from your own department. Cite the source in your methods. If no estimate exists for a proportion, using 50% gives the largest (most conservative) sample size.
What power and significance level should I use?
Most clinical studies use a two-sided significance level of 5% (Z = 1.96) and power of 80% (Z = 0.84) or 90% (Z = 1.28). Some institutions specify these for theses, so check your university's guidelines.
Which software can I use?
G*Power (free), OpenEpi (free, web-based), the pwr package in R and the sample-size modules in commercial packages are all widely used. Whatever you use, report the inputs so a reviewer can reproduce the number.
My study is a time-bound thesis with limited patients. What then?
Calculate the required sample size honestly. If it cannot be reached in the study period, discuss it with your guide: options include a longer recruitment period, a more common outcome, a larger acceptable margin of error, or presenting the study as a pilot whose results will inform a future, adequately powered study.