*81*

AÂ **two proportion z-test**Â is used to test for a difference between two population proportions.

This tutorial explains the following:

- The motivation for performing a two proportion z-test.
- The formula to perform a two proportion z-test.
- An example of how toÂ perform a two proportion z-test.

**Two Proportion Z-Test: Motivation**

Suppose we want to know if there is a difference in the proportion of residents who support a certain law in county A compared to the proportion who support the law in county B.

Since there are thousands of residents in each county, it would take too long and be too costly to go around and survey every individual resident in each county.

Instead, we might take a simple random sample of residents from each county and use the proportion in favor of the law in each sample to estimate the true difference in proportions between the two counties:

However, itâ€™s virtually guaranteed that the proportion of residents who support the law will be at least a little different between the two samples. **The question is whether or not this difference is statistically significant**. Fortunately, a two proportion z-test allows us to answer this question.

**Two Proportion Z-Test:**** Formula**

A two proportion z-test always uses the following null hypothesis:

**H**Î¼_{0}:_{1}Â =Â Î¼_{2}(the two population proportions are equal)

The alternative hypothesis can be either two-tailed, left-tailed, or right-tailed:

**H**Ï€_{1}(two-tailed):Â â‰ Ï€_{1}_{2}(the two population proportions are not equal)**H**Ï€_{1}(left-tailed):_{1}Â 2Â (population 1 proportion is less than population 2 proportion)**H**Ï€_{1}(right-tailed):Â> Ï€_{1Â }_{2}Â (population 1 proportion is greater than population 2 proportion)

We use the following formula to calculate the test statistic z:

**z **=Â (p_{1}-p_{2}) / âˆšp(1-p)(1/n_{1}+1/n_{2})

where p_{1}Â and p_{2} are the sample proportions,Â n_{1 }and n_{2Â }are the sample sizes, and where p is the total pooled proportionÂ calculated as:

p = (p_{1}n_{1} + p_{2}n_{2})/(n_{1}+n_{2})

If the p-value that corresponds to the test statistic z is less than your chosen significance level (common choices are 0.10, 0.05, and 0.01) then you can reject the null hpothesis.

**Two Proportion Z-Test****: Example**

Suppose we want to know if there is a difference in the proportion of residents who support a certain law in county A compared to the proportion who support the law in county B.

To test this, will perform a two proportion z-test at significance level Î± = 0.05 using the following steps:

**Step 1: Gather the sample data.**

SupposeÂ we collect a random sample of residents from each county and end up with the following information:

**Sample 1:**

- Sample sizeÂ n
_{1}= 50 - Proportion in favor of law p
_{1}= 0.67

**Sample 2:**

- Sample sizeÂ n
_{2}= 50 - Proportion in favor of law p
_{2}= 0.57

**Step 2: Define the hypotheses.**

We will perform the two proportion z-test with the following hypotheses:

**H**Ï€_{0}:ÂÂ = Ï€_{1}_{2}Â (the two population proportions are equal)**H**Ï€_{1}:ÂÂ â‰ Ï€_{1}_{2}Â (the two population proportions are not equal)

**Step 3: Calculate the test statisticÂ z.**

First, we will calculate the total pooled proportion:

**p** = (p_{1}n_{1} + p_{2}n_{2})/(n_{1}+n_{2}) = (0.67(50)Â + 0.57(50))/(50+50) =Â **0.62**

Next, we will calculate the test statistic *z*:

**zÂ **=Â (p_{1}-p_{2}) / âˆšp(1-p)(1/n_{1}+1/n_{2})Â = (.67-.57) / âˆš.62(1-.62)(1/50+ 1/50) =Â **1.03**

**Step 4: Calculate the p-value of the test statistic z.**

According to the Z Score to P Value Calculator, the two-tailed p-value associated with z = 1.03 isÂ **0.30301**.

**Step 5: Draw a conclusion.**

Since this p-value is not less than ourÂ significance level Î± = 0.05, we fail to reject the null hypothesis. We do not have sufficient evidence to say that the proportion of residents who support this law is different between the two counties.

**Note:Â **You can also perform this entire two proportion z-test by simply using the Two Proportion Z-Test Calculator.

**Additional Resources**

How to Perform a Two Proportion Z-Test in Excel

Two Proportion Z-Test Calculator