Statistics Quest

Sample size for a margin of error

Choose n so that a confidence interval for a mean or proportion has at most a desired margin of error E, rounding up and optionally applying the finite population correction.

n0=(z1−α/2 σE)2n_0 = \Big(\frac{z_{1-\alpha/2}\,\sigma}{E}\Big)^2
Mean
σ\sigma
planning value for the population SD (pilot study, past data)
EE
desired margin of error (half-width)
z1−α/2z_{1-\alpha/2}
normal quantile for the confidence level
n0=z1−α/22  p(1−p)E2n_0 = \frac{z_{1-\alpha/2}^2\; p(1-p)}{E^2}
Proportion (p = 0.5 is the conservative choice)
pp
planning value for the proportion; 0.5 gives the largest nn
n=n01+(n0−1)/Nn = \frac{n_0}{1 + (n_0 - 1)/N}
Finite population adjustment; always round UP
NN
population size

When to use

Planning a survey or study whose goal is a precise estimate. For detecting an effect with a test, plan for power instead (see errors and power and A/B sample size).

Assumptions

Simple random sampling; a sensible planning value for σ or pp; the margin applies to the full sample (subgroups need their own nn).

How to interpret

  • Halving the margin quadruples nn.
  • Round up to the next whole number; rounding down misses the target.
  • Plan for nonresponse: divide by the expected response rate.

Common mistakes

  • Rounding to the nearest integer.
  • Using an optimistic σ, which yields too small a sample.
  • Forgetting that the margin only covers sampling error, not bias.

Example

Mean with σ=15\sigma = 15, E=3E = 3, 95%: n0=(1.96×15/3)2=96.04n_0 = (1.96 \times 15/3)^2 = 96.04, so n=97n = 97. Proportion with E=0.03E = 0.03 and p=0.5p = 0.5: n0=1067.07n_0 = 1067.07, so n=1068n = 1068; from a population of N=5000N = 5000 the FPC reduces this to n=880n = 880.