Why there are several methods

The textbook Wald formula, p̂ ± z√(p̂(1 − p̂)/n), is simple but misbehaves with small samples or proportions near 0% or 100%. Other methods fix this. Wilson is usually the best general choice. See how to calculate a confidence interval for a proportion.

Worked examples

DataWaldWilsonExact
52 of 8054.5% to 75.5%54.1% to 74.5%53.5% to 75.3%
3 of 500% to 12.6%2.1% to 16.2%1.3% to 16.5%
0 of 200% to 0%0% to 16.1%0% to 16.8%

The last row shows the failure clearly: zero successes in 20 does not mean the true rate is exactly 0%, yet Wald says so.

Accuracy

All four match statsmodels’ proportion_confint, including its truncation at 0% and 100%. To compare two proportions, use the two-proportions calculator. For a survey-style figure, see the margin of error calculator.

Frequently asked questions

Which confidence interval is best for a proportion?

Wilson is the usual recommendation. Clopper-Pearson guarantees at least the stated coverage but tends to be wide.

What if I have zero successes?

Use Wilson or the exact method. A quick approximation is the rule of three: the one-sided 95% upper limit is about 3/n, or 15% for n = 20.

What is wrong with the Wald interval?

Its actual coverage can fall well below the stated level with small samples or extreme proportions, and it can run past 0% or 100%.