4.7 Test for Independence


A contingency table has rows and columns containing frequencies corresponding to two variables.


We use a test of independence to determine whether the row and column variables are independent or not. The sample data must be randomly selected and every cell in the table must have an expected frequency of at least 5.


In StatCrunch we enter the table with row labels in the var1 column, then select Stat → Tables → Contingency.

  1. Open Roof or Closed Roof?: In a recent baseball World Series, the Houston Astros wanted to close the roof on their domed stadium so that fans could make noise and give the team a better advantage at home. However, the Astros were ordered to keep the roof open, unless weather conditions justified closing it. But does the closed roof really help the Astros? The table below shows the results from home games during the season leading up to the World Series. 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 Astros an advantage?
    Win Loss
    Closed Roof 36 17
    Open Roof 15 11

    The original claim: The number of Astros wins is dependent on the roof being open or closed.

    \(H_0\): The number of Astros wins is independent of the roof being open or closed.

    \(H_A\): The number of Astros wins is dependent on the roof being open or closed.

    \(\alpha =\) \(0.05\)

    p-value: \(0.3716\)

    Rejection Criteria: Reject \(H_0\) if p-value < 0.05

    Decision: Fail to Reject \(H_0\)

    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.

    Does it appear that a closed roof really gives the Astros 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. Is Sentence Independent of Plea?: Many people believe that criminals who plead guilty tend to get lighter sentences than those who are convicted in trials. The accompanying table summarized randomly selected sample data for San Francisco defendants in burglary cases. All of the subjects had prior prison sentences. Use a 0.05 significance level to test the claim that the sentence (sent to prison or not sent to prison) is independent of the plea. If you were an attorney defending a guilty defendant, would these results suggest that you should encourage a guilty plea?
    Guilty Plea Not Guilty Plea
    Sent to Prison 392 58
    Not Sent to Prison 564 14

    The original claim: The sentence is independent of the plea.

    \(H_0\): The sentence is independent of the plea.

    \(H_A\): The sentence and the plea are dependent.

    \(\alpha =\) \(0.05\)

    p-value: \(0.0000\)

    Rejection Criteria: Reject \(H_0\) if p-value < 0.05

    Decision: Reject \(H_0\)

    Concluding Statement: There is sufficient evidence to reject the claim that sentences and pleas are independent.

    If you were an attorney defending a guilty defendant, would you encourage a guilty plea? Yes, an attorney defending a guilty defendant should encourage a guilty plea to reduce the chance of going to prison because the two variable appear to be related.

  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. 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 55
    Cases (injured or killed) 213 112 8 70 26

    The original claim: Motorcycle injuries are independent of helmet colors.

    \(H_0\): Motorcycle injuries are independent of helmet colors.

    \(H_A\): Motorcycle injuries and helmet colors are dependent.

    \(\alpha =\) \(0.05\)

    p-value: \(0.0409\)

    Rejection Criteria: Reject \(H_0\) if p-value < 0.05

    Decision: Reject \(H_0\)

    Concluding Statement: There is sufficient evidence to reject the claim that motorcycle injuries and helmet color are independent.

    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.