Skip to content

Biostatistics

How to calculate sample size for research

The sample size decides whether your study can answer its question. This guide shows the formulas, the inputs they need and how to report the result.

Author
By ToProt editorial team
Published
Updated
Reading time
8 min read

Reviewed by ToProt editorial team on

Why sample size matters

The sample size is the number of participants a study needs. If it is too small, the study may be unable to detect a real effect, or its estimates will be so imprecise that they are of little use. If it is too large, more people than necessary are exposed to the burden and risk of the study, and time and money are wasted. Ethics committees and funders therefore expect a calculation in the protocol, not a convenient number [3, 4].

Every calculation answers one of two questions:

  • Estimation: how many participants do I need to estimate a quantity, such as a prevalence or a mean, with a stated precision?
  • Comparison: how many do I need to detect a difference of a stated size between groups, with a stated chance of finding it if it is real?

The inputs you must choose

InputMeaningUsual choice
Confidence level (1 − α)How sure you want to be that an interval contains the true value. Equivalently, α is the chance of a false positive.95% (α = 0.05, two-sided)
Z for the confidence level (Z)The standard normal value for that level1.645 for 90%, 1.960 for 95%, 2.576 for 99%
Power (1 − β)The chance of detecting the difference if it is real80% or 90%
Z for powerThe standard normal value for that power0.842 for 80%, 1.282 for 90%, 1.645 for 95%
Precision (d)The half-width you accept for the interval, in the units of the quantityChosen from the purpose of the study
Expected value or variabilityAn expected proportion, or the standard deviation (SD) of a measurementFrom a pilot study or published work
Effect sizeThe smallest difference worth detectingThe smallest clinically meaningful difference

The expected values are the weakest part of most calculations, because they are guesses made before the study. Take them from a pilot study or from published studies in a similar population, say where they came from, and do not choose them to produce a convenient answer [4].

Estimating one proportion (a prevalence)

n = Z² × p × (1 − p) / d²

Here p is the expected proportion and d is the precision as a proportion. When you have no idea of p, use p = 0.5, which gives the largest value of p(1 − p) and so the largest, safest sample size.

The sample size rises quickly as the precision is tightened, because d is squared. For p = 0.40 and 95% confidence:

Precision (d)Sample size
±10 points93
±7 points189
±5 points369
±4 points577
±3 points1,025

Estimating one mean

n = Z² × σ² / d²

σ is the expected standard deviation of the measurement and d is the precision in the same units.

Comparing two proportions

For two independent groups of equal size, the number needed per group is

n per group = [ Zα/2 × √(2 × p̄ × (1 − p̄)) + Zβ × √(p₁(1 − p₁) + p₂(1 − p₂)) ]² / (p₁ − p₂)²

where p₁ and p₂ are the expected proportions in the two groups, p̄ is their average, Zα/2 is the Z value for the confidence level and Zβ is the Z value for the power.

Different programs may give slightly different answers because some add a continuity correction or use another approximation. Say which method you used.

Comparing two means

For two independent groups of equal size:

n per group = 2 × σ² × (Zα/2 + Zβ)² / Δ²

σ is the common standard deviation and Δ is the difference between means you want to detect.

Halving the difference you want to detect multiplies the sample size by four, so be realistic about the smallest difference that matters.

Adjusting for real conditions

Dropout and non-response. Divide the calculated sample size by the proportion expected to complete the study (1 − dropout rate). A 10% dropout means dividing by 0.90. The result is the number to enrol.

A small population. When you sample a large fraction of a small, known population of size N, the finite population correction reduces the sample size:

n adjusted = n / (1 + (n − 1) / N)

For the anaemia example with a population of N = 1,500 women: 369 / (1 + 368 / 1,500) = 296.3, which is 297. The correction matters only when the sample is more than a few percent of the population.

Cluster sampling. If participants are chosen in groups, such as clinics or villages, people in the same group resemble each other, which reduces the information each person adds. Multiply the sample size by the design effect:

Design effect = 1 + (m − 1) × ICC

m is the average number of participants per cluster and ICC is the intracluster correlation coefficient. With m = 20 and ICC = 0.05, the design effect is 1 + 19 × 0.05 = 1.95, so the 369 women become 369 × 1.95 = 719.6, which is 720.

How to report the calculation

State the design and purpose, the formula or program used, every input with its source, and the final number including any adjustments. For example:

"We needed 410 participants to estimate the prevalence of anaemia with a precision of plus or minus 5 percentage points at 95% confidence, assuming a prevalence of 40% based on a regional survey [reference] and allowing for 10% non-response."

Limitations and cautions

  • The result is only as good as the inputs. If the true prevalence or SD differs from what you assumed, the precision or power will differ too. Run the calculation for a range of plausible inputs and report the sensitivity [4].
  • These formulas assume simple random sampling and approximately normal estimates. Small samples, very rare or very common outcomes, and other designs need other methods, such as exact methods or simulation.
  • Power is not a guarantee. With 80% power, one study in five will miss a real effect of the size assumed.
  • A single calculation covers a single primary question. Secondary analyses, subgroup analyses and regression models with many variables may need more participants, and rules of thumb for them are debated, so ask a statistician.
  • Do not work backwards. Choosing the effect size to fit the number of participants you can afford, and presenting it as if it were chosen first, misleads reviewers [3, 4].
  • A feasibility sample is not a calculation. A pilot study is useful for estimating SDs and recruitment rates but not for confirming that an effect exists.

Always have a statistician review the calculation for a study that will influence clinical decisions or that has an unusual design.

Use it in ToProt

The sample size calculator uses these formulas and shows its steps, with a table of how the result changes with dropout and precision. Individual calculators are also available for a single proportion, a single mean, two proportions and two means. The finite population correction, design effect and non-response adjustment tools apply the adjustments above, and the power calculator shows the power of a study of a given size. The result can be saved in the sample size section of your protocol.

References

  1. 1.Charan J, Biswas T. How to calculate sample size for different study designs in medical research? Indian J Psychol Med. 2013;35(2):121-126. doi:10.4103/0253-7176.116232
  2. 2.Kadam P, Bhalerao S. Sample size calculation. Int J Ayurveda Res. 2010;1(1):55-57. doi:10.4103/0974-7788.59946
  3. 3.Schulz KF, Grimes DA. Sample size calculations in randomised trials: mandatory and mystical. Lancet. 2005;365(9467):1348-1353. doi:10.1016/S0140-6736(05)61034-3
  4. 4.Bacchetti P. Current sample size conventions: flaws, harms, and alternatives. BMC Med. 2010;8:17. doi:10.1186/1741-7015-8-17

This guide is general educational information. It is not a substitute for advice from your supervisor, a statistician or your ethics committee.