# 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Analysis of Categorical Data Tests for Homogeneity.

## Presentation on theme: "1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Analysis of Categorical Data Tests for Homogeneity."— Presentation transcript:

1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Analysis of Categorical Data Tests for Homogeneity

2 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Tests for Homogeneity and Independence in a Two-Way Table Data resulting from observations made on two different categorical variables can be summarized using a tabular format. For example, consider the student data set giving information on 79 student dataset that was obtained from a sample of 79 students taking elementary statistics. The table is on the next slide.

3 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Tests for Homogeneity and Independence in a Two-Way Table This is an example of a two-way frequency table, or contingency table. The numbers in the 6 cells with clear backgrounds are the observed cell counts.

4 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Tests for Homogeneity and Independence in a Two-Way Table Marginal totals are obtained by adding the observed cell counts in each row and also in each column. The sum of the column marginal total (or the row marginal totals) is called the grand total.

5 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Tests for Homogeneity in a Two-Way Table Typically, with a two-way table used to test homogeneity, the rows indicate different populations and the columns indicate different categories or vice versa. For a test of homogeneity, the central question is whether the category proportions are the same for all of the populations

6 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Tests for Homogeneity in a Two-Way Table When the row indicates the population, the expected count for a cell is simply the overall proportion (over all populations) that have the category times the number in the population. To illustrate: 54 = total number of male students = overall proportion of students using contacts = expected number of males that use contacts as primary vision correction

7 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Tests for Homogeneity in a Two-Way Table The expected values for each cell represent what would be expected if there is no difference between the groups under study can be found easily by using the following formula.

8 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Tests for Homogeneity in a Two-Way Table

9 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Tests for Homogeneity in a Two-Way Table Expected counts are in parentheses.

10 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Comparing Two or More Populations Using the  2 Statistic Hypotheses: H 0 :The true category proportions are the same for all of the populations (homogeneity of populations). H a :The true category proportions are not all the same for all of the populations.

11 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Comparing Two or More Populations Using the  2 Statistic The expected cell counts are estimated from the sample data (assuming that H 0 is true) using the formula Test statistic:

12 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Comparing Two or More Populations Using the  2 Statistic P-value:When H 0 is true,  2 has approximately a chi-square distribution with The P-value associated with the computed test statistic value is the area to the right of  2 under the chi-square curve with the appropriate df. df = (number of rows - 1)(number of columns - 1)

13 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Comparing Two or More Populations Using the  2 Statistic Assumptions: 1.The data consists of independently chosen random samples. 2.The sample size is large: all expected counts are at least 5. If some expected counts are less than 5, rows or columns of the table may be combined to achieve a table with satisfactory expected counts.

14 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Example The following data come from a clinical trial of a drug regime used in treating a type of cancer, lymphocytic lymphomas.* Patients (273) were randomly divided into two groups, with one group of patients receiving cytoxan plus prednisone (CP) and the other receiving BCNU plus prednisone (BP). The responses to treatment were graded on a qualitative scale. The two-way table summary of the results is on the following slide. * Ezdinli, E., S., Berard, C. W., et al. (1976) Comparison of intensive versus moderate chemotherapy of lympocytic lymphomas: a progress report. Cancer, 38, 1060-1068.

15 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Example Set up and perform an appropriate hypothesis test at the 0.05 level of significance.

16 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Hypotheses: H 0 :The true response to treatment proportions are the same for both treatments (homogeneity of populations). H a :The true response to treatment proportions are not all the same for both treatments. Example Significance level:  = 0.05 Test statistic:

17 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Example Assumptions: All expected cell counts are at least 5, and samples were chosen independently so the  2 test is appropriate.

18 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Example Calculations: The two-way table for this example has 2 rows and 4 columns, so the appropriate df is (2-1)(4-1) = 3. Since 4.60 0.10 >  = 0.05 so H 0 is not rejected. There is insufficient evidence to conclude that the responses are different for the two treatments.

19 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Comparing Two or More Populations Using the  2 Statistic P-value:When H 0 is true,  2 has approximately a chi-square distribution with df = (number of rows - 1)(number of columns - 1) The P-value associated with the computed test statistic value is the area to the right of  2 under the chi-square curve with the appropriate df.

20 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Example A student decided to study the shoppers in Wegman’s, a local supermarket to see if males and females exhibited the same behavior patterns with regard to the device use to carry items. He observed 57 shoppers (presumably randomly) and obtained the results that are summarized in the table on the next slide.

21 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Example Determine if the carrying device proportions are the same for both genders using a 0.05 level of significance.

22 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Hypotheses: H 0 :The true proportions of the device used are the same for both genders. H a :The true proportions of the device used are not the same for both genders. Example Significance level:  = 0.05 Test statistic:

23 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Using Minitab, we get the following output: Example Chi-Square Test: Basket, Cart, Nothing Expected counts are printed below observed counts Basket Cart Nothing Total 1 9 21 5 35 9.82 17.19 7.98 2 7 7 8 22 6.18 10.81 5.02 Total 16 28 13 57 Chi-Sq = 0.069 + 0.843 + 1.114 + 0.110 + 1.341 + 1.773 = 5.251 DF = 2, P-Value = 0.072

24 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. We draw the following conclusion. Example With a P-value of 0.072, there is insufficient evidence at the 0.05 significance level to support a claim that males and females are not the same in terms of proportionate use of carrying devices at Wegman’s supermarket.

Similar presentations