Skip to main content
K12 LibreTexts

9.9: Test of Independence

  • Page ID
    5791
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Chi-Squared II – Testing for Independence

    It is a common belief that age influences food preference. Suppose you wanted to test that hypothesis. How could you test observed data to see if the two variables (age and food preference) influence each other?

    Look to the end of the lesson to see the answer.

    Screen Shot 2020-07-24 at 1.34.49 PM.png

    fiugre1

    Chi-Squared Test of Independence

    A chi-square (χ2) test can be used to determine if observed data indicates that two variables are dependent in much the same way that the test can be used to determine goodness of fit.

    Just as with a goodness of fit test, we will calculate expected values, calculate a chi-square statistic, and compare it to the appropriate chi-square value from a reference to see if we should reject H0, which is that the variables are not related.

    In fact, the only major difference in process between a goodness of fit test and a test of independence is how we calculate the expected values, as you will see in the first example.

    Just for reference:

    • The formula to calculate chi-square is:

    Screen Shot 2020-07-24 at 1.36.15 PM.png

    • Some good resources for a chi-square critical value calculator's are Daniel Soper's website and Easy Calculation's website. You can also search "free critical chi-square value calculator".
    • The formula for calculating expected values in a test of independence is:

    Screen Shot 2020-07-24 at 1.49.46 PM.png

    Where C is the observed column total for the cell, R is the observed row total for the cell, and n is the total number of samples. (see Example A for clarification of the use of the formula)

    • The degrees of freedom in a test of independence are calculated as:

    df=(rows−1)(columns−1)

    Finding Expected Values

    Given the following contingency table, what is the expected value for each of the four cells in the body of the table?

    A

    B

    TOTAL

    X

    23

    37

    60

    Y

    19

    41

    60

    TOTAL

    42

    78

    120

    To calculate the expected values, use the formula expected cell value=C×Rn for each cell:


    Additional Resources

    Video: Test Requiring the Chi-Square Distribution

    Practice: Test of Independence


    This page titled 9.9: Test of Independence is shared under a CK-12 license and was authored, remixed, and/or curated by CK-12 Foundation via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    CK-12 Foundation
    LICENSED UNDER
    CK-12 Foundation is licensed under CK-12 Curriculum Materials License
    • Was this article helpful?