Hypothesis Tests

# Two-Sample Test for Proportions

In the Two-Sample Test for Proportions task, you can determine whether two probabilities are the same.

The data analyzed in this example are taken from a study measuring the accuracy of two computer programs. Each program searches the World Wide Web and returns a list of web pages that meet a particular set of specified criteria. The data set Search contains two samples in which each observation is either `yes' or `no'. A response of `yes' indicates that the program returns the desired page at the top of the list of potential pages; a value of `no' indicates that this is not the case. The data set contains the results of 535 searches using an older search program and 409 searches using a new program. The variables containing the results for the old and new programs are named oldfind and newfind, respectively.

Suppose that you want to determine whether the probability of a correct search by the new algorithm is higher than that for the old algorithm. That is, you want to determine whether you can reject the null hypothesis that the two probabilities are equal in favor of the alternative that the new probability is larger. The values for analysis are contained in the two variables oldfind and newfind.

### Open the Search Data Set

The data are provided in the Analyst Sample Library. To access this Analyst sample data set, follow these steps:

1. Select Tools Sample Data ...
2. Select Search.
3. Click OK to create the sample data set in your Sasuser directory.
4. Select File Open By SAS Name ...
5. Select Sasuser from the list of Libraries.
6. Select Search from the list of members.
7. Click OK to bring the Search data set into the data table.

### Request a Two-Sample Test for Proportions

To perform the analysis, follow these steps:

1. Select Statistics Hypothesis Tests Two-Sample Test for Proportions ...
2. Select Two variables in the box labeled Groups are in.
3. Select the variable newfind as the Group 1 variable.
4. Select the variable oldfind as the Group 2 variable.
5. Select the Level of Interest by clicking on the down arrow and selecting yes to test whether the two groups have the same proportions of success.
6. Specify the Alternative hypothesis by selecting Prop 1 - Prop 2 > 0.

Note that, if your data are arranged so that the values for the two groups are contained in a single variable, you can define the dependent and group variables by selecting One variable in the box labeled Groups are in.

Figure 8.12 displays the Two-Sample Test for Proportions dialog. Figure 8.12: Two-Sample Test for Proportions Dialog

In Figure 8.12, the null hypothesis specifies that the proportions of success for the algorithms are equal (or, equivalently, that the difference between the proportions is 0). The alternative hypothesis is that the probability of a correct search by the new algorithm is higher than that for the old algorithm.

Click OK in the main dialog to perform the analysis.

### Review the Results

The results of the hypothesis test are displayed in Figure 8.13. Figure 8.13: Two-Sample Test for Proportions: Results

The "Sample Statistics" table lists the frequency of `yes' and `no' responses for each variable. The "Hypothesis Test" table displays the null and alternative hypotheses and the results of the test.

The observed proportion of `yes' responses is 0.8631 for the newfind variable, and 0.8093 for the oldfind variable. The Z statistic of 2.19 and associated p-value of 0.0142 indicate that the proportion of successful searches is significantly larger for the new search algorithm.