Sample size and power calculator

Sample size calculator for surveys and studies: n for a margin of error on a proportion or mean, and the per-group n for a target power.

更新于 已验证的示例:6

%
%
Use 50% when you have no prior estimate — it gives the largest, safest sample.
%
In percentage points: 5 means ±5%.
Applies the finite population correction.
试一试
Sample size needed
Sample size needed: 385
整数;取最近值,等距时远离零
Before rounding up
384.1459
z for the confidence level or α
1.959964

A random sample of 385 gives a 95% confidence interval no wider than ±5 percentage points whatever the true proportion turns out to be (p = 50% is the worst case). Halving the margin roughly quadruples the sample; the formula assumes simple random sampling and says nothing about non-response or bias.

Sample size against margin of error

05001,0001,5002.557.51012.515Margin of error (percentage points)nn = 385
计算方法 S
  1. Critical z

    z=Φ−1 ⁣(1+0.952)=1.959964z = \Phi^{-1}\!\left(\tfrac{1 + 0.95}{2}\right) = 1.959964
  2. Sample size for a large population

    n0=z2p(1−p)E2=1.9599642×0.5×0.50.052=384.145882n_0 = \frac{z^2 p(1-p)}{E^2} = \frac{1.959964^2 \times 0.5 \times 0.5}{0.05^2} = 384.145882
  3. Round up

    n=⌈384.145882⌉=385n = \lceil 384.145882 \rceil = 385

    Always rounded up: rounding down would miss the target margin.

关于Sample size and power calculator

For a survey proportion the sample size is n₀ = z²p(1 − p)/E², where z is the critical value for the confidence level and E the margin of error; for a mean it is (zσ/E)². A known population size N reduces this through the finite population correction, n = n₀/(1 + (n₀ − 1)/N). To compare two means, each group needs 2(z₁₋α/₂ + z₁₋β)²/d², where d is the difference to detect divided by σ.

Survey planners and researchers use it before collecting data. The default, 95% confidence and ±5 points with p = 50%, needs 384.1 respondents, rounded up to 385; for a population of 10,000 the correction lowers that to 370.

Results are always rounded up. The formulas assume simple random sampling; cluster samples, weighting and non-response all call for a larger sample.

计算示例

Survey at 95%, ±5%, p = 50% (defaults)

Plan for
Estimating a proportion (survey)
Confidence level
95%
Expected proportion
50%
Margin of error
5%
Sample size needed
385
Before rounding up
384.1459

核验来源:Cochran's formula 1.959964² × 0.25 / 0.05² = 384.146 (Python NormalDist); the widely published figure is 385

Same survey, population of 10,000

Plan for
Estimating a proportion (survey)
Confidence level
95%
Expected proportion
50%
Margin of error
5%
Population size
10,000
Sample size needed
370
Before rounding up
369.9706

核验来源:Finite population correction n₀/(1 + (n₀ − 1)/N) in Python

Small population of 100

Plan for
Estimating a proportion (survey)
Confidence level
95%
Expected proportion
50%
Margin of error
5%
Population size
100
Sample size needed
80
Before rounding up
79.5093

核验来源:Finite population correction in Python: 384.146/(1 + 383.146/100)

Mean within ±3 when σ = 15

Plan for
Estimating a mean
Confidence level
95%
Standard deviation σ (estimate)
15
Margin of error (same units as σ)
3
Sample size needed
97
Before rounding up
96.0365

核验来源:(1.959964 × 15 / 3)² = 96.04 in Python

常见问题

Why is 385 the standard survey sample size?

It is what Cochran's formula gives for 95% confidence, a ±5-point margin and p = 50%: 1.96² × 0.25 / 0.05² = 384.1, rounded up to 385. Because p = 50% is the worst case, 385 is enough for any true proportion in a large population. A population of 1,000 needs only 278, because each respondent is a larger share of it.

Does population size matter for sample size?

Only when the sample is a noticeable fraction of the population. The finite population correction turns the 385 needed for ±5 points at 95% into 370 for a population of 10,000 and 80 for a population of 100, while any population above 100,000 needs 383 to 385. A sample of 1,000 gives about ±3.1 points whether the population is 100,000 or 300 million.

What expected proportion should I use?

Use 50% unless you have a reliable prior estimate. p(1 − p) is largest at p = 0.5, so that sample is big enough whatever the true value turns out to be. A prior estimate lowers the requirement: at 95% confidence and ±5 points, an expected 20% needs 246 respondents instead of 385. If the guess is wrong, the achieved margin will be wider than planned.

How does sample size change with the margin of error?

The margin shrinks with the square root of n, so halving it needs four times the sample. At 95% confidence and p = 50%, ±5 points needs 385 respondents, ±3 points 1,068, ±2 points 2,401 and ±1 point 9,604. Choosing 90% confidence instead of 95% lowers the ±5-point figure to 271.

What does statistical power mean?

Power is the probability that a test detects an effect of a stated size when that effect is real; 1 − power is the Type II error rate β. Cohen (1988) proposed 80% as a conventional minimum. Detecting a difference of 7.5 when σ = 15 (d = 0.5) with a two-sided test at α = 0.05 needs 63 per group for 80% power by the normal approximation; Cohen's t-based table gives 64.

“Sample size and power calculator”有多准确?

准确性取决于输入值和方法的假设。十进制运算使用50位有效数字,但估算、数值方法和源数据的精度可能较低;显示时的舍入并不能消除这些限制。 已按独立来源核验的计算示例:6。 例如,“Survey at 95%, ±5%, p = 50% (defaults)”根据Cochran's formula 1.959964² × 0.25 / 0.05² = 384.146 (Python NormalDist); the widely published figure is 385进行核验。

这种方法出自哪里?

NIST/SEMATECH e-Handbook of Statistical Methods, §7.2.2.2 Sample sizes required; Cochran, W. G. (1977). Sampling Techniques, 3rd ed., §4.4 (sample size for proportions and the finite population correction); Cohen, J. (1988). Statistical Power Analysis for the Behavioral Sciences, 2nd ed., Table 2.4.1.

关于此计算器

n0=z2 p(1−p)E2,n0=(zσE)2,n=n01+(n0−1)/N,ngroup=2(z1−α/2+z1−β)2σ2δ2n_0 = \frac{z^2\,p(1-p)}{E^2},\quad n_0 = \left(\frac{z\sigma}{E}\right)^2,\quad n = \frac{n_0}{1 + (n_0-1)/N},\quad n_{\text{group}} = \frac{2(z_{1-\alpha/2} + z_{1-\beta})^2\sigma^2}{\delta^2}

来源

  1. NIST/SEMATECH e-Handbook of Statistical Methods, §7.2.2.2 Sample sizes required
  2. Cochran, W. G. (1977). Sampling Techniques, 3rd ed., §4.4 (sample size for proportions and the finite population correction)
  3. Cohen, J. (1988). Statistical Power Analysis for the Behavioral Sciences, 2nd ed., Table 2.4.1

已对照来源验证

此计算器包含 6 个已解示例,答案来自独立来源。这些示例会在测试套件中运行,你也可以在此运行验证。

相关计算器