In this article we will go through the steps necessary to perform a hypothesis test, or test of significance, for the difference of two population proportions. This allows us to compare two unknown proportions and infer if they are not equal to each other or if one is greater than another.
Hypothesis Test Overview and Background
Before we go into the specifics of our hypothesis test, we will look at the framework of hypothesis tests. In a test of significance we attempt to show that a statement concerning the value of a population parameter (or sometimes the nature of the population itself) is likely to be true.
We amass evidence for this statement by conducting a statistical sample. We calculate a statistic from this sample. The value of this statistic is what we use to determine the truth of the original statement. This process contains uncertainty, however we are able to quantify this uncertainty
The overall process for a hypothesis test is given by the list below:
- Make sure that the conditions that are necessary for our test are satisfied.
- Clearly state the null and alternative hypotheses. The alternative hypothesis may involve a one-sided or a two-sided test. We should also determine the level of significance, which will be denoted by the Greek letter alpha.
- Calculate the test statistic. The type of statistic that we use depends upon the particular test that we are conducting. The calculation relies upon our statistical sample.
- Calculate the p-value. The test statistic can be translated into a p-value. A p-value is the probability of chance alone producing the value of our test statistic under the assumption that the null hypothesis is true. The overall rule is that the smaller the p-value, the greater the evidence against the null hypothesis.
- Draw a conclusion. Finally we use the value of alpha that was already selected as a threshold value. The decision rule is that If the p-value is less than or equal to alpha, then we reject the null hypothesis. Otherwise we fail to reject the null hypothesis.
Now that we have seen the framework for a hypothesis test, we will see the specifics for a hypothesis test for the difference of two population proportions.
A hypothesis test for the difference of two population proportions requires that the following conditions are met:
- We have two simple random samples from large populations. Here ”large” means that the population is at least 20 times larger than the size of the sample. The sample sizes will be denoted by n1 and n2.
- The individuals in our samples have been chosen independently of one another. The populations themselves must also be independent.
- There are at least 10 successes and 10 failures in both of our samples.
As long as these conditions have been satisfied, we can continue with our hypothesis test.
The Null and Alternative Hypotheses
Now we need to consider the hypotheses for our test of significance. The null hypothesis is our statement of no effect. In this particular type of hypothesis test our null hypothesis is that there is no difference between the two population proportions. We can write this as H0: p1 = p2.
The alternative hypothesis is one of three possibilities, depending upon the specifics of what we are testing for:
- Ha: p1 is greater than p2. This is a one-tailed or one-sided test.
- Ha: p1 is less than p2. This is also one-sided test.
- Ha: p1 is not equal to p2. This is a two-tailed or two-sided test.
As always, in order to be cautious, we should use the two-sided alternative hypothesis if we do not have a direction in mind before we obtain our sample. The reason for doing this is that it is harder to reject the null hypothesis with a two-sided test.
The three hypotheses can be rewritten by stating how p1 – p2 is related to the value zero. To be more specific, the null hypothesis would become H0: p1 – p2 = 0. The potential alternative hypotheses would be written as:
- Ha: p1 – p2 > 0 is equivalent to the statement ”p1 is greater than p2.”
- Ha: p1 – p2 < 0 is equivalent to the statement "p1 is less than p2.”
- Ha: p1 – p2 ≠ 0 is equivalent to the statement ”p1 is not equal to p2.”
This equivalent formulation actually shows us a little bit more of what is happening behind the scenes. What we are doing in this hypothesis test is turning the two parameters p1 and p2 into the single parameter p1 – p2. We then test this new parameter against the value zero.
The Test Statistic
The formula for the test statistic is given in the image above. An explanation of each of the terms follows:
- The sample from the first population has size n1. The number of successes from this sample (which is not directly seen in the formula above) is k1.
- The sample from the second population has size n2. The number of successes from this sample is k2.
- The sample proportions are p1-hat = k1 / n1 and p2-hat = k2 / n2 .
- We then combine or pool the successes from both of these samples and obtain: p-hat = ( k1 + k2) / ( n1 + n2).
As always, be careful with order of operations when calculating. Everything underneath the radical must be calculated before taking the square root.
The next step is to calculate the p-value that corresponds to our test statistic. We use a standard normal distribution for our statistic and consult a table of values or use statistical software.
The details of our p-value calculation depend upon the alternative hypothesis we are using:
- For Ha: p1 – p2 > 0, we calculate the proportion of the normal distribution that is greater than Z.
- For Ha: p1 – p2 < 0, we calculate the proportion of the normal distribution that is less than Z.
- For Ha: p1 – p2 ≠ 0, we calculate the proportion of the normal distribution that is greater than |Z|, the absolute value of Z. After this, to account for the fact that we have a two-tailed test, we double the proportion.
Now we make a decision on whether to reject the null hypothesis (and thereby accept the alternative), or to fail to reject the null hypothesis. We make this decision by comparing our p-value to the level of significance alpha.
- If the p-value is less than or equal to alpha, then we reject the null hypothesis. This means that we have a statistically significant result and that we are going to accept the alternative hypothesis.
- If the p-value is greater than alpha, then we fail to reject the null hypothesis. This does not prove that the null hypothesis is true. Instead it means that we did not obtain convincing enough evidence to reject the null hypothesis.
The confidence interval for the difference of two population proportions does not pool the successes, whereas the hypothesis test does. The reason for this is that our null hypothesis assumes that p1 – p2 = 0. The confidence interval does not assume this. Some statisticians do not pool the successes for this hypothesis test, and instead use a slightly modified version of the above test statistic.