Stat Trek

Teach yourself statistics

Stat Trek

Teach yourself statistics

Hypothesis Test: Difference Between Proportions

This lesson explains how to conduct a hypothesis test to determine whether the difference between two proportions is significant. The test procedure, called the two-proportion z-test, is appropriate when the following conditions are met:

  • The sampling method for each population is simple random sampling.
  • The samples are independent.
  • Each sample includes at least 10 successes and 10 failures.
  • Each population is at least 20 times as big as its sample.

This approach consists of four steps: (1) state the hypotheses, (2) formulate an analysis plan, (3) analyze sample data, and (4) interpret results.

State the Hypotheses

Every hypothesis test requires the analyst to state a null hypothesis and an alternative hypothesis. The table below shows three sets of hypotheses. Each makes a statement about the difference d between two population proportions, P1 and P2. (In the table, the symbol ≠ means " not equal to ".)

Set Null hypothesis Alternative hypothesis Number of tails
1 P1 - P2 = 0 P1 - P2 ≠ 0 2
2 P1 - P2 > 0 P1 - P2 < 0 1
3 P1 - P2 < 0 P1 - P2 > 0 1

The first set of hypotheses (Set 1) is an example of a two-tailed test, since an extreme value on either side of the sampling distribution would cause a researcher to reject the null hypothesis. The other two sets of hypotheses (Sets 2 and 3) are one-tailed tests, since an extreme value on only one side of the sampling distribution would cause a researcher to reject the null hypothesis.

When the null hypothesis states that there is no difference between the two population proportions (i.e., d = P1 - P2 = 0), the null and alternative hypothesis for a two-tailed test are often stated in the following form.

Ho: P1 = P2
Ha: P1 ≠ P2

Formulate an Analysis Plan

The analysis plan describes how to use sample data to accept or reject the null hypothesis. It should specify the following elements.

  • Significance level. Often, researchers choose significance levels equal to 0.01, 0.05, or 0.10; but any value between 0 and 1 can be used.
  • Test method. Use the two-proportion z-test (described in the next section) to determine whether the hypothesized difference between population proportions differs significantly from the observed sample difference.

Analyze Sample Data

Using sample data, complete the following computations to find the test statistic and its associated P-Value.

  • Pooled sample proportion. Since the null hypothesis states that P1=P2, we use a pooled sample proportion (p) to compute the standard error of the sampling distribution.

    p = (p1 * n1 + p2 * n2) / (n1 + n2)

    where p1 is the sample proportion from population 1, p2 is the sample proportion from population 2, n1 is the size of sample 1, and n2 is the size of sample 2.
  • Standard error. Compute the standard error (SE) of the sampling distribution difference between two proportions.

    SE = sqrt{ p * ( 1 - p ) * [ (1/n1) + (1/n2) ] }

    where p is the pooled sample proportion, n1 is the size of sample 1, and n2 is the size of sample 2.
  • Test statistic. The test statistic is a z-score (z) defined by the following equation.

    z = (p1 - p2) / SE

    where p1 is the proportion from sample 1, p2 is the proportion from sample 2, and SE is the standard error of the sampling distribution.
  • P-value. The P-value is the probability of observing a sample statistic as extreme as the test statistic. Since the test statistic is a z-score, use the Normal Distribution Calculator to assess the probability associated with the z-score. (See sample problems at the end of this lesson for examples of how this is done.)

The analysis described above is a two-proportion z-test.

Interpret Results

If the sample findings are unlikely, given the null hypothesis, the researcher rejects the null hypothesis. Typically, this involves comparing the P-value to the significance level, and rejecting the null hypothesis when the P-value is less than the significance level.

Test Your Understanding

In this section, two sample problems illustrate how to conduct a hypothesis test for the difference between two proportions. The first problem involves a two-tailed test; the second problem, a one-tailed test.

Problem 1: Two-Tailed Test

Suppose the Acme Drug Company develops a new drug, designed to prevent colds. The company states that the drug is equally effective for men and women. To test this claim, they choose a a simple random sample of 100 women and 200 men from a population of 100,000 volunteers.

At the end of the study, 38% of the women caught a cold; and 51% of the men caught a cold. Based on these findings, can we reject the company's claim that the drug is equally effective for men and women? Use a 0.05 level of significance.

