6. Inference for Categorical Data(COLON) Proportions

Carrying Out A Test For The Difference Of Two Population Proportions

Carrying Out a Test for the Difference of Two Population Proportions 📊

When students compares two groups, a big question is often: is one group really different from the other, or did the difference happen just by random chance? In AP Statistics, this is exactly what a test for the difference of two population proportions helps us decide. These tests show up in real life all the time, from comparing approval ratings in two cities to checking whether two teaching methods lead to different pass rates.

What this test is asking

A population proportion is the fraction of a whole population that has a certain trait. For example, the proportion of all students at a school who prefer online homework might be $p$. When there are two populations, we usually call the proportions $p_1$ and $p_2$. The parameter of interest is often the difference $p_1-p_2$.

The most common null hypothesis for this test is that the two population proportions are equal. That means the difference is zero:

$$H_0: p_1-p_2=0$$

The alternative hypothesis depends on the question. It may be one-sided or two-sided:

$$H_a: p_1-p_2>0$$

$$H_a: p_1-p_2<0$$

$$H_a: p_1-p_2\ne 0$$

For example, imagine students is comparing whether students in School A and School B prefer a new lunch menu. If the question is whether the proportions are different, then the alternative is $H_a: p_1-p_2\ne 0$.

The logic behind the test

A significance test asks whether the sample result would be unusual if the null hypothesis were true. If the sample difference in proportions is far from $0$, that may be evidence against $H_0$.

The sample proportions are

$$\hat p_1=\frac{x_1}{n_1}$$

and

$$\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 statistic is the difference

$$\hat p_1-\hat p_2$$

This statistic measures how far apart the sample proportions are. But because samples vary from chance, the difference alone does not prove that the populations are different. The test uses a standardized score called the $z$ statistic.

Conditions you must check first

Before students can trust the results of the test, several conditions should be met.

1. Random condition

The data should come from random samples or a randomized experiment. Randomness helps make the results representative and reduces bias.

2. Independence condition

The observations should be independent within each sample and between the two groups. If sampling without replacement, the sample size should be less than $10\%$ of the population for each group:

$$n_1\le 0.1N_1$$

$$n_2\le 0.1N_2$$

3. Large Counts condition

For a two-proportion $z$ test, the expected number of successes and failures in each group must be large enough. Because the null hypothesis usually says $p_1=p_2$, the pooled proportion is used:

$$\hat p=\frac{x_1+x_2}{n_1+n_2}$$

Then check:

$$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 matter because the test relies on a Normal model for the sampling distribution.

The test statistic and pooled proportion

The test for two proportions uses a pooled estimate of the common proportion under $H_0$. That is why the standard error for the test is different from the standard error used for a confidence interval.

The pooled proportion is

$$\hat p=\frac{x_1+x_2}{n_1+n_2}$$

and the standard error is

$$SE=\sqrt{\hat p(1-\hat p)\left(\frac{1}{n_1}+\frac{1}{n_2}\right)}$$

The test statistic is

$$z=\frac{(\hat p_1-\hat p_2)-0}{SE}$$

The value $0$ appears because the null hypothesis says the difference is zero.

A large positive or negative $z$ value means the sample difference is far from what $H_0$ predicts. The sign of $z$ matches the direction of the sample difference.

Finding the p-value

The p-value is the probability, assuming $H_0$ is true, of getting a result at least as extreme as the one from the sample. It tells students how surprising the data are if the null model were correct.

For a two-sided test, the p-value is the probability of getting a result as far from $0$ in either direction as the observed difference. For one-sided tests, the p-value is only in the direction of the alternative hypothesis.

Interpretation matters:

  • A small p-value means the observed data would be unusual if $H_0$ were true.
  • A large p-value means the observed data are not unusual enough to reject $H_0$.

A common cutoff is the significance level $\alpha=0.05$, though other values may be used.

A full example

Suppose students wants to compare whether students at two schools prefer a new online practice tool. At School 1, $x_1=42$ out of $n_1=80$ students like it. At School 2, $x_2=30$ out of $n_2=75$ students like it.

First, define the hypotheses:

$$H_0: p_1-p_2=0$$

$$H_a: p_1-p_2\ne 0$$

Next, check the sample proportions:

$$\hat p_1=\frac{42}{80}=0.525$$

