Successfully reported this slideshow.
Upcoming SlideShare
×

# Chapter12

• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

### Chapter12

1. 1. Chapter 12 The Analysis of Categorical Data and Goodness-of-Fit Tests
2. 2. Univariate Categorical Data <ul><li>Univariate categorical data is best summarized in a one-way frequency table. For example, consider the following observations of sample of faculty status for faculty in a large university system. </li></ul>
3. 3. Univariate Categorical Data <ul><li>A local newsperson might be interested in testing hypotheses about the proportion of the population that fall in each of the categories. </li></ul><ul><li>For example, the newsperson might want to test to see if the five categories occur with equal frequency throughout the whole university system. </li></ul><ul><li>To deal with this type of question we need to establish some notation. </li></ul>
4. 4. Notation <ul><li>k = number of categories of a categorical variable </li></ul><ul><li> 1 = true proportion for category 1 </li></ul><ul><li> 2 = true proportion for category 2 </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li> k = true proportion for category k </li></ul><ul><li>(note:  1 +  2 +  +  k = 1) </li></ul>
5. 5. Hypotheses <ul><li>H 0 :  1 = hypothesized proportion for category 1 </li></ul><ul><li> 2 = hypothesized proportion for category 2 </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li> k = hypothesized proportion for category k </li></ul><ul><li>H a : H 0 is not true, so at least one of the true category proportions differs from the corresponding hypothesized value. </li></ul>
6. 6. Expected Counts <ul><li>For each category, the expected count for that category is the product of the total number of observations with the hypothesized proportion for that category. </li></ul>
7. 7. Expected Counts - Example <ul><li>Consider the sample of faculty from a large university system and recall that the newsperson wanted to test to see if each of the groups occurred with equal frequency. </li></ul>
8. 8. Goodness-of-fit statistic,  2 The value of the  2 statistic is the sum of these terms. The goodness-of-fit statistic,  2 , results from first computing the quantity for each cell.
9. 9. Chi-square distributions
10. 10. Upper-tail Areas for Chi-square Distributions
11. 11. Goodness-of-Fit Test Procedure Hypotheses: H 0 :  1 = hypothesized proportion for category 1  2 = hypothesized proportion for category 2    k = hypothesized proportion for category k H a : H 0 is not true Test statistic:
12. 12. Goodness-of-Fit Test Procedure P-values: When H 0 is true and all expected counts are at least 5,  2 has approximately a chi-square distribution with df = k-1. Therefore, the P-value associated with the computed test statistic value is the area to the right of  2 under the df = k-1 chi-square curve.
13. 13. Goodness-of-Fit Test Procedure <ul><li>Assumptions: </li></ul><ul><ul><li>Observed cell counts are based on a random sample . </li></ul></ul><ul><ul><li>The sample size is large . The sample size is large enough for the chi-squared test to be appropriate as long as every expected count is at least 5. </li></ul></ul>
14. 14. Example Consider the newsperson’s desire to determine if the faculty of a large university system were equally distributed. Let us test this hypothesis at a significance level of 0.05. Let  1 ,  2 ,  3 ,  4 , and  5 denote the proportions of all faculty in this university system that are full professors, associate professors, assistant professors, instructors and adjunct/part time respectively. H 0 :  1 = 0.2,  2 = 0.2,  3 = 0.2,  4 = 0.2,  5 = 0.2 H a : H 0 is not true
15. 15. Example Significance level :  = 0.05 Assumptions : As we saw in an earlier slide, the expected counts were all 30.8 which is greater than 5. Although we do not know for sure how the sample was obtained for the purposes of this example, we shall assume selection procedure generated a random sample. Test statistic:
16. 16. Example Calculation: recall
17. 17. Example P-value : The P-value is based on a chi-squared distribution with df = 5 - 1 = 4. The computed value of  2 , 7.56 is smaller than 7.77, the lowest value of  2 in the table for df = 4, so that the P-value is greater than 0.100. Conclusion : Since the P-value > 0.05 =  , H 0 cannot be rejected. There is insufficient evidence to refute the claim that the proportion of faculty in each of the different categories is the same.
18. 18. 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.
19. 19. 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.
20. 20. 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 .
21. 21. 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
22. 22. 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
23. 23. 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.
24. 24. Tests for Homogeneity in a Two-Way Table
25. 25. Tests for Homogeneity in a Two-Way Table Expected counts are in parentheses.
26. 26. 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.
27. 27. 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:
28. 28. 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)
29. 29. Comparing Two or More Populations Using the  2 Statistic <ul><li>Assumptions: </li></ul><ul><ul><li>The data consists of independently chosen random samples. </li></ul></ul><ul><ul><li>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. </li></ul></ul>
30. 30. 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.
31. 31. Example Set up and perform an appropriate hypothesis test at the 0.05 level of significance.
32. 32. Example 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. Significance level :  = 0.05 Test statistic:
33. 33. Example Assumptions : All expected cell counts are at least 5, and samples were chosen independently so the  2 test is appropriate.
34. 34. 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 < 6.25, the P-value > 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.
35. 35. 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.
36. 36. 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.
37. 37. Example <ul><li>Determine if the carrying device proportions are the same for both genders using a 0.05 level of significance. </li></ul>
38. 38. Example 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 the same for both genders. Significance level :  = 0.05 Test statistic:
39. 39. Example Using Minitab, we get the following output: 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
40. 40. Example We draw the following conclusion. 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.
41. 41.  2 Test for Independence Hypotheses: H 0 : The two variables are independent. H a : The two variables are not independent. The  2 test statistic and procedures can also be used to investigate the association between tow categorical variable in a single population.
42. 42.  2 Test for Independence The expected cell counts are estimated from the sample data (assuming that H 0 is true) using the formula Test statistic:
43. 43.  2 Test for Independence 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. P-value: When H 0 is true,  2 has approximately a chi-square distribution with df = (number of rows - 1)(number of columns - 1)
44. 44.  2 Test for Independence <ul><li>Assumptions: </li></ul><ul><ul><li>The observed counts are from a random sample . </li></ul></ul><ul><ul><li>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. </li></ul></ul>
45. 45. Example Consider the two categorical variables, gender and principle form of vision correction for the sample of students used earlier in this presentation. We shall now test to see if the gender and the principle form of vision correction are independent.
46. 46. Example Hypotheses: H 0 : Gender and principle method of vision correction are independent. H a : Gender and principle method of vision correction are not independent. Significance level : We have not chosen one, so we shall look at the practical significance level. Test statistic:
47. 47. Example Assumptions : We are assuming that the sample of students was randomly chosen. All expected cell counts are at least 5, and samples were chosen independently so the  2 test is appropriate.
48. 48. Example Assumptions : Notice that the expected count is less than 5 in the cell corresponding to Female and Contacts. So that we should combine the columns for Contacts and Glasses to get
49. 49. Example The contingency table for this example has 2 rows and 2 columns, so the appropriate df is (2-1)(2-1) = 1. Since 0.246 < 2.70, the P-value is substantially greater than 0.10. H 0 would not be rejected for any reasonable significance level. There is not sufficient evidence to conclude that the gender and vision correction are related. (I.e., For all practical purposes, one would find it reasonable to assume that gender and need for vision correction are independent. Calculations :
50. 50. Example Minitab would provide the following output if the frequency table was input as shown. Chi-Square Test: Contacts or Glasses, None Expected counts are printed below observed counts Contacts None Total 1 14 11 25 12.97 12.03 2 27 27 54 28.03 25.97 Total 41 38 79 Chi-Sq = 0.081 + 0.087 + 0.038 + 0.040 = 0.246 DF = 1, P-Value = 0.620

### Be the first to comment

• #### ongotre

Sep. 12, 2007

Jan. 11, 2018

Total views

1,831

On Slideshare

0

From embeds

0

Number of embeds

33

71

Shares

0