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

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

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:

• 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):Â Ï€1Â > Ï€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 n2Â are 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:

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.