How to Calculate a Confidence Interval for a Proportion

Estimates the range that likely contains the population proportion as p̂ ± z × √(p̂(1 − p̂) ÷ n). This is what produces the margin of error quoted with opinion polls.

This turns a proportion measured in a survey into a range that plausibly contains the true proportion in the whole population. The "margin of error ±\pm3%" quoted with opinion polls comes from exactly this calculation.

p^±zp^(1p^)n\hat{p} \pm z \sqrt{\dfrac{\hat{p}(1 - \hat{p})}{n}}

Example

Of 1000 people surveyed, 40% approve, so p^=0.4\hat{p} = 0.4 and n=1000n = 1000, at a 95% confidence level.

0.4×0.61000=0.00024=0.01549\sqrt{\dfrac{0.4 \times 0.6}{1000}} = \sqrt{0.00024} = 0.01549
0.4±1.96×0.01549=0.4±0.03040.4 \pm 1.96 \times 0.01549 = 0.4 \pm 0.0304

The 95% interval runs from 36.96% to 43.04% — an approval rating of 40% with a margin of error of ±\pm3.0%.

The surprising part

The sample size you need barely depends on the size of the population. Polling 1000 people gives a margin of about ±\pm3% whether the country has 100 million people or the town has 100,000. That is the answer to the natural objection that 1000 people cannot possibly speak for a nation.

The margin is widest at p^=0.5\hat{p} = 0.5, which lets pollsters state conservatively that with n=1000n = 1000 the error is at most ±\pm3.1%, whatever the result turns out to be.

Watch out