# Comparing Two Proportions Printer-friendly version

So far, all of our examples involved testing whether a single population proportion p equals some value p0. Now, let's turn our attention for a bit to testing whether one population proportion p1 equals a second population proportion p2. Additionally, most of our examples thus far have involved left tailed tests in which the alternative hypothesis involved HA: p < p0 or right tailed tests in which the alternative hypothesis involved HA: p > p0. Here, let's consider an example that tests the equality of two proportions against the alternative that they are not equal. Using statistical notation, we'll test:

H0: p1 = p2  versus HA: p1p2

### Example

Time magazine reported the result of a telephone poll of 800 adult Americans. The question posed of the Americans who were surveyed was: "Should the federal tax on cigarettes be raised to pay for health care reform?" The results of the survey were: Is there sufficient evidence at the α = 0.05 level, say, to conclude that the two populations — smokers and non-smokers — differ significantly with respect to their opinions?

Solution. If p1 = the proportion of the non-smoker population who reply "yes" and p2 = the proportion of the smoker population who reply "yes," then we are interested in testing the null hypothesis:

H0: p1 = p2

against the alternative hypothesis:

HAp1 ≠ p2

Before we can actually conduct the hypothesis test, we'll have to derive the appropriate test statistic.

 Theorem: The test statistic for testing the difference in two population proportions, that is, for testing the null hypothesis $H_0:p_1-p_2=0$ is: $Z=\dfrac{(\hat{p}_1-\hat{p}_2)-0}{\sqrt{\hat{p}(1-\hat{p})\left(\dfrac{1}{n_1}+\dfrac{1}{n_2}\right)}}$ where: $\hat{p}=\dfrac{Y_1+Y_2}{n_1+n_2}$ the proportion of "successes" in the two samples combined.

Proof. Recall that:

$\hat{p}_1-\hat{p}_2$

is approximately normally distributed with mean:

$p_1-p_2$

and variance:

$\dfrac{p_1(1-p_1)}{n_1}+\dfrac{p_2(1-p_2)}{n_2}$

But, if we assume that the null hypothesis is true, then the population proportions equal some common value p, say, that is,  p1 = p2 = p. In that case, then the variance becomes:

$p(1-p)\left(\dfrac{1}{n_1}+\dfrac{1}{n_2}\right)$

So, under the assumption that the null hypothesis is true, we have that: follows (at least approximately) the standard normal N(0,1) distribution. Since we don't know the (assumed) common population proportion any more than we know the proportions p1 and p2 of each population, we can estimate p using:

$\hat{p}=\dfrac{Y_1+Y_2}{n_1+n_2}$

the proportion of "successes" in the two samples combined. And, hence, our test statistic becomes:

$Z=\dfrac{(\hat{p}_1-\hat{p}_2)-0}{\sqrt{\hat{p}(1-\hat{p})\left(\dfrac{1}{n_1}+\dfrac{1}{n_2}\right)}}$

as was to be proved.

### Example (continued)

Time magazine reported the result of a telephone poll of 800 adult Americans. The question posed of the Americans who were surveyed was: "Should the federal tax on cigarettes be raised to pay for health care reform?" The results of the survey were: Is there sufficient evidence at the α = 0.05 level, say, to conclude that the two populations — smokers and non-smokers — differ significantly with respect to their opinions?

Solution. The overall sample proportion is:

$\hat{p}=\dfrac{41+351}{195+605}=\dfrac{392}{800}=0.49$

That implies then that the test statistic for testing:

$H_0:p_1=p_2$  versus   $H_0:p_1 \neq p_2$

is:

$Z=\dfrac{(0.58-0.21)-0}{\sqrt{0.49(0.51)\left(\dfrac{1}{195}+\dfrac{1}{605}\right)}}=8.99$

Errr.... that Z-value is off the charts, so to speak. Let's go through the formalities anyway making the decision first using the rejection region approach, and then using the P-value approach. Putting half of the rejection region in each tail, we have: That is, we reject the null hypothesis H0 if Z ≥ 1.96 or if Z ≤ −1.96. We clearly reject H0, since 8.99 falls in the "red zone," that is, 8.99 is (much) greater than 1.96. There is sufficient evidence at the 0.05 level to conclude that the two populations differ with respect to their opinions concerning imposing a federal tax to help pay for health care reform.

Now for the P-value approach: That is, the P-value is less than 0.0001. Because P < 0.0001 ≤ α = 0.05, we reject the null hypothesis. Again, there is sufficient evidence at the 0.05 level to conclude that the two populations differ with respect to their opinions concerning imposing a federal tax to help pay for health care reform.

Thankfully, as should always be the case, the two approaches.... the critical value approach and the P-value approach... lead to the same conclusion. ### Note

For testing H0p1 = p2, some statisticians use the test statistic:

$Z=\dfrac{(\hat{p}_1-\hat{p}_2)-0}{\sqrt{\dfrac{\hat{p}_1(1-\hat{p}_1)}{n_1}+\dfrac{\hat{p}_2(1-\hat{p}_2)}{n_2}}}$

instead of the one we used:

$Z=\dfrac{(\hat{p}_1-\hat{p}_2)-0}{\sqrt{\hat{p}(1-\hat{p})\left(\dfrac{1}{n_1}+\dfrac{1}{n_2}\right)}}$

An advantage of doing so is again that the interpretation of the confidence interval — does it contain 0? — is always consistent with the hypothesis test decision.