1 / 48

Chapter 12

Chapter 12. The Analysis of Categorical Data and Goodness-of-Fit Tests. Univariate Categorical Data.

nishan
Download Presentation

Chapter 12

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 12 The Analysis of Categorical Data and Goodness-of-Fit Tests

  2. Univariate Categorical Data • 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.

  3. Univariate Categorical Data • A local newsperson might be interested in testing hypotheses about the proportion of the population that fall in each of the categories. For example, the newsperson might want to test to see if the five categories occur with equal frequency throughout the whole university system. • To deal with this type of question we need to establish some notation.

  4. Notation • k = number of categories of a categorical variable • p1 = true proportion for category 1 • p2 = true proportion for category 2 •  •  • pk = true proportion for category k • (note: p1 + p2 +  + pk = 1)

  5. Hypotheses • H0: p1 = hypothesized proportion for category 1 • p2 = hypothesized proportion for category 2 •  •  • pk = hypothesized proportion for category k • Ha: H0 is not true, so at least one of the true category proportions differs from the corresponding hypothesized value.

  6. Expected Counts • 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.

  7. Expected Counts - Example • 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.

  8. Goodness-of-fit statistic, c2

  9. Chi-square distributions

  10. Upper-tail Areas for Chi-squared Distributions

  11. Goodness-of-Fit Test Procedure Hypotheses: H0: p1 = hypothesized proportion for category 1 p2 = hypothesized proportion for category 2   pk = hypothesized proportion for category k Ha: H0 is not true

  12. Goodness-of-Fit Test Procedure P-values: When H0 is true andall expected counts are at least 5, c2 has approximately a chi-squared distribution with df = k-1. Therefore, the P-value associated with the computed test statistic value is the area to the right of c2 under the df = k-1 chi-squared curve.

  13. Goodness-of-Fit Test Procedure • Assumptions: • Observed cell counts are based on a random sample. • 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.

  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 p1, p2, p3, p4, and p5 denote the proportions of all faculty in this university system that are full professors, associate professors, assistant professors, instructors and adjunct/part time respectively. H0: p1 = 0.2, p2 = 0.2, p3 = 0.2, p4= 0.2, p5 = 0.2 Ha: H0 is not true

  15. Example Significance level: a = 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.

  16. Example Calculation: recall

  17. Example P-value: The P-value is based on a chi-squared distribution with df = 5 - 1 =4. The compute value of c2, 7.56 is smaller than 7.77, the lowest value of c2 in the table for df = 4, so that the P-value is greater than 0.100. Conclusion: Since the P-value > 0.05 = a, H0 cannot be rejected. There is not sufficient evidence to refute the claim that the proportion of faculty in each of the different categories is the same.

  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. 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. 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. 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. 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:

  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. Tests for Homogeneity in a Two-Way Table

  25. Tests for Homogeneity in a Two-Way Table Expected counts are in parentheses.

  26. Comparing Two or More Populations Using the c2 Statistic Hypotheses: H0: The true category proportions are the same for all of the populations (homogeneity of populations). Ha: The true category proportions are not all the same for all of the populations.

  27. Comparing Two or More Populations Using the c2 Statistic

  28. Comparing Two or More Populations Using the c2 Statistic P-value: When H0 is true,c2has approximately a chi-squared 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 c2 under the chi-squared curve with the appropriate df.

  29. Comparing Two or More Populations Using the c2 Statistic • Assumptions: • The data consists of independently chosen random samples. • 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.

  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 intensiveversus moderate chemotherapy of lympocytic lymphomas: a progress report. Cancer, 38, 1060-1068.

  31. Example Set up and perform an appropriate hypothesis test at the 0.05 level of significance.

  32. Example Hypotheses: H0: The true response to treatment proportions are the same for both treatments (homogeneity of populations). Ha: The true response to treatment proportions are not all the same for both treatments. Significance level:a = 0.05

  33. Example Assumptions: All expected cell counts are at least 5, and samples were chosen independently so the c2 test is appropriate.

  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 > a = 0.05 so H0 is not rejected. There is not sufficient evidence to conclude that the responses are different for the two treatments.

  35. Comparing Two or More Populations Using the c2 Statistic P-value: When H0 is true,c2has approximately a chi-squared distribution with df = (number of rows - 1)(number of columns - 1)

  36. Example II The following data come from a study of the length of stay of 336 patients in psychiatric observation ward prior to be sent to another location. The observed variables are length of stay and four categories combining gender and status of admission.

  37. Example II

  38. Example III The following data come from a study of Hodgkin's disease, a cancer of the lymph nodes. The observed variables are histological type and response to treatment 3 months after it had begun. LP = lymphocyte dominance NS = Nodular sclerosis MC = mixed cellurarity LD = lymphocyte depletion

  39. c2 Test for Independence The c2 test statistic and procedures can also be used to investigate the association between tow categorical variable in a single population. Hypotheses: H0: The two variables are independent. Ha: The two variables are not independent.

  40. c2 Test for Independence

  41. c2 Test for Independence P-value: When H0 is true,c2has approximately a chi-squared distribution with df = (number of rows - 1)(number of columns - 1)

  42. c2 Test for Independence • Assumptions: • The observed counts are from a random sample. • 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.

  43. 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.

  44. Example Hypotheses: H0: Gender and principle method of vision correction are independent. Ha: 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.

  45. 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 c2 test is appropriate.

  46. 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

  47. Example Calculations: 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. H0 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.

  48. 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

More Related