Proportions: One and Two Groups
Find the smallest sample size needed for an exact Clopper–Pearson confidence interval for a single population proportion to reach a specified width or one-sided distance from the sample proportion to the confidence limit, at a stated confidence level.
Using the relationship between the F distribution and the cumulative binomial distribution, the exact (Clopper–Pearson) 100(1 − α)% confidence limits for a proportion p, based on r successes out of n, are equivalently written using the Beta distribution:
For one-sided limits, α/2 is replaced by α, and the reported quantity is the distance from the planning proportion to the single limit rather than the full two-sided width.
Because the planned sample size is not yet an integer count of successes, the calculator evaluates these Beta quantiles at the continuous count r = P × n directly, rather than rounding r to the nearest integer at each candidate n. This matches the convention used by PASS and avoids a discreteness artifact: rounding r to an integer can make the achieved width behave non-monotonically in n, so that a search which stops at the very first n whose (rounded-r) width dips below the target can land on a value smaller than the one PASS reports. Evaluating r continuously keeps the achieved width monotonically decreasing in n and reproduces PASS's published sample sizes exactly (verified below).
The procedure assumes the future sample proportion will equal the planning value P. If the observed proportion differs from P, the achieved interval width may be narrower or wider than specified.
PASS Chapter 115, Example 1, plans a two-sided 95% exact confidence interval with a target width of 0.06 across a range of planning proportions. PASS reports required sample sizes of 417, 715, 928, 1056, and 1098 for P = 0.1, 0.2, 0.3, 0.4, and 0.5 respectively; this calculator reproduces all five exactly, along with PASS's additional target widths of 0.04 (N = 2065 at P = 0.3) and 0.10 (N = 341 at P = 0.3).
PASS Chapter 115, Example 2 (based on Fleiss, Levin & Paik (2003), pp. 22–23), plans a one-sided lower-limit interval with P = 0.92 and a target distance of 0.15104; PASS and this calculator both return N = 25. Example 4 (based on Lachin (2000), p. 19) plans a one-sided upper-limit interval for zero observed events (P = 0) with a target distance of 0.01; PASS and this calculator both return N = 299.
Fleiss, J. L., Levin, B., Paik, M. C. (2003). Statistical Methods for Rates and Proportions. Third Edition. John Wiley & Sons, New York.
Newcombe, R. G. (1998). Two-Sided Confidence Intervals for the Single Proportion: Comparison of Seven Methods. Statistics in Medicine, 17, 857–872.
Lachin, J. M. (2000). Biostatistical Methods: The Assessment of Relative Risks. John Wiley & Sons, New York.
Hintze, J. L. (2008). PASS User's Guide III. NCSS. Chapter 115, “Confidence Intervals for One Proportion.”