$$\hat p_2=\frac{30}{75}=0.400$$

The pooled proportion is

$$\hat p=\frac{42+30}{80+75}=\frac{72}{155}$$

Then compute the standard error:

$$SE=\sqrt{\hat p(1-\hat p)\left(\frac{1}{80}+\frac{1}{75}\right)}$$

Now calculate the test statistic:

$$z=\frac{0.525-0.400}{SE}$$

If the resulting $z$ is large enough in absolute value, the p-value will be small. That would give evidence that the two population proportions are different.

This process shows the main AP Statistics structure: state, check, calculate, and conclude. The conclusion should always be in context, using words about the real situation, not just numbers.

How to write the conclusion correctly

A strong conclusion answers the original question and connects to the p-value. students should say whether to reject or fail to reject $H_0$, then explain what that means in the context.

For example:

  • If the p-value is less than $\alpha$, reject $H_0$. There is convincing evidence that the population proportions are different.
  • If the p-value is greater than $\alpha$, fail to reject $H_0$. There is not enough evidence to say the population proportions are different.

Be careful: failing to reject $H_0$ does not prove that the proportions are equal. It only means the sample does not give strong enough evidence of a difference.

Common mistakes to avoid

Several errors show up often on AP Statistics questions.

Using the wrong standard error

For a hypothesis test, the standard error must use the pooled proportion $\hat p$. For a confidence interval, the proportions are not pooled.

Confusing sample and population values

The sample proportions are $\hat p_1$ and $\hat p_2$. The population proportions are $p_1$ and $p_2$. The test is about the unknown parameters $p_1$ and $p_2$, not just the samples.

Forgetting context

A final sentence should always connect the result to the real setting. For example, say whether there is evidence that one school has a higher preference rate than the other.

Interpreting the p-value incorrectly

The p-value is not the probability that $H_0$ is true. It is the probability of observing data at least this extreme, assuming $H_0$ is true.

Why this matters in the bigger unit

This lesson fits into inference for categorical data because it extends the ideas of a one-proportion test to two groups. It uses the same core logic as other inference procedures: build hypotheses, check conditions, compute a test statistic, find a p-value, and make a conclusion.

It also connects to confidence intervals for two proportions. A confidence interval estimates the size of the difference $p_1-p_2$, while a significance test asks whether the difference is statistically different from $0$. In AP Statistics, students should know both tools and when each one is useful.

Conclusion

A test for the difference of two population proportions helps students decide whether two groups are truly different in a categorical outcome. The test uses sample proportions, a pooled standard error, and a $z$ statistic to measure how surprising the observed difference is under the null hypothesis. When the p-value is small, there is convincing evidence of a difference. When it is not small, the data do not provide enough evidence to claim a difference. Mastering this procedure strengthens understanding of inference for categorical data and prepares students for AP Statistics questions about real-world comparisons.

Study Notes

  • The parameter of interest is usually $p_1-p_2$.
  • The null hypothesis for a two-proportion test is often $H_0: p_1-p_2=0$.
  • The alternative hypothesis may be $H_a: p_1-p_2>0$, $H_a: p_1-p_2<0$, or $H_a: p_1-p_2\ne 0$.
  • The sample proportions are $\hat p_1=\frac{x_1}{n_1}$ and $\hat p_2=\frac{x_2}{n_2}$.
  • For the test, use the pooled proportion $\hat p=\frac{x_1+x_2}{n_1+n_2}$.
  • The standard error for the test is $SE=\sqrt{\hat p(1-\hat p)\left(\frac{1}{n_1}+\frac{1}{n_2}\right)}$.
  • The test statistic is $z=\frac{(\hat p_1-\hat p_2)-0}{SE}$.
  • Check random, independence, and large counts conditions before using the test.
  • A small p-value gives evidence against $H_0$.
  • Fail to reject $H_0$ does not mean the proportions are equal; it means there is not enough evidence to say they differ.
  • Confidence intervals for $p_1-p_2$ estimate the size of the difference, while significance tests ask whether the difference is statistically significant.
  • Always write the final conclusion in context using the real situation and the correct direction of the claim. 🙂

Practice Quiz

5 questions to test your understanding

Carrying Out A Test For The Difference Of Two Population Proportions — AP Statistics | A-Warded