Confidence Intervals and Hypothesis Tests for the Difference of Two Population Proportions
students, imagine two school clubs want to know which one has a higher success rate 🎯. Maybe one club is trying two study methods, or a school wants to compare the percent of students who prefer online homework versus paper homework. In AP Statistics, comparisons like these are common because we often want to compare two groups, not just one.
In this lesson, you will learn how to build a confidence interval for the difference of two population proportions and how to perform a hypothesis test for that difference. By the end, you should be able to:
- Explain what the difference of two population proportions means.
- Check the conditions needed for inference.
- Compute and interpret a confidence interval for $p_1 - p_2$.
- Perform a hypothesis test for $p_1 - p_2$.
- Connect confidence intervals and hypothesis tests to the broader AP Statistics topic of categorical data inference.
This topic is important because it helps you compare two population proportions using sample data and make a statistical conclusion rather than guessing. 📊
Understanding the Difference of Two Proportions
A population proportion is the fraction of people in a population with a certain characteristic. For example, if $p_1$ is the proportion of all students at one school who own a smartphone and $p_2$ is the proportion at another school who own a smartphone, then the parameter of interest is the difference $p_1 - p_2$.
This difference tells us how much the two populations differ. If $p_1 - p_2$ is positive, the first population has a higher proportion. If $p_1 - p_2$ is negative, the second population has a higher proportion. If the difference is close to $0$, the two proportions may be similar.
In practice, we usually do not know the true values of $p_1$ and $p_2$. Instead, we use sample proportions:
- $\hat{p}_1 = \frac{x_1}{n_1}$
- $\hat{p}_2 = \frac{x_2}{n_2}$
where $x_1$ and $x_2$ are the numbers of “successes” in samples of sizes $n_1$ and $n_2$.
The sample difference $\hat{p}_1 - \hat{p}_2$ is used to estimate $p_1 - p_2$.
Example: Suppose $58$ out of $100$ students in School A prefer online notes, and $42$ out of $100$ students in School B prefer online notes. Then
$$\hat{p}_1 = \frac{58}{100} = 0.58$$
$$\hat{p}_2 = \frac{42}{100} = 0.42$$
$$\hat{p}_1 - \hat{p}_2 = 0.16$$
This sample suggests that School A’s proportion is $0.16$ higher than School B’s. But we need inference to decide whether that difference is likely due to chance or reflects a real difference in the populations.
Confidence Intervals for $p_1 - p_2$
A confidence interval gives a range of plausible values for the true difference $p_1 - p_2$. In AP Statistics, a two-sample confidence interval for proportions has the form
$$\left(\hat{p}_1 - \hat{p}_2\right) \pm z^*\sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1}+\frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}$$
The term under the square root is the standard error, which measures typical sample-to-sample variation in $\hat{p}_1 - \hat{p}_2$.
The critical value $z^*$ comes from the standard normal distribution and depends on the confidence level. For example:
- $z^* \approx 1.645$ for a $90\%$ confidence interval
- $z^* \approx 1.96$ for a $95\%$ confidence interval
- $z^* \approx 2.576$ for a $99\%$ confidence interval
Conditions for a Confidence Interval
Before using the formula, check these conditions:
- Random: Both samples or groups should be randomly selected or from a randomized experiment.
- Independent: The two samples should be independent of each other.
- 10% condition: If sampling without replacement, each sample size should be no more than $10\%$ of its population.
- Large counts condition: Each sample must have at least $10$ successes and $10$ failures:
- $n_1\hat{p}_1 \ge 10$ and $n_1(1-\hat{p}_1) \ge 10$
- $n_2\hat{p}_2 \ge 10$ and $n_2(1-\hat{p}_2) \ge 10$
These conditions help the normal approximation work well.
Interpretation of a Confidence Interval
Suppose a $95\%$ confidence interval for $p_1 - p_2$ is $(0.05, 0.27)$. This means we are $95\%$ confident that the true difference in population proportions is between $0.05$ and $0.27$.
Important AP Statistics interpretation rule: do not say there is a $95\%$ probability that $p_1 - p_2$ is in the interval. The parameter is fixed; the interval is what changes from sample to sample.
If the interval does not contain $0$, that suggests a difference between the population proportions. If the interval includes $0$, then a difference of $0$ is plausible, so the data do not show a clear difference.
Example: If a $95\%$ confidence interval for $p_1 - p_2$ is $(-0.08, 0.12)$, then $0$ is in the interval. That means the true difference could be negative, positive, or zero. The samples do not provide strong evidence of a difference.
Hypothesis Tests for $p_1 - p_2$
A hypothesis test asks whether the data provide convincing evidence for a claim about the population proportions. For two proportions, the null hypothesis often states no difference:
$$H_0: p_1 - p_2 = 0$$
The alternative hypothesis can be one of three forms:
$$H_a: p_1 - p_2 \ne 0$$
$$H_a: p_1 - p_2 > 0$$
$$H_a: p_1 - p_2 < 0$$
The choice depends on the wording of the question.
The test statistic for comparing two proportions is
$$z = \frac{(\hat{p}_1 - \hat{p}_2) - (p_1 - p_2)_0}{\sqrt{\hat{p}(1-\hat{p})\left(\frac{1}{n_1}+\frac{1}{n_2}\right)}}$$
where $\hat{p}$ is the pooled proportion:
$$\hat{p} = \frac{x_1+x_2}{n_1+n_2}$$
The pooled proportion is used in the standard error for the hypothesis test because under the null hypothesis, we assume $p_1 = p_2$.
Conditions for a Hypothesis Test
The first three conditions are the same as for a confidence interval:
- Random
- Independent
- $10\%$ condition
For the large counts condition in a two-proportion $z$-test, use the pooled proportion:
- $n_1\hat{p} \ge 10$
- $n_1(1-\hat{p}) \ge 10$
- $n_2\hat{p} \ge 10$
- $n_2(1-\hat{p}) \ge 10$
These conditions make the normal approximation appropriate for the test statistic.
Example of a Hypothesis Test
Suppose a teacher wants to know whether a new review game increases the proportion of students passing a quiz. Group 1 uses the game and Group 2 does not.
- Group 1: $45$ passes out of $60$, so $\hat{p}_1 = 0.75$
- Group 2: $36$ passes out of $60$, so $\hat{p}_2 = 0.60$
The hypotheses are:
$$H_0: p_1 - p_2 = 0$$
$$H_a: p_1 - p_2 > 0$$
First find the pooled proportion:
$$\hat{p} = \frac{45+36}{60+60} = \frac{81}{120} = 0.675$$
Then compute the test statistic:
$$z = \frac{(0.75-0.60)-0}{\sqrt{0.675(1-0.675)\left(\frac{1}{60}+\frac{1}{60}\right)}}$$
If the resulting $z$ is large and positive, the $p$-value will be small, which gives evidence against $H_0$ and in favor of the review game helping students pass.
Interpreting a P-value
The $p$-value is the probability, assuming $H_0$ is true, of getting a sample difference at least as extreme as the one observed.
If the $p$-value is small, the observed result would be unusual if $H_0$ were true. That gives evidence against $H_0$.
A common AP Statistics rule is to compare the $p$-value to a significance level $\alpha$:
- If $p\text{-value} < \alpha$, reject $H_0$
- If $p\text{-value} \ge \alpha$, fail to reject $H_0$
A typical significance level is $\alpha = 0.05$, but the problem will tell you what to use.
How Confidence Intervals and Hypothesis Tests Connect
Confidence intervals and hypothesis tests are closely related. They answer different questions, but they often lead to similar conclusions.
- A confidence interval estimates the size of the difference.
- A hypothesis test checks whether the difference is statistically significant.
A useful connection:
- If a $95\%$ confidence interval for $p_1 - p_2$ does not include $0$, then a two-sided hypothesis test at $\alpha = 0.05$ would reject $H_0: p_1 - p_2 = 0$.
- If the interval includes $0$, then the two-sided test at $\alpha = 0.05$ would fail to reject $H_0$.
This connection works for matching confidence levels and significance levels, such as $95\%$ and $0.05$.
Example: A $95\%$ confidence interval for $p_1 - p_2$ is $(0.02, 0.18)$. Because $0$ is not in the interval, there is evidence that the two population proportions differ. A two-sided test with $\alpha = 0.05$ would likely reject $H_0$.
Common AP Statistics Mistakes to Avoid
students, many students lose points by mixing up the formulas or interpretations. Watch for these common errors:
- Using the pooled proportion in a confidence interval. The pooled proportion is for hypothesis tests, not confidence intervals.
- Forgetting to check conditions.
- Writing conclusions that say the sample proportion is equal to the population proportion. Samples estimate populations, but they are not the same.
- Saying “accept $H_0$” instead of “fail to reject $H_0$.” AP Statistics uses the phrase fail to reject because the evidence may simply be weak, not because $H_0$ has been proven true.
- Interpreting a confidence interval as a probability statement about a fixed parameter.
A good conclusion in AP Statistics should be in context. For example, say “There is convincing evidence that the proportion of students who prefer online notes is greater at School A than at School B,” not just “reject the null.”
Conclusion
Confidence intervals and hypothesis tests for $p_1 - p_2$ help you compare two population proportions using sample data. Confidence intervals estimate how large the difference may be, while hypothesis tests decide whether the data provide convincing evidence of a real difference.
Both procedures depend on randomization, independence, and large counts. Both fit into the broader AP Statistics unit on inference for categorical data because they use sample proportions to draw conclusions about populations. When you understand the meaning of $p_1 - p_2$, the role of $\hat{p}_1 - \hat{p}_2$, and the difference between pooled and unpooled standard errors, you are ready to handle many AP Statistics problems involving two proportions. âś…
Study Notes
- The parameter for comparing two proportions is $p_1 - p_2$.
- The sample statistic is $\hat{p}_1 - \hat{p}_2$.
- A confidence interval for $p_1 - p_2$ uses an unpooled standard error.
- A hypothesis test for $p_1 - p_2$ uses a pooled standard error under $H_0$.
- For a two-proportion $z$-interval:
$$\left(\hat{p}_1 - \hat{p}_2\right) \pm z^*\sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1}+\frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}$$
- For a two-proportion $z$-test:
$$z = \frac{(\hat{p}_1 - \hat{p}_2) - (p_1 - p_2)_0}{\sqrt{\hat{p}(1-\hat{p})\left(\frac{1}{n_1}+\frac{1}{n_2}\right)}}$$
- The pooled proportion is
$$\hat{p} = \frac{x_1+x_2}{n_1+n_2}$$
- Check $\,$Random, Independence, $10\%$ condition, and Large Counts before doing inference.
- If a $95\%$ confidence interval for $p_1 - p_2$ does not include $0$, a two-sided test at $\alpha = 0.05$ rejects $H_0$.
- If a confidence interval includes $0$, the data do not show a statistically significant difference at that matching level.
- Always state conclusions in context and use the wording fail to reject $H_0$ when appropriate.
