Test for a Population Proportion

Tests whether an observed proportion differs from an assumed one, comparing z = (sample proportion − assumed proportion) ÷ √(assumed × (1 − assumed) ÷ n) against the standard normal distribution.

Toss a coin 200 times and see 120 heads. Is the coin biased? Testing whether an observed proportion differs from an assumed one is what this test does.

z=p^p0p0(1p0)nz = \dfrac{\hat{p} - p_0}{\sqrt{\dfrac{p_0(1 - p_0)}{n}}}

The numerator is the gap between what was observed and what was assumed. The denominator is the standard error of that gap, in other words the size of a gap that chance alone could produce. Dividing one by the other measures whether the gap stays within what chance explains or goes beyond it.

Using p0p_0 rather than the sample proportion in the denominator is the important detail. The test asks what would happen if the assumption that the population proportion equals p0p_0 were true, so the standard error is built under that assumption. A confidence interval does the opposite and uses the sample proportion, which makes this an easy place to slip.

Example

Take the defaults: a sample of 200 with 120 successes, an assumed proportion of 50%, and a significance level of 5%.

The sample proportion is 120÷200120 \div 200, or 60%, which is 0.1 above the assumed value. The standard error is 0.5×0.5÷200\sqrt{0.5 \times 0.5 \div 200}, about 0.035355, so z is 0.1÷0.0353550.1 \div 0.035355, about 2.8284.

The two-sided p-value is about 0.004678, and the critical value is 1.9600. Since the magnitude of z exceeds it, at the 5% level the conclusion is that the proportion cannot be taken as 50%.

That p-value says that if the true proportion really were 50%, a gap this large would arise by chance only about 0.47% of the time.

Points to watch

The normal approximation needs a reasonable sample. A common guide is that both np0n p_0 and n(1p0)n(1 - p_0) should be at least 5. Here both are 100, comfortably clear.

The p-value shown is two-sided. Asking a directional question, such as whether the proportion exceeds 50%, makes it a one-sided test and halves the p-value. The direction must be fixed before looking at the data, though; picking the convenient side afterwards simply biases the test towards significance.

Failing to reach significance is not proof that there is no difference. It only means none was found.