Lesson 28a

 


Chi-Square, Goodness of Fit Test

Reading Assignment:  Read pages 631 - 637.

Class Notes:
There is one more test statistic to be studied.  It is called the Chi-Square () test statistic.  
The Chi-Square is used to test claims made about multiple (more than two) proportions or expected frequencies.


Hypothesis Testing (Four Steps)

  Step 1:
  Translate the claim into a hypothesis statement.  Label either the Null Hypothesis,
   H0, or the Alternate Hypothesis, H1, as the claim.  The only picture for a Chi-Square
   () test is:

chisq1.jpg (4604 bytes)

  Step 2:
   Use the level of significance, , to determine the size (area) of the "Reject H0" region.

  Step 3:
   Unfortunately, TI-83 does not perform the Chi-Square goodness-of-fit test
   directly.  However, we can use TI-83 to perform the Chi-Square goodness-of-fit
   test indirectly using the "CALC" function.

   First, find the critical value.  The critical value (number separating the "Fail to
   Reject H0" region from the "Reject H0" region has to be found in the Chi-Square table
   Then use TI-83 to calculate the Chi-Square test statistic. The formula for the
   Chi-Square test statistic is:

Chi-Square Test Statistic

                      with k 1 degrees of freedom
                      where:  k is the number of categories
                                    O is the observed frequency (data)
                                    E is the expected frequency (calculated)

  Label the critical value and test statistic on the diagram.  Observe in which region, 
  the "Fail to Reject H0" region or the "Reject H0" region the test statistic falls.

  Step 4:
  Make two statements.  Did you "Reject" or "Fail to reject" the Null Hypothesis, H0
  Does the data appear to support or refute the claim?
   

Multiple Comparisons of Proportions
The Chi-Square test statistic compares the observed values (data) with expected values (based on the claimed proportions).  A way of explaining this comparison is to find the distance between the observed values and the expected values.  If the total distances are small, there is little, if any, difference between the actual data and the claimed proportions.  However, if there is a large total distance, then the claimed proportions do not match the actual data and have to be discarded. 

Example 1:  A hospital administrator claims the same number of  patients visit the emergency room on any given day.  The following table lists the number of patients who were treated by the emergency room staff  last month.

Day Sunday Monday Tuesday Wednesday Thursday Friday Saturday
Patients 56 54 50 48 47 84 81

At a 0.05 level of significance, test the administrator's claim.

Solution:
Step 1:  Translate the claim into a hypothesis statement. 
The claim "the same proportion of patients visit the emergency room on any given day" translates into  == ... = .  This means the claim is assigned to the Null Hypothesis.  The corresponding diagram has only one "Reject H0" region, so the 0.05 level of significance is assigned to this region.

       H0:   == ... = claim
       H1:  At least one proportion is different 

chisq1.jpg (4604 bytes)

Step 2:  Use the level of significance, , to determine the size (area) of the "Reject H0" region.

chisq2.jpg (5041 bytes)

The values in the Chi-Square table correspond to areas to the right.  This means we use the 0.05 column.  There are also k -1 degrees of freedom.  With 7 categories (days) in our data set, df = 7 -1 = 6.  From the Chi-Square table, find the value in Row 6 and Column 0.05.  This value is 12.592.

Step 3:  Unfortunately, TI-83 does not perform the Chi-Square goodness-of-fit test directly.  However, we can use TI-83 to perform the Chi-Square goodness-of-fit test indirectly.

The test statistic is calculated in the following manner.
1.  Find the total number of observations in your data set.  
     56 + 54 + 50 + 48 + 47 + 84 + 81 = 420

2.  Calculate E, the expected frequency.  Since the equal proportion is , then (420) = 60
     is the expected frequency for each observed frequency (O).

Day Sunday Monday Tuesday Wednesday Thursday Friday Saturday
Patients 56 54 50 48 47 84 81
Expected 60 60 60 60 60 60 60

3.  

Use TI-83 to calculate the Chi-Square Test Statistic
  Using the Stat function for editing data.
  1.  Enter the observed frequencies in List 1.
  2.  Enter the expected frequencies in List 2.
  3.  Subtract List 2 from List 1.  Hit keys "2nd"  "1"  "-"  "2nd"  "2" "ENTER".
  4.  Store the differences in List 3.  Hit keys "STO"  "2nd" "3" "ENTER".
  5.  Square the differences.  Hit keys "2nd" "3" "^" "2" "ENTER".
  6.  Store the results in List 4.  Hit keys "STO" "2nd" "4" "ENTER".
 
7.  Divide the squares by the expected values.  Hit keys "2nd" "4" "" "2nd" "2"
       "ENTER".
  8.  Store the quotients in List 5.  Hit keys "STO" "2nd" "5" "ENTER".
  9.  Sum List 5.  Hit keys "2nd" "STAT".  Use the right arrow to select "MATH".
       Use the down arrow to select "SUM" and press "ENTER".  Then press 
       "2nd" "5" "ENTER".
  
     The Chi-Square Test Statistics will be displayed.  In this case the Chi-Square test
       statistic is 24.7.

4.  Label the critical value and test statistic on the diagram. 

Step 4:  Make two statements.  Did you "Reject" or "Fail to reject" the Null Hypothesis, H0.   Does the data appear to support or refute the claim?
The test statistic falls in the "Reject H0" region.

Conclusion

We reject the Null Hypothesis, H0.  The data does not support the claim.  Thus the proportion of emergency room patients is not the same from day to day.

The proportions do NOT have to be the same.  A Chi-Square test can be used to test any given proportions.  Consider the emergency room problem again. 

Example 2:  A hospital administrator claims that for each day, Sunday through Thursday,  12% of the emergency room patients visit the emergency room on each of those days.  Also for each day,  Friday and Saturday, 20% of the emergency room patients visit the emergency room on each of those days.  The following table lists the number of patients who were treated by the emergency room staff  last month.

Day Sunday Monday Tuesday Wednesday Thursday Friday Saturday
Patients 56 54 50 48 47 84 81

At a 0.05 level of significance, test the administrator's claim.

Solution:
Step 1:  Translate the claim into a hypothesis statement. 
The claim translates into and   .  This means the claim is assigned to the Null Hypothesis.  The corresponding diagram has only one "Reject H0" region, so the 0.05 level of significance is assigned to this region.

       H0:  and  
               claim
       H1:  At least one proportion differs from
               the stated model. 

chisq1.jpg (4604 bytes)

Step 2:  Use the level of significance, , to determine the size (area) of the "Reject H0" region.

chisq2.jpg (5041 bytes)

The values in the Chi-Square table correspond to areas to the right.  This means we use the 0.05 column.  There are also k -1 degrees of freedom.  With 7 categories (days) in our data set, df = 7 -1 = 6.  From the Chi-Square table, find the value in Row 6 and Column 0.05.  This value is 12.592.

Step 3:  Unfortunately, TI-83 does not perform the Chi-Square goodness-of-fit test directly.  However, we can use TI-83 to perform the Chi-Square goodness-of-fit test indirectly.

The test statistic is calculated in the following manner.
1.  Find the total number of observations in your data set.  
     56 + 54 + 50 + 48 + 47 + 84 + 81 = 420

2.  Calculate E, the expected frequency.  Since the equal proportions 0.12 and 0.20, 
      the expected frequencies are 0.12(420) = 50.4 and 0.20(420) = 84.

Day Sunday Monday Tuesday Wednesday Thursday Friday Saturday
Patients 56 54 50 48 47 84 81
Expected 50.4 50.4 50.4 50.4 50.4 84 84

3.  

Use TI-83 to calculate the Chi-Square Test Statistic
  Using the Stat function for editing data.
  1.  Enter the observed frequencies in List 1.
  2.  Enter the expected frequencies in List 2.
  3.  Subtract List 2 from List 1.  Hit keys "2nd"  "1"  "-"  "2nd"  "2" "ENTER".
  4.  Store the differences in List 3.  Hit keys "STO"  "2nd" "3" "ENTER".
  5.  Square the differences.  Hit keys "2nd" "3" "^" "2" "ENTER".
  6.  Store the results in List 4.  Hit keys "STO" "2nd" "4" "ENTER".
 
7.  Divide the squares by the expected values.  Hit keys "2nd" "4" "" "2nd" "2"
       "ENTER".
  8.  Store the quotients in List 5.  Hit keys "STO" "2nd" "5" "ENTER".
  9.  Sum List 5.  Hit keys "2nd" "STAT".  Use the right arrow to select "MATH".
       Use the down arrow to select "SUM" and press "ENTER".  Then press 
       "2nd" "5" "ENTER".
  
     The Chi-Square Test Statistics will be displayed.  In this case the Chi-Square test
       statistic is 1.3333.

4.  Label the critical value and test statistic on the diagram. 

Step 4:  Make two statements.  Did you "Reject" or "Fail to reject" the Null Hypothesis, H0.   Does the data appear to support or refute the claim?
The test statistic falls in the "Fail to Reject H0" region.

Conclusion

We fail to reject the Null Hypothesis, H0.  The data does support the claim.  Thus the proportion of emergency room patients does seem to fit the specified pattern.

Click on the hand   to continue this lesson. 

Copyright © 2008 Charlotte and Joseph Sukta. All rights reserved.

To contact authors: jsukta@morainevalley.edu

The content, views, and opinions on this page are strictly those of the author.
The contents of this page have not been reviewed or approved by Moraine Valley Community College.