Confidence interval for a proportion
A confidence interval for a proportion is p-hat +/- z * sqrt(p-hat * (1 - p-hat) / n), where p-hat is the sample proportion and z is 1.96 for 95% confidence. It is valid when the sample has at least about 10 successes and 10 failures.
Syntax
CI = p-hat +/- z * sqrt( p-hat * (1 - p-hat) / n )| Part | What it is |
|---|---|
p-hat | the sample proportion, successes / n |
n | the sample size |
z | 1.645 for 90%, 1.96 for 95%, 2.576 for 99% |
Examples
40 of 100 customers said yes: p-hat = 0.4, 95%
SE = sqrt(0.4 * 0.6 / 100) = 0.049
margin = 1.96 * 0.049 = 0.096Result: 0.304 to 0.496, i.e. 30.4% to 49.6%
200 of 400: p-hat = 0.5, 95%
SE = sqrt(0.25 / 400) = 0.025; margin = 1.96 * 0.025Result: 0.451 to 0.549
Excel for the 40 of 100 case
=0.4 - NORM.S.INV(0.975) * SQRT(0.4 * 0.6 / 100)Result: 0.304 (lower bound)
Common mistakes
- Using a t value; proportions use z because the standard error comes from p-hat itself, not from a separate sd estimate.
- Applying the formula with 2 successes in 15 trials; with fewer than about 10 successes or failures use the Wilson or exact interval instead.
- Reporting a bound outside 0 to 1; if that happens the normal approximation is not appropriate for that sample.
Practice Confidence interval for a proportion
These drills check your answer on live data, free, no account needed.
- Confidence interval for a proportionIn a random sample of 200 customers, 35 say they used the mobile app last month. What is the lower limit of a 99% confidence interval for the population proportion? Give it as a proportion. Round to 4 decimal places.
Questions
What is the margin of error for a proportion?
z * sqrt(p-hat (1 - p-hat) / n). It is largest when p-hat = 0.5, which is why sample size planning uses 0.5 as the conservative guess.
How big a sample do I need for a 3% margin of error?
At 95% confidence with p = 0.5, n = 1.96^2 * 0.25 / 0.03^2 = 1,068. That is why national polls use about 1,000 people.
Related
- Margin of errorMargin of error is the critical value times the standard error: z times sqrt(p(1 - p) / n) for a proportion, t times s over root n for a mean. Poll examples.
- Sample sizeSample size formulas n = (z sigma / E)^2 for a mean and n = z^2 p(1 - p) / E^2 for a proportion, worked examples giving 97 and 385, and rounding rules.
- Two-proportion z-testHow to test whether two proportions differ with the two-proportion z-test: pooled proportion, standard error, z statistic and p-value, with a worked example.
- Confidence interval for a meanHow to calculate a confidence interval for a mean with x-bar plus or minus t times s over root n, a full 95% example, when to use z, and Excel CONFIDENCE.T.
Previous: Confidence interval for a meanNext: Margin of error