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.
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 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 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.
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 , or 60%, which is 0.1 above the assumed value. The standard error is , about 0.035355, so z is , 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.
The normal approximation needs a reasonable sample. A common guide is that both and 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.