Lab 10 - Counts and Proportions

In this lab we will use S-Plus to analyze data from R x C contingency tables. We can either enter the counts as a contingency table directly into a data set or we can enter the raw data as two columns and have the program automatically tabulate the counts. Once the data are entered we have to decide what if there are iindependent samples (and thus we should use the Chi square test) or if the observations are "paired" or matched (in which case we should use McNemar's test)

Look at the description of exercise 20 and exercise 21 in Chapter 15 -- which tests should be used? How many levels do the two "factors" have?

Let's start with exercise 20. Download and read in the data for exercise 20, angio. Each row corresponds to one site. Look at row one; what type of geographic area and approrpiate use does this site have?

.To construct a contingency table from the raw data, go to the Statistics menu and select Data Summaries, then Crosstabulations... Select <all> for the variables, then click OK. The table with various summaries will appear in the report window. There is a chi-squared statistic in this output which is not appropriate if the data are paired..

To carry out either a Chi-squared test or McNemar's test, go to the Statistics menu and select Compare Samples > Counts and Proportions. Select either the Chi-square Test... or McNemar's Test... depending on which is appropriate.

In either case, because we have the raw data, specify that site is Variable 1 and appropro is Variable 2 (or in the other order). Do not click the box indicating data is a contingency table. Click OK; the output will be in the Reports Window.

Repeat these steps for the alcohol data in exercise 21.

What conclusions would you make? You should be able to identify the hypotheses being tested, know which procedure to use, and be able to interpret the output from a test.

For practice: given the summary contingency tables from the crosstabulation output, go back and verify the test statistics by hand.


For checking other homework exercises, you may enter the contingency table as a new data set. Go to the File menu, and select New... then Data set. Enter the data for the r rows and c columns as a table. To carry out a Chi-square or McNemar's test, go to the Statistics menu, select Compare Samples > Counts and Proportions and the corrrespond test that you would like to do. Rather than specifying Variable 1 and Variable 2, click the box that indicates that this is a contingency table.