Unit 4 Hypothesis Testing

10.2 Test for Independence

A contingency table (or two way frequency table) is a table in which frequencies correspond to two variables. One variable is used to categorize rows and a second variable is used to categorize columns.


A test of independence tests the null hypothesis that in a contingency table, the row and column variables are independent.


Requirements:

  1. The sample data are randomly selected
  2. The sample data are represented as frequency counts in a two way table.
  3. For every cell in the contingency table, the expected frequency E is at least 5. (There is no requirement every observed frequency must be at least 5. Also there is no requirement that the population must have a normal distribution or any other specific distribution.

Degrees of Freedom:

\(df = (columns - 1)(rows - 1)\)

Null and Alternate hypotheses:

  \(H_0\): The row and column variables are independent (Means: No relationship between the variables)

  \(H_A\): The row and column variables are dependent (Means: Some relationship between the variables)

Test statistic for a Test of Independence:

You will get the test statistic from technology. You must label the rows in the first column. Use this formula if you want to calculate the test statistic by hand. The last pages of these notes have a more detailed explanation of calculating the expected frequencies, critical value, and test statistic by hand.

   \(\chi^{2}=\sum \frac{(O-E)^{2}}{E}\)

Using Technology for a Test for Independence:

Using Technology for Independence:

  1. Identify the critical chi-squared value, \({\chi^2}_{CV}\) (called \({\chi^2}_{O}\) in your text) in order to shade your curve.
    1. \(df = (columns - 1)(rows - 1)\)
    2. Area to the right (always a right-tail test, use ≥) is the significance level
  2. Run the test and record the important information: Identify
    1. Test Statistic (Chi-Square)
    2. P-value
  3. Mark your curve with your test statistic. Is it in the shaded rejection region in the right tail?
  4. Make your decision about the null. Was the p-value < alpha?

The Chi-Square Curve for a Test for Independence

A test of independence is always a right-tailed test. Large values of \(\chi^2\)result from significant differences in observed and expected frequencies. So, when the test statistic falls in the critical region in the right tail, we know that our observed frequencies are too different from what the expected values should be—therefore, we know the row and column variables are not independent. (Expected values assume independence.)

Generic Chi-square distribution curve.  Rises rapidly on the left side of the graph to the max and then slowly descends to the right.  As a result, it looks like most of the graph is on the left.  The critical value is labeled CV under the x-axis and marked with a vertical line through the curve.  The larger area to the left of the CV is labeled Fail to reject independence.  The smaller area to the right of the CV is labeled reject independence.

Problems

  1. Open Roof or Closed Roof? In a recent Six Nations Grand Slam game, the Wales rugby team broke protocol by asking to have the roof closed on the Principality Stadium (Millenium Stadium) in Cardiff. However, under Six Nations rules, both teams must agree to the roof being closed and Ireland requested it stay open. But would the closed roof really help the Wales team? The table below shows the results from rugby games leading up to the Grand Slam. Use a 0.05 significance level to test for independence between wins and whether the roof is open or closed. Does it appear that a closed roof really gives the Wales team an advantage?
    Win Loss
    Closed Roof 36 17
    Open Roof 15 11
    1. The original claim: The number of Wales wins is dependent on the roof being open or closed.
    2. \(H_0\) : The number of Wales wins is independent of the roof being open or closed.
    3. \(H_A\) :The number of Wales wins is dependent on the roof being open or closed.
    4. \(\alpha\) = 0.05
    5. \({\chi^2}_{CV}\): = 3.84
    6. \({\chi^2}_{TS}\): = 0.80
    7. p-value: 0.3716
    8. Rejection Criteria: Reject \(H_0\) if p-value < 0.05
    9. Decision: Fail to reject \(H_0\)
    10. Generic Chi-square curve labeled Right tailed test, .80<3.84, not in the critical region

    11. Concluding Statement: There is not sufficient evidence to support the claim that the number of wins and the roof being open or closed are dependent.
    12. Does it appear that a closed roof really gives the Wales team an advantage? No, the evidence does not support the claim that there is a relationship between number of wins and the status of the roof. One variable does not appear to change according to the other variable.
  2. Alcoholism Risk in 9/11 Responders. Some firefighters and other responders to the World Trade Center on September 11, 2001, have experienced symptoms of traumatic stress, depression, anxiety, and drinking problems. Cornell University researchers conducted a survey of a random sample of New York firefighters, some of whom had participated in the 9/11 rescue efforts. The reports title is “On the Front Line: The Work of First Responders in a Post-9/11 World.” Use the data from the report to investigate the question: Are alcohol-related problems among New York firefighters associated with participation in the 9/11 rescue? (lumenlearning.com)
    No risk for alcohol problems Moderate to severe risk for alcohol problems
    Participated in 9/11 rescue 793 309
    Did not participate in 9/11 rescue 441 110
    1. The original claim: Participation in 9/11 rescue operations and alcohol related problems for New York firefighters are dependent.
    2. \(H_0\) : Participation in 9/11 rescue operations and alcohol related problems for New York firefighters are independent.
    3. \(H_A\) :Participation in 9/11 rescue operations and alcohol related problems for New York firefighters are dependent.
    4. \(\alpha\) = 0.05
    5. \(df = 1\)
    6. \({\chi^2}_{CV}\): = 3.84
    7. \({\chi^2}_{TS}\): = 12.66
    8. p-value: 0.0004
    9. Rejection Criteria: Reject \(H_0\) if p-value < 0.05
    10. Decision: Reject \(H_0\)
    11. Generic Chi-square curve labeled Right tailed test, .12.66 > 3.84, in the critical region

    12. Concluding Statement: There is sufficient evidence to support the claim that participation in 9/11 rescue operations and alcohol related problems for New York firefighters are dependent.

  3. Injuries and Motorcycle Helmet Color : A case-control (or retrospective) study was conducted to investigate a relationship between the colors of helmets worn by motorcycle drivers and whether they are injured or killed in a crash (Wells). Use a 0.05 significance level to test the claim that injuries are independent of helmet color. Should motorcycle drivers choose helmets with a particular color? If so, which color appears best?
    Black White Yellow/
    Orange
    Red Blue
    Controls (not injured) 491 377 31 170 70
    Cases (injured or killed) 213 112 8 55 26

    1. The original claim: Motorcycle injuries are independent of helmet colors.
    2. \(H_0\) : Motorcycle injuries are independent of helmet colors.
    3. \(H_A\) :Motorcycle injuries and helmet colors are dependent.
    4. \(\alpha\) = 0.05
    5. \(df = 4\)
    6. \({\chi^2}_{CV}\): = 9.488
    7. \({\chi^2}_{TS}\): = 9.5114
    8. p-value: 0.0495
    9. Rejection Criteria: Reject \(H_0\) if p-value < 0.05
    10. Decision: Reject \(H_0\)
    11. Generic Chi-square curve labeled Right tailed test, 9.971 > 9.488, in the critical region

    12. Concluding Statement: There is sufficient evidence to reject the claim that motorcycle injuries and helmet color are independent.
    13. Should motorcycle drivers choose helmets with a particular color? If so, which color appears best?

      It does appear that motorcycle drivers should select helmets that are yellow/orange.

      ***Note: If you perform this test with α = 0.01, you would fail to reject independence.

Calculating the Expected Frequencies, Critical Value, and Test Statistic by Hand

The chi-square test provides a method for testing the association between the row and column variables in a two-way table. The null hypothesis H0 assumes that there is no association between the variables (in other words, one variable does not vary according to the other variable), while the alternative hypothesis Ha claims that some association does exist. The alternative hypothesis does not specify the type of association, so close attention to the data is required to interpret the information provided by the test.


The chi-square test is based on a test statistic that measures the divergence of the observed data from the values that would be expected under the null hypothesis of no association. This requires calculation of the expected values based on the data. The expected value for each cell in a two-way table is equal to (row total*column total)/n, where n is the total number of observations included in the table. (http://www.stat.yale.edu/Courses/1997-98/101/chisq.htm)

Notation:
Critical Value:

The critical value for \(\chi^2\) can be found in Table A-4 using the degrees of freedom and significance level (remember that the test for independence is right-tailed, so α represents the area to the right of the critical value).


Degrees of freedom
\(df== (r-1)(c-1)\)
Test statistic for a Test of Independence:

\(\chi^{2}=\sum \frac{(O-E)^{2}}{E}\)

E must be calculated for EACH cell in the contingency table.

The TS is calculated by adding all of the \(\frac{\left(O-E\right)^2}E\) from each cell.

Problems
  1. Popular Kids: Students in grades 4, 5, and 6 were asked whether good grades, popularity, or athletic ability were most important to them. Use the following data to test whether the responses depend on the grade level of the student. Use a 0.05 significance level.
    Goals 4th Grade 5th Grade 6th Grade Total
    Academic Grades 49 50 69

    168

    Popular 24 36 38

    98

    Sports 19 22 28

    69

    Total

    92

    108

    135

    335


    (Data source: Chase, M.A and Dummer, G.M. (1992), "The Role of Sports as a Social Determinant for Children," Research Quarterly for Exercise and Sport, 63, 418-424.)

    \(H_0\): Grade level and the most important factor to the students are independent.

    \(H_A\): Grade level and the most important factor to the students are dependent.

    • Expected Values: The expected value for each cell in a two-way table is equal to (row total*column total)/n, so we have:

      \(E\left(4^{\mathrm{th}}, \text { grades }\right)=168 * 92 / 335=46.1\)

      \(E\left(5^{\text { th }}, \text { grades }\right)=168 * 108 / 335=54.2\)

      And so on…

      Complete the table for 6th Grade and Sports


      Expected Values for Goals 4th Grade 5th Grade 6th Grade
      Academic Grades 46.1 54.2

      67.7

      Popular 26.9 31.6

      39.5

      Sports

      18.9

      22.2

      27.8

    • Critical Value:

      Degrees of freedom = (3-1)(3-1) = 4

      \(\alpha = 0.05\)

      \({\chi^2}_{CV}=9.488\)

    • Test Statistic:

      The chi-square statistic for the above example is computed as follows:

      \(\chi^{2}=(49-46.1)^{2 / 46.1}+(50-54.2)^{2 / 54.2}+(69-67.7)^{2 / 67.7}+\ldots .+(28-27.8)^{2 / 27.8}\)

      \(=0.18+0.33+0.03+...+0.01\)

      \(=1.51\)

    • Conclusion:

      The TS (1.51) is not in the critical region to the right of CV (9.488), so we would fail to reject the null hypothesis of independence. This indicates that there is no relationship between grade level and the most important factor to the students.