Inference for Proportions
A proportion is a mean in disguise. Score every success as 1 and every failure as 0, average them, and you have p̂. That one observation lets every tool from the last few lessons carry straight over, with one adjustment: the spread of a proportion is decided by the proportion itself, so you never have to estimate it separately.
The sampling distribution of p̂
Take a random sample of size n from a population in which a fraction p would say yes. The count of yes answers is binomial, and the sample proportion is that count divided by n. Dividing by a constant rescales the mean and the standard deviation, which gives:
mean of p̂ = p SD of p̂ = √(p(1 − p) / n)
So p̂ is unbiased, and its spread shrinks with √n exactly as the sample mean's does. The shape is the part that needs care. A binomial count turns normal as n grows, but a proportion near 0 or 1 is squeezed against a boundary and stays lopsided far longer than one near the middle.
Conditions for inference
Two things have to hold before any of the machinery below is trustworthy. The data must come from a random sample of the population you want to describe, which no formula can rescue. And the sample must contain at least 10 successes and at least 10 failures, so that the normal approximation has room on both sides. When you are testing a hypothesized value the count is checked against that value instead: np₀ ≥ 10 and n(1 − p₀) ≥ 10.
The condition is about both counts, never about n alone. A sample of 500 with 4 successes fails it, which is why a rare outcome needs a large study before you can say anything with a z.
🎮 One Proportion, or Two
Set the counts and read off the interval and the test. The condition light turns amber whenever a group holds fewer than 10 successes or fewer than 10 failures.
A confidence interval for one proportion
The interval has the shape every interval in this course has, an estimate plus or minus a margin:
p̂ ± z* √(p̂(1 − p̂) / n)
Suppose 232 of 400 sampled students say they would use a late-night bus. Then p̂ = 0.58, the standard error is √(0.58 × 0.42 / 400) = 0.0247, and with z* = 1.96 the margin of error is 0.0484. The interval runs from 0.532 to 0.628, so somewhere between 53% and 63% of the student body would use the bus. Report it as a percentage range and nobody has to squint at a decimal.
A test for one proportion
Testing works the same way, with one change that costs marks on exams every year. A hypothesis test assumes H₀ is true, and for a proportion H₀ names an exact value p₀, which pins down the standard deviation as well as the center. So the test uses p₀ in the standard error where the interval used p̂:
z = (p̂ − p₀) / √(p₀(1 − p₀) / n)
For the bus survey against H₀: p = 0.5, the denominator is √(0.25/400) = 0.025, giving z = (0.58 − 0.50)/0.025 = 3.20 and a two-sided p-value of 0.0014. A majority is real, not a sampling accident. The two standard errors differ here in the third decimal, but when p̂ sits far from p₀ they can disagree enough to matter, and using the wrong one is marked wrong even when the conclusion survives.
Comparing two proportions
Two independent samples, two proportions, and the quantity of interest is their difference p̂₁ − p̂₂. Variances of independent quantities add, so the standard error of the difference is the square root of the sum:
SE = √(p̂₁(1 − p̂₁)/n₁ + p̂₂(1 − p̂₂)/n₂)
Take 45 successes out of 120 in one group and 72 out of 150 in the other, so p̂₁ = 0.375 and p̂₂ = 0.480. The difference is −0.105 with a standard error of 0.0601, and the 95% interval runs from −0.223 to 0.013. It contains zero, so the data are consistent with no difference at all.
The test again does something different, and for a reason worth understanding. H₀ says the two population proportions are equal, so under H₀ there is only one proportion in the world, and the best estimate of it uses everybody: the pooled proportion p̂ = (x₁ + x₂)/(n₁ + n₂) = 117/270 = 0.433. That single value goes into both halves of the standard error:
z = (p̂₁ − p̂₂) / √(p̂(1 − p̂)(1/n₁ + 1/n₂))
which gives 0.0607 for the denominator and z = −1.73, two-sided p = 0.084. Interval and test agree, as they must: the interval covers zero and the test fails to reject.
Why χ² on a 2×2 table is this same test
Those same 270 people can be written as a two-by-two table of successes and failures by group, and a chi-square test of independence on that table asks precisely the question the pooled z test just asked. The two are not merely similar. They are algebraically the same test, and
χ² = z² with 1 degree of freedom
Here z = −1.7301 and χ² = 2.9932, which is 1.7301² to every decimal either statistic prints, and both report p = 0.084. The identity holds for any 2×2 table, and it is the same one connecting the two distributions in the statistical tables. Use whichever you like, with one practical difference: the z version gives you a signed difference and a confidence interval, and χ² gives you neither. That is a good reason to prefer the two-proportion z when the table really is 2×2.
Why it matters: proportions are what surveys, clinical trials and A/B tests actually produce. The interval says how precisely you know the percentage; the test says whether a difference is worth talking about. Both need the same two conditions, and neither can repair a sample that was not random.
Common questions
Why does the confidence interval use p-hat but the test uses p-nought?
Because a proportion's spread is decided by the proportion itself. The standard deviation of p̂ is the square root of p(1−p)/n, so naming a value for p also names the standard error. A hypothesis test assumes H₀ is true, and H₀ supplies p₀, so the test has a value to use and should use it. A confidence interval assumes nothing, so it has only the data's own p̂ to substitute. When p̂ sits close to p₀ the two standard errors barely differ, and when it sits far away they can differ enough to move the conclusion.
My sample has only 4 successes out of 300. Can I still build an interval?
Not with the normal-based formula, because the success-failure condition needs at least 10 of each and no sample size repairs that. With 4 successes the sampling distribution is pressed against zero and cannot be symmetric. Two honest ways forward: report an exact binomial (Clopper-Pearson) interval, which most software offers and which stays valid at any count, or use the Wilson score interval, which behaves far better than the textbook formula near the boundaries. Both will be asymmetric around p̂, and that asymmetry is the correct answer rather than a defect.
If chi-square and the two-proportion z test are the same test, which should I report?
For a 2×2 table, prefer the z test. The two are algebraically identical, χ² equals z squared on one degree of freedom, and they return the same p-value to every decimal. What differs is what each one hands you afterwards. The z test gives a signed difference and a confidence interval for that difference, which is what a reader needs in order to judge whether the gap matters. Chi-square returns a positive number with no direction and no interval. Once the table is larger than 2×2 the z test is no longer available and chi-square is the tool.