p̂ ± z · √(p̂(1 − p̂) / n)
Holds when the sample is drawn at random, the answers are independent of each other, and n · p̂(1 − p̂) is
not too small — a common rule of thumb is at least 10.
p̂ (p-hat) is the proportion in the sample, n the sample size and z the critical value for the
confidence level: 1.645 for 90%, 1.96 for 95% and 2.576 for 99%. The square root is the standard error of
the proportion, and z times the standard error is the margin of error.
400 people asked, 144 say yes (36%), 95% confidence:
the standard error is √(0.36 · 0.64 / 400) = √0.000576 = 0.024, the margin 1.96 · 0.024 ≈ 0.047, and the
interval 0.36 ± 0.047 — from 31.3% to 40.7%.
The card works out the upper limit and prints the lower one beside it.
The root covers n as well
The slip that gives an impossibly narrow interval is dividing by n outside the root:
|
Working |
Margin of error |
| Wrong |
1.96 · √(0.36 · 0.64) / 400 |
±0.2 percentage points |
| Right |
1.96 · √(0.36 · 0.64 / 400) |
±4.7 percentage points |
A margin of ±0.2 points from 400 people is a sign that n has landed in the wrong place. With the root over
the whole fraction, precision grows with √n: four times the sample halves the margin.
A small sample
60 people asked, 3 say yes: p̂ = 0.05. The formula gives 0.05 ± 1.96 · √(0.05 · 0.95 / 60) ≈ 0.05 ± 0.055,
and the lower limit falls below zero. A proportion cannot be negative, so the result is telling you the
approximation does not carry here: n · p̂(1 − p̂) = 60 · 0.05 · 0.95 ≈ 2.9, far below the rule of thumb’s 10.
For counts that small other intervals are used, such as the Wilson interval, which handles proportions near
0 and 1 better.
The margin at 50%
At p̂ = 0.5 the product p̂(1 − p̂) is at its largest, so the margin there is the widest a survey of that size
can have:
| n |
Margin of error (95%) |
| 100 |
±9.8 percentage points |
| 400 |
±4.9 percentage points |
| 1,000 |
±3.1 percentage points |
| 2,500 |
±2.0 percentage points |
To go the other way — how many people to ask for a given margin — see
sample size for a proportion. If it is the
population’s proportion that is known, and the question is where a sample’s proportion will land, that is
the prediction interval for a proportion:
the same arithmetic with p in place of p̂.
Common mistakes
- Percentages and decimals mixed. 36 and 0.64 under the same root give nonsense; work wholly in decimals
or wholly in percentages.
- n outside the root. The margin comes out √n times too small — twenty times, with 400 answers.
- The wrong z. 1.96 belongs to 95%. With 2.576 you get a 99% interval, which is wider.
- Reading the interval as a probability about p. See the first question below.
Questions people ask
Does 95% mean p is in the interval with probability 95%?
Not quite. The population’s proportion is a fixed number that is either in the interval or not. What has
a 95% probability is the method: draw many samples, build an interval from each, and about 95 in 100 of
them catch the true proportion.
How is this different from a confidence interval for a mean?
In the spread. For a mean you need the sample’s standard deviation; for a proportion the spread follows
from the proportion itself, √(p̂(1 − p̂)/n). The version for a mean is on the
confidence interval page.
Two parties are 2 points apart and the margin is 3. Is the gap real?
The two intervals on their own cannot settle it. The difference between two proportions has its own
margin of error, and it is larger than either of the two.
Does the size of the population matter?
Only when the sample is a large part of it. The formula assumes the population is much larger than the
sample, and then 1,000 people chosen at random give the same precision in a town as in a whole country.