AP Statistics · Inference for categorical data: proportions
Significance tests for proportions
1Hypotheses
A significance test assesses evidence against a claim about a parameter.
- Null hypothesis $H_0$: the claim of "no effect" or "no difference", e.g. $H_0: p = 0.5$.
- Alternative hypothesis $H_a$: what we suspect is true, e.g. $H_a: p > 0.5$ (one-sided) or $H_a: p \ne 0.5$ (two-sided).
Hypotheses are always about parameters ($p$), never statistics ($\hat{p}$), and are decided before looking at the data.
Check yourself
A coin is suspected of landing heads more than half the time. The hypotheses are:
Show the answer
H₀: p = 0.5, Hₐ: p > 0.5
Parameters, with the suspicion in Hₐ.
2The P-value
The P-value is the probability, assuming $H_0$ is true, of getting a statistic as extreme as or more extreme than the one observed (in the direction of $H_a$).
- Small P-value → the observed result would be unlikely if $H_0$ were true → evidence against $H_0$.
- Compare with the significance level $\alpha$ (often 0.05): if $P < \alpha$, reject $H_0$; otherwise fail to reject $H_0$.
We never "accept $H_0$": failing to reject means the evidence is not convincing, not that $H_0$ is true.
The P-value is the tail area beyond the observed statistic, assuming H₀ is true
Check yourself
A P-value of 0.003 means:
Show the answer
If H₀ were true, a result this extreme would happen about 0.3% of the time
Conditional on H₀.
3One-sample z-test for p
Test statistic:
$$z = \frac{\hat{p} - p_0}{\sqrt{\frac{p_0(1 - p_0)}{n}}}$$
Note the standard error uses $p_0$ (the null value), because we assume $H_0$ is true.
Conditions: random; 10%; Large Counts with $p_0$: $np_0 \ge 10$ and $n(1 - p_0) \ge 10$.
a company says half of customers prefer its new design. A random sample of 400 finds 224 prefer it. Test at $\alpha = 0.05$ whether more than half prefer it.
- $H_0: p = 0.5$, $H_a: p > 0.5$, where $p$ = the true proportion of all customers who prefer the new design.
- Conditions: random; 400 < 10% of customers; $400(0.5) = 200 \ge 10$ twice.
- $\hat{p} = 0.56$; $z = \frac{0.56 - 0.5}{\sqrt{0.25/400}} = \frac{0.06}{0.025} = 2.4$.
- P-value $= P(Z \ge 2.4) \approx 0.008$.
- Since $0.008 < 0.05$, reject $H_0$. There is convincing evidence that more than half of all customers prefer the new design.
Check yourself
In a z-test for p, the SE uses:
Show the answer
p₀
Assume H₀ is true.
4Two-sample z-test for p₁ − p₂
$H_0: p_1 - p_2 = 0$. Because $H_0$ says the proportions are equal, combine the samples into a pooled proportion:
$$\hat{p}_c = \frac{X_1 + X_2}{n_1 + n_2}, \qquad z = \frac{\hat{p}_1 - \hat{p}_2}{\sqrt{\hat{p}_c(1 - \hat{p}_c)\left(\frac{1}{n_1} + \frac{1}{n_2}\right)}}$$
in an experiment, 45 of 150 patients on a new drug improved, against 30 of 150 on a placebo.
- $H_0: p_D - p_P = 0$; $H_a: p_D - p_P > 0$.
- $\hat{p}_D = 0.30$, $\hat{p}_P = 0.20$, $\hat{p}_c = \frac{75}{300} = 0.25$.
- $SE = \sqrt{0.25(0.75)\left(\frac{2}{150}\right)} = 0.05$; $z = \frac{0.10}{0.05} = 2.0$.
- P-value $\approx 0.023 < 0.05$: reject $H_0$. Because this was a randomised experiment, there is convincing evidence the drug causes a higher improvement rate.
Check yourself
The pooled proportion for 30/100 and 50/100 is:
Show the answer
0.40
80/200.
5Connecting tests and intervals
A two-sided test at level $\alpha$ and a $(1 - \alpha)$ confidence interval agree: if $p_0$ is outside the 95% interval, a two-sided test at $\alpha = 0.05$ rejects $H_0$.
The interval adds information: it shows how big the effect plausibly is, not just whether there is one.
Check yourself
A 95% CI for p is (0.53, 0.61). A two-sided test of H₀: p = 0.5 at α = 0.05 would:
Show the answer
Reject H₀
0.5 is outside the interval.
6Going deeper: a complete one-sample test, a two-sample test and wording the conclusion
A significance test asks: if the null hypothesis were true, how likely would a result at least as extreme as the one observed be?
Hypotheses are statements about a parameter, never about a statistic.
- Null hypothesis H₀: the "no change, no difference" claim: p = p₀.
- Alternative Hₐ: what we seek evidence for: p > p₀, p < p₀ (one-sided) or p ≠ p₀ (two-sided). Decide it from the question, before looking at the data.
One-sample z test for a proportion
$$z = \frac{\hat{p} - p_0}{\sqrt{\dfrac{p_0(1 - p_0)}{n}}}$$
Conditions: Random; 10%; Large counts using p₀: np₀ ≥ 10 and n(1 − p₀) ≥ 10. (The test assumes H₀ is true, so p₀ is used throughout.)
P-value: the probability, assuming H₀ is true, of getting a statistic as extreme as or more extreme than the one observed, in the direction of Hₐ.
Decision: compare with the significance level α (commonly 0.05).
- P-value < α: reject H₀; there is convincing evidence for Hₐ.
- P-value ≥ α: fail to reject H₀; there is not convincing evidence for Hₐ.
a coin is suspected of favoring heads. In 200 tosses it gives 116 heads. Test at α = 0.05.
- State: H₀: p = 0.5; Hₐ: p > 0.5, where p = the true probability that this coin lands heads.
- Plan: one-sample z test for p. Random: the tosses are a random process. 10%: not needed (tosses are independent). Large counts: 200(0.5) = 100 and 100, both at least 10.
- Do: $\hat{p}$ = 0.58. Standard deviation under H₀ = √(0.25 ÷ 200) = 0.0354. z = (0.58 − 0.50) ÷ 0.0354 = 2.26. P-value = P(z ≥ 2.26) = 0.012.
- Conclude: because the P-value of 0.012 is less than α = 0.05, we reject H₀. There is convincing evidence that the true probability of heads for this coin is greater than 0.5.
Interpreting that P-value: "Assuming the coin is fair, there is a 0.012 probability of getting a sample proportion of heads of 0.58 or greater in 200 tosses, purely by chance."
Two-sided tests: double the one-tail area. Had the alternative been p ≠ 0.5, the P-value would be 2(0.012) = 0.024.
Two-sample z test for a difference of proportions: H₀: p₁ = p₂ (that is, p₁ − p₂ = 0). Because H₀ says the proportions are equal, the data are pooled to estimate the common value:
$$\hat{p}_C = \frac{x_1 + x_2}{n_1 + n_2}, \qquad z = \frac{\hat{p}_1 - \hat{p}_2}{\sqrt{\hat{p}_C(1 - \hat{p}_C)\left(\dfrac{1}{n_1} + \dfrac{1}{n_2}\right)}}$$
in an experiment, 45 of 150 patients given a new drug and 30 of 150 given the standard drug improve. Is there a difference at α = 0.05?
- H₀: p₁ = p₂; Hₐ: p₁ ≠ p₂, the true proportions who would improve on each drug, for patients like these.
- Conditions: random assignment; large counts with the pooled proportion (150 × 0.25 = 37.5 and 112.5 in each group).
- $\hat{p}_1$ = 0.30; $\hat{p}_2$ = 0.20; pooled = 75 ÷ 300 = 0.25.
- Standard error = √(0.25 × 0.75 × (2 ÷ 150)) = 0.05. z = 0.10 ÷ 0.05 = 2.0.
- P-value = 2 × 0.0228 = 0.046.
- Since 0.046 < 0.05, reject H₀: there is convincing evidence that the two drugs' improvement rates differ.
What a conclusion must contain
- A comparison of the P-value with α.
- The decision: reject or fail to reject H₀.
- A statement about Hₐ in context.
What a test does not show
- "Fail to reject" is not "accept H₀" or "H₀ is true." A lack of evidence against is not evidence for.
- The P-value is not the probability that H₀ is true.
- Statistical significance is not practical importance. With a very large sample, a tiny, unimportant difference can be significant.
- A test cannot repair biased data.
Tests and intervals: a two-sided test at α = 0.05 rejects H₀: p = p₀ in the same cases in which a 95% confidence interval (roughly) fails to contain p₀. The interval adds an estimate of how large the effect is.
Common mistakes
- Writing hypotheses about $\hat{p}$.
- Using $\hat{p}$ in the standard deviation of a one-sample test (use p₀).
- Not pooling in the two-proportion test.
- Choosing the alternative after seeing the data.
- Concluding "we accept the null hypothesis."
- A conclusion with no context or no link to the P-value.
- Forgetting to double for a two-sided test.
Check yourself
A test of H₀: p = 0.4 against Hₐ: p > 0.4 gives a P-value of 0.21. At α = 0.05, what is the correct conclusion?
Show the answer
Fail to reject H₀; there is not convincing evidence that p is greater than 0.4
A large P-value means the result is consistent with chance; it does not prove the null hypothesis.
7For top marks
- Use State, Plan, Do, Conclude: hypotheses with the parameter defined; procedure and conditions; test statistic and P-value; conclusion linked to $\alpha$ and in context.
- Use $p_0$ in the SE and the Large Counts check.
- Write conclusions as "convincing evidence that [Hₐ in context]" or "not convincing evidence".
- Interpret the P-value when asked: "Assuming [H₀ in context], there is a [P] probability of getting a sample proportion of [p̂] or higher by chance alone."
"Because the P-value of 0.12 is greater than α = 0.05, we fail to reject H₀. We do not have convincing evidence that the true proportion of defective items exceeds 4%."
Check yourself
Failing to reject H₀ means:
Show the answer
The data do not give convincing evidence against H₀
Not acceptance.
Now test yourself
This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.
Practise in Impera