Home » Two Proportion Z-Test: Definition, Formula, and Example

Two Proportion Z-Test: Definition, Formula, and Example

by Erma Khan

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:

Two proportion z-test example

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:

  • H0: μ1 = μ2 (the two population proportions are equal)

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

  • H1 (two-tailed): π1 ≠ π2 (the two population proportions are not equal)
  • H1 (left-tailed): π1 2 (population 1 proportion is less than population 2 proportion)
  • H1 (right-tailed): π> π2 (population 1 proportion is greater than population 2 proportion)

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

z = (p1-p2) / √p(1-p)(1/n1+1/n2)

where p1 and p2 are the sample proportions, n1 and nare the sample sizes, and where p is the total pooled proportion calculated as:

p = (p1n1 + p2n2)/(n1+n2)

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 n1 = 50
  • Proportion in favor of law p1 = 0.67

Sample 2:

  • Sample size n2 = 50
  • Proportion in favor of law p2 = 0.57

Step 2: Define the hypotheses.

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

  • H0π1 = π2  (the two population proportions are equal)
  • H1π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 = (p1n1 + p2n2)/(n1+n2) = (0.67(50) + 0.57(50))/(50+50) = 0.62

Next, we will calculate the test statistic z:

= (p1-p2) / √p(1-p)(1/n1+1/n2) = (.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

Related Posts