Sample Size Calculator

Single proportion

Determines the sample size required to test whether a population proportion differs from a specified hypothesized or reference proportion, given a chosen significance level and statistical power.

Key takeaways

  • What is calculated: Determine the smallest n at which the test of H₀ attains the specified power.
  • Quantities you must supply: Reference proportion; Anticipated proportion; Significance level; Power.
  • Type of calculation: Power-based: it answers how much data is needed to detect a stated effect. Power 0.80 at α = 0.05 is the usual target; confirmatory studies use 0.90.
  • Calculation routes: 3 are available for this design; the one selected determines the formula, the quantities requested and the result.

Methods available for Single proportion

  • Normal approximation (z-based) Closed-form sample size approximating the binomial by a normal distribution. Chosen for simplicity and comparability with published tables when the expected-count conditions are satisfied.
  • Normal approximation with continuity correction Normal approximation adjusted for the discreteness of the binomial distribution. Chosen as a middle course: more conservative than the plain approximation, without the iteration of the exact method.
  • Exact binomial (Clopper-Pearson style) Sample size derived directly from the binomial distribution, with no normal approximation. Chosen because it makes no distributional approximation and guarantees the actual type I error does not exceed the nominal level — which the normal approximation cannot promise.

When to use

Use when the primary objective is to determine whether a population proportion differs from a specified reference or hypothesized proportion with adequate statistical power.

Sample size

Type I error rate.

Probability of detecting the specified effect.

A two-sided alternative splits α between both tails; a one-sided alternative places all of α in one tail, needs a smaller n, and must be pre-specified.

Final n is inflated by 1/(1 − dropout).

Reset to defaults

Awaiting inputs

Set the parameters and calculate.

Methodology — Single proportion — normal approximation

Formula used Single proportion — normal approximation

n=[z1α/2p0q0+z1βp1q1]2(p1p0)2
Normal approximation, q = 1 − p
  • z1α/2(two-sided)in place ofz1α(one-sided) Two-sided alternative selected: α is split between both tails, so the larger quantile is used and the requirement rises

where —

p₀
Hypothesised reference proportion under H₀. 0 < p₀ < 1
p₁
Anticipated proportion under the alternative. 0 < p₁ < 1, p₁ ≠ p₀
α
Probability of rejecting a true null hypothesis (Type I error). 0.0001 – 0.5; conventionally 0.05, or 0.025 one-sided for regulatory non-inferiority
1 − β
Probability of rejecting the null hypothesis when the specified alternative is true. 0.50 – 0.9999; conventionally 0.80 or 0.90
Expected proportion of enrolled units lost before analysis. 0 – 0.95

Formulas for the 3 methods

Calculation methodFormula
Normal approximation (z-based)
n=[z1α/2p0q0+z1βp1q1]2(p1p0)2
Normal approximation with continuity correction
ncc=n4(1+1+4n|p1p0|)2
Exact binomial (Clopper-Pearson style)
1β=Pr(Xcn,p1)

How this method works

The binomial sampling distribution is approximated by a normal one. Because binomial variance depends on the proportion itself, the null variance p₀q₀ and the alternative variance p₁q₁ enter separately.

Two-sided test: H₀: p = p₀ against H₁: p ≠ p₀; the α-quantile is z₁₋α/₂.

Selected method — normal approximation. The binomial is approximated by a normal distribution. Because binomial variance depends on the proportion itself, the null variance p₀q₀ and the alternative variance p₁q₁ both appear.

The approximation is unreliable when any of np₀, n(1−p₀), np₁, n(1−p₁) falls below about 5. All four are reported below, and a warning is shown when the condition fails.

Null hypothesis. H₀: p = p₀

Alternative hypothesis. Two-sided H₁: p ≠ p₀. One-sided H₁: p > p₀ or p < p₀.

Calculation procedure

  1. State the reference proportion p0 and the proportion p1 you want to detect.
  2. Take z1α/2 and z1β.
  3. Use the null variance under p0 and the alternative variance under p1 rather than one pooled value.
  4. Evaluate n=[z1α/2p0(1p0)+z1βp1(1p1)]2(p1p0)2.
  5. Round up, then inflate for dropout. Check that np0 and n(1p0) both exceed about 5, or switch to the exact method.

Exact or approximate

Approximate.

The formula shown always matches what was computed: when a one-sided test is selected the rendered quantile changes from z1−α/2 to z1−α, and where several methods exist, the formula follows the method selected in the calculator.

Advantages & limitations

Advantages

  • Closed form and reproducible by hand.
  • Adequate for mid-range proportions with moderate sample sizes.

Limitations

  • Unreliable for extreme proportions or small n.
  • Ignores the discreteness of the binomial, so the true type I error differs from nominal.

Assumptions

  • Observations are independent Bernoulli trials with constant probability.
  • Expected counts are large enough for the normal approximation to hold.
  • Simple random sampling with no clustering.

Applicable adjustments

Supports dropout inflation and, where the sampling framework applies, the finite population correction.

Conclusion

Adequate for mid-range proportions with moderate sample sizes. Check the four expected counts reported with the result; if any falls below about five, switch to the exact binomial method.

References

  1. Fleiss JL, Levin B, Paik MC. Statistical Methods for Rates and Proportions. 3rd ed. Hoboken: Wiley; 2003.
  2. Clopper CJ, Pearson ES. The use of confidence or fiducial limits illustrated in the case of the binomial. Biometrika. 1934;26(4):404–413. Link
  3. Chow S-C, Shao J, Wang H, Lokhnygina Y. Sample Size Calculations in Clinical Research. 3rd ed. Boca Raton: Chapman & Hall/CRC; 2017.