Statistics 🔬 Confidence & Inference

Inference for a Proportion

Same \( \hat{p} \), two different standard errors — and a reason each one is right.

Intro StatisticsCollege intro statistics level
Inference for a Proportion — illustration
Illustrative image (AI-generated).
💡
The big idea: A sample proportion \( \hat{p} \) estimates an unknown population proportion p, but \( \hat{p} \) wobbles from sample to sample, exactly as covered in the sampling-distributions and standard-error lessons. Hypothesis tests and confidence intervals both lean on that wobble, measured by a standard error — but they build the standard error two different ways. The test assumes a specific null value \( p_0 \) is true and uses it; the interval has no null value to assume and uses \( \hat{p} \) instead. Mixing up which one goes where is the single most common error in this topic.
🎯 By the end, you'll be able to
  • State the sampling distribution of \( \hat{p} \): mean p, standard error \( \sqrt{p(1-p)/n} \)
  • Write and use the correct test statistic for a proportion, with the standard error built from \( p_0 \)
  • Write and use the correct confidence interval for a proportion, with the standard error built from \( \hat{p} \)
  • Check the success/failure conditions against the right proportion for a test versus an interval
  • State a p-value and a confidence level in statistically correct language
📎 You should already know
  • The sampling distribution of a proportion (Central Limit Theorem)
  • Standard error
  • Hypothesis testing basics: H0, Ha, p-value, alpha
  • Confidence intervals

One \( \hat{p} \), two jobs

A sample proportion \( \hat{p} \) has its own sampling distribution: center it at the true proportion p, and its spread is the standard error \( \sqrt{p(1-p)/n} \), Normal-shaped once the conditions below hold. That machinery was built in the CLT and standard-error lessons, and this lesson does not re-derive it — it puts it to work two ways.

A hypothesis test asks whether the data are consistent with a claimed value \( p_0 \). A confidence interval asks for a plausible range of values for the unknown p. Both use a standard error built from \( \sqrt{p(1-p)/n} \) — but which p goes inside that square root is not the same for the two procedures.

🔑 The test uses p0. The interval uses p-hat. Here is why.
For the test, \( H_0 \) claims a specific value \( p_0 \). To ask \'how surprising is my data if \( H_0 \) is true?\', you build the sampling distribution assuming \( H_0 \) is true — so the standard error is computed with \( p_0 \), not \( \hat{p} \). For the interval, there is no claimed value to assume. You are trying to estimate the unknown p, so the best information you have about it is \( \hat{p} \) itself — the standard error is computed with \( \hat{p} \). Same square-root shape, different number plugged in, because the two questions are different.
\[ z = \frac{\hat{p} - p_0}{\sqrt{\dfrac{p_0(1-p_0)}{n}}} \]
The test statistic: how many standard errors p-hat sits from the claimed value p0. The standard error is built by assuming H0 is true, so it uses p0, not p-hat.

Conditions for the test

Before trusting the z above, check that the sampling distribution really is close to Normal, and that the sample is trustworthy:

  • Success/failure, checked against \( p_0 \): \( n\,p_0 \geq 10 \) and \( n(1-p_0) \geq 10 \). This course uses the \( \geq 10 \) convention throughout (some texts use 5 or 15 — stick to 10 here, consistently).
  • Random sample.
  • Independence: the sample is no more than 10% of the population, if sampling without replacement.

Notice the check uses \( p_0 \), the claimed value — not \( \hat{p} \) — because the test's whole premise is \'assume \( H_0 \) is true and see if the data fights back\'.

📝 Worked example: A cereal company claims that 50% of adults prefer its brand: \( p_0 = 0.5 \). A random survey of n = 100 adults finds 60 who prefer the brand, so \( \hat{p} = 0.60 \). Test \( H_0: p = 0.5 \) versus \( H_a: p \neq 0.5 \) at \( \alpha = 0.05 \).
  1. Conditions (checked against p0): \( n p_0 = 100(0.5) = 50 \geq 10 \) and \( n(1-p_0) = 50 \geq 10 \). Random sample assumed, and n is well under 10% of all adults. Proceed.
  2. Standard error for the test (uses p0): \( \sqrt{p_0(1-p_0)/n} = \sqrt{(0.5)(0.5)/100} = \sqrt{0.0025} = 0.05 \).
  3. Test statistic: \( z = (\hat{p} - p_0)/\text{SE} = (0.60 - 0.50)/0.05 = 2.00 \).
  4. Two-sided p-value: \( P(|Z| \geq 2.00) = 2(1 - 0.9772) \approx 0.0455 \).
  5. Decision: \( 0.0455 < 0.05 \), so reject \( H_0 \).
✓ z = 2.00, two-sided p-value ≈ 0.046. Since the p-value is below alpha = 0.05, we reject H0: the sample gives evidence the true proportion differs from 0.50.
\[ \hat{p} \;\pm\; z^{*}\sqrt{\dfrac{\hat{p}(1-\hat{p})}{n}} \]
The confidence interval: p-hat plus-or-minus a critical value z-star times a standard error built from p-hat, because there is no null value to assume.

Conditions for the interval

The interval has its own version of the same three checks — but aimed at \( \hat{p} \), not \( p_0 \), because there is no \( p_0 \) in an interval problem at all:

  • Success/failure, checked against \( \hat{p} \): \( n\hat{p} \geq 10 \) and \( n(1-\hat{p}) \geq 10 \), using the same \( \geq 10 \) convention.
  • Random sample.
  • Independence: no more than 10% of the population.
📝 Worked example: Using the same survey (n = 100, \( \hat{p} = 0.60 \)), build a 95% confidence interval for the true proportion of adults who prefer the brand.
  1. Conditions (checked against p-hat): \( n\hat{p} = 60 \geq 10 \) and \( n(1-\hat{p}) = 40 \geq 10 \). Proceed.
  2. Standard error for the interval (uses p-hat): \( \sqrt{\hat{p}(1-\hat{p})/n} = \sqrt{(0.6)(0.4)/100} = \sqrt{0.0024} \approx 0.04899 \).
  3. Margin of error: \( z^{*}\,\text{SE} = 1.96 \times 0.04899 \approx 0.09602 \).
  4. Interval: \( 0.60 \pm 0.096 \), i.e. about (0.504, 0.696).
✓ The 95% confidence interval is about (0.504, 0.696). Its standard error, 0.04899, is a different number from the test's standard error, 0.05 — one is built from p-hat, the other from p0. Swapping them would not just be sloppy rounding; it changes both answers.
⚠️ Do not swap the two standard errors
WRONG: writing the test statistic as \( (\hat{p}-p_0)/\sqrt{\hat{p}(1-\hat{p})/n} \) — plugging \( \hat{p} \) into the test's denominator. RIGHT: the test's standard error uses \( p_0 \), because it is built by assuming \( H_0 \) is true.
WRONG (the mirror-image mistake): writing the confidence interval as \( \hat{p} \pm z^{*}\sqrt{p_0(1-p_0)/n} \). RIGHT: the interval's standard error uses \( \hat{p} \) — there is no null value in an interval problem to plug in at all.
⚠️ What a p-value means, what \'reject\' means, and what a confidence interval does not promise
WRONG: \'the p-value is the probability that \( H_0 \) is true.\' RIGHT: the p-value is \( P(\text{data at least this extreme} \mid H_0) \) — a statement about the data assuming \( H_0 \), not a statement about \( H_0 \) itself. It is P(data | H0), never P(H0 | data).
WRONG: \'since p > alpha, we accept \( H_0 \).\' RIGHT: we fail to reject \( H_0 \) — insufficient evidence against it, never proof that it is true.
WRONG: \'there is a 95% probability that p lies in this interval.\' RIGHT: the 95% describes the procedure — repeated over many samples, about 95% of the intervals it builds capture the true p. Any one interval you compute is a single outcome of that long-run game, not a 95%-likely event.
⚠️ Check conditions against the proportion that matches the procedure
WRONG: checking the success/failure condition for the test using \( \hat{p} \) (or checking it once and reusing the same numbers for both procedures). RIGHT: for the test, check \( n p_0 \geq 10 \) and \( n(1-p_0) \geq 10 \), against the claimed value. For the interval, check \( n\hat{p} \geq 10 \) and \( n(1-\hat{p}) \geq 10 \), against the sample value. The two checks can even disagree — a claim \( p_0 \) far from the observed \( \hat{p} \) can pass one check and fail the other.
🎮 Interactive: the null distribution and the p-value LIVE
This widget draws the generic standard Normal null distribution — the shape any z-statistic is compared against once it has been standardized. Slide the observed z to see the shaded tail area (the p-value) and the decision at your chosen alpha. The widget does not compute p-hat or the standard error for you: you supply z from the proportion formulas above, using p0 for a test statistic exactly as worked through in this lesson.

Check your understanding

1. You are testing \( H_0: p = p_0 \) against \( H_a: p \neq p_0 \). Which standard error belongs in the test statistic?
The test assumes H0 is true, so the sampling distribution — and its standard error — is built from p0, not from p-hat.
2. For the survey with n = 100 and p-hat = 0.60, which value is closest to the 95% confidence interval's margin of error?
SE = sqrt(0.6 x 0.4 / 100) = 0.04899, and margin = 1.96 x 0.04899 = 0.096.
3. A test of a proportion returns p-value = 0.03 at alpha = 0.05. Which conclusion is correctly worded?
0.03 < 0.05, so we reject H0. The correct language is 'evidence against H0', never a probability that H0 is true or false, and never 'accept'.
4. Which pair of conditions must be checked for a one-proportion hypothesis TEST to trust the Normal approximation?
The test's conditions are checked against p0, the value H0 claims — not against p-hat, which is reserved for the interval's conditions.
✅ Key takeaways
  • The test statistic for a proportion uses p0 in the standard error, because H0 assumes p = p0 is true.
  • The confidence interval uses p-hat in the standard error, because there is no null value to assume.
  • Success/failure conditions are checked against p0 for the test and against p-hat for the interval, both using this course's n >= 10 convention.
  • A p-value is P(data | H0), not the probability H0 is true; a small p-value means 'reject H0', a large one means 'fail to reject H0' — never 'accept H0'.
  • '95% confidence' describes the long-run capture rate of the procedure, not the probability that one specific interval contains p.