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
Three things have to hold before any of the machinery below is trustworthy, and the first one is not a formula at all. The data must come from a random sample of the population you want to describe. Nothing further down this page can rescue a sample that was not random, and nothing on this page pretends to.
The sample must also be small next to the population, so that drawing people without replacing them barely changes the spread. The usual bar is a population at least ten times the sample, and Moore, McCabe and Craig set it at twenty. Survey 400 people in a town of 900 and you have broken it; the real standard error is then smaller than the formula reports, and the interval you print is wider than it needs to be.
Third, the counts have to be large enough on both sides for the normal approximation to have room. Here the interval and the test part company, and so do the textbooks.
For a confidence interval, count what you actually observed. Introduction to the Practice of Statistics asks for at least 15 successes and 15 failures. OpenIntro Statistics and the AP-style texts ask for 10 of each. Both numbers are in wide use, so answer with the one your own course teaches, and read the gap between them as a warning: an interval built on twelve successes is doing more work than it can comfortably support.
For a test, count what H₀ predicts instead, since a test assumes H₀ is true: np₀ ≥ 10 and n(1 − p₀) ≥ 10. The two texts agree on that one.
The interactive below keeps its condition light on the 10 rule in both directions. Every worked number on this page and every link into it was drawn that way, and moving a threshold without saying so is how a page loses a reader's trust. So read the light as a floor rather than a certificate. Amber means you have failed even the loosest rule in circulation; green means you have cleared it, not that your course's rule is met.
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 honest footnote on the interval. Even with the counts well clear of any of these bars, p̂ ± z*√(p̂(1 − p̂)/n) covers the true proportion slightly less often than its label promises, and the shortfall does not fade away as n grows so much as oscillate with it. The cheapest repair is the plus-four interval: add two successes and two failures to the data, then run the same formula on the padded counts. The questions at the foot of this page say more about that repair and about the Wilson interval, which is the version most software now reports.
🎮 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.
Problem 22 in the practice problems carries 450 clinic reminders through the pooled test and the unpooled interval side by side, and its fourth part asks the question this lesson keeps circling: why the two standard errors are not the same number.
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.