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