Solution: The solution to this problem takes four steps: (1) state the hypotheses, (2) formulate an analysis plan, (3) analyze sample data, and (4) interpret results. We work through those steps below:

  • State the hypotheses. The first step is to state the null hypothesis and an alternative hypothesis.

    Null hypothesis: P1 = P2

    Alternative hypothesis: P1 ≠ P2

    Note that these hypotheses constitute a two-tailed test. The null hypothesis will be rejected if the proportion from population 1 is too big or if it is too small.
  • Formulate an analysis plan. For this analysis, the significance level is 0.05. The test method is a two-proportion z-test.
  • Analyze sample data. Using sample data, we calculate the pooled sample proportion (p) and the standard error (SE). Using those measures, we compute the z-score test statistic (z).

    p = (p1 * n1 + p2 * n2) / (n1 + n2)

    p = [(0.38 * 100) + (0.51 * 200)] / (100 + 200)

    p = 140/300 = 0.467


    SE = sqrt{ p * ( 1 - p ) * [ (1/n1) + (1/n2) ] }

    SE = sqrt [ 0.467 * 0.533 * ( 1/100 + 1/200 ) ]

    SE = sqrt [0.003733] = 0.061


    z = (p1 - p2) / SE = (0.38 - 0.51)/0.061 = -2.13

    where p1 is the sample proportion in sample 1, where p2 is the sample proportion in sample 2, n1 is the size of sample 1, and n2 is the size of sample 2.

    Since we have a two-tailed test, the P-value is the probability that the z-score is less than -2.13 or greater than 2.13.

    We use the Normal Distribution Calculator to find P(z < -2.13) = 0.017. Since the standard normal distribution is symmetric with a mean of zero, we know that P(z > 2.13) = 0.017. Thus, the P-value = 0.017 + 0.017 = 0.034.
Normal Distribution Calculator
  • Interpret results. Since the P-value (0.034) is less than the significance level (0.05), we cannot accept the null hypothesis.

Note: If you use this approach on an exam, you may also want to mention why this approach is appropriate. Specifically, the approach is appropriate because the sampling method was simple random sampling, the samples were independent, each population was at least 10 times larger than its sample, and each sample included at least 10 successes and 10 failures.

Problem 2: One-Tailed Test

Suppose the previous example is stated a little bit differently. Suppose the Acme Drug Company develops a new drug, designed to prevent colds. The company states that the drug is more effective for women than for men. To test this claim, they choose a a simple random sample of 100 women and 200 men from a population of 100,000 volunteers.

At the end of the study, 38% of the women caught a cold; and 51% of the men caught a cold. Based on these findings, can we conclude that the drug is more effective for women than for men? Use a 0.01 level of significance.

Solution: The solution to this problem takes four steps: (1) state the hypotheses, (2) formulate an analysis plan, (3) analyze sample data, and (4) interpret results. We work through those steps below:

  • State the hypotheses. The first step is to state the null hypothesis and an alternative hypothesis.

    Null hypothesis: P1 >= P2

    Alternative hypothesis: P1 < P2

    Note that these hypotheses constitute a one-tailed test. The null hypothesis will be rejected if the proportion of women catching cold (p1) is sufficiently smaller than the proportion of men catching cold (p2).
  • Formulate an analysis plan. For this analysis, the significance level is 0.01. The test method is a two-proportion z-test.
  • Analyze sample data. Using sample data, we calculate the pooled sample proportion (p) and the standard error (SE). Using those measures, we compute the z-score test statistic (z).

    p = (p1 * n1 + p2 * n2) / (n1 + n2)

    p = [(0.38 * 100) + (0.51 * 200)] / (100 + 200)

    p = 140/300 = 0.467


    SE = sqrt{ p * ( 1 - p ) * [ (1/n1) + (1/n2) ] }

    SE = sqrt [ 0.467 * 0.533 * ( 1/100 + 1/200 ) ]

    SE = sqrt [0.003733] = 0.061


    z = (p1 - p2) / SE = (0.38 - 0.51)/0.061 = -2.13

    where p1 is the sample proportion in sample 1, where p2 is the sample proportion in sample 2, n1 is the size of sample 1, and n2 is the size of sample 2.

    Since we have a one-tailed test, the P-value is the probability that the z-score is less than -2.13. The Normal Distribution Calculator tells us that P(z < -2.13) is about 0.017. Thus, the P-value = 0.017.
Normal Distribution Calculator
  • Interpret results. Since the P-value (0.017) is greater than the significance level (0.01), we cannot reject the null hypothesis.