Sample Size for a Mean Calculator
When a study aims to estimate a mean rather than a proportion — average income, average blood pressure, average duration, average score — the sample size is computed with the formula for estimating a mean, not with Cochran's formula for proportions. The logic is simple: you find how many observations are needed so that the half-width of the confidence interval (the margin of error E) does not exceed the limit you set.
From the confidence level, the margin of error you accept, and the standard deviation of the variable (σ), this calculator computes the required sample with n = (z·σ/E)²; it applies the finite population correction when the population is limited, adds an allowance for data loss, and works back from the rounded sample size to the margin of error you will actually achieve. A table and a line chart show the inverse-square relationship between the margin of error and the sample size: halving the margin of error quadruples the sample.
Sample Size for Estimating a Mean
n₀ = ( z · σ / E )² Finite population correction: n = n₀ / ( 1 + (n₀ − 1) / N ) z: critical value for the confidence level (90% → 1.645; 95% → 1.960; 99% → 2.576) σ: population standard deviation, E: accepted margin of error (half-width) Achieved margin of error: E = z · σ / √n (in a limited population × √((N − n)/(N − 1))) Confidence interval: x̄ ± z · σ / √n Target with allowance: n_target = ⌈ n · (1 + attrition rate) ⌉
The formula rests on the assumptions that x̄ is normally distributed (the central limit theorem) and that σ is known. If the sample standard deviation s is used instead of σ, an iterative solution with t₍df₎ rather than z is theoretically more correct; for n ≥ 30 the difference is negligible.
How to Calculate
- Choose the confidence level: 95% is common in the social sciences, 99% in clinical decisions.
- Write the margin of error (E) you will accept in the unit of the variable itself — for example 2 points on an exam score, or 3 mmHg for blood pressure.
- Enter the standard deviation (σ): a pilot study, the literature, or the rough range / 4 rule can all be used.
- If the population is limited (a school, a hospital, an institution), enter N; leave it empty for general population studies.
- Set the attrition allowance; 10% is common in surveys and 20% in long follow-up studies.
- When reading the result, check both the required n and the margin of error actually achieved with that n; compare alternative scenarios in the table and the chart.
Worked Examples
Mean exam score (95% confidence, ±2 points)
On an exam with a standard deviation of 10 points, estimating the mean with a ±2-point margin of error gives n₀ = (1.9600 · 10 / 2)² = 96.04; rounded up, 97 students are required. With this sample the actual margin of error is ±1.9900, and with a 10% attrition allowance the target is 107 students.
Required minimum sample size (n): 97 · Infinite-population sample size (n₀): 96.04 · z critical value: 1.9600
Finite population correction in an institution of 500
In the same scenario, if the population is limited to 500 people the correction gives n = 96.04 / (1 + 95.04/500) = 80.70; the n₀ = 96.04 needed for an infinite population therefore drops to 81 observations. With 81 observations, and once the finite population factor is taken into account, the achieved margin of error is ±1.9955, which stays below the target; with a 10% attrition allowance, a target of 90 people is enough.
Required minimum sample size (n): 81 · Infinite-population sample size (n₀): 96.04 · z critical value: 1.9600
Precise clinical measurement (99% confidence, ±1 unit)
For a clinical measurement with σ = 8, requiring a ±1-unit margin of error at 99% confidence gives n₀ = (2.5758 · 8 / 1)² = 424.63, so 425 patients are needed. With a 15% attrition allowance the target should be 489 patients; raising the margin of error to 2 units would cut the required sample to 107.
Required minimum sample size (n): 425 · Infinite-population sample size (n₀): 424.63 · z critical value: 2.5758