Read this lesson as text
Test for Independence
Statistics · Axiom Academy
Learn how to determine if two categorical variables are statistically independent using the chi-square test Two categorical variables are independent if knowing the value of one variable doesn't give you any information about the other variable. We organize our data in a contingency table (also called a two-way table) that shows the frequency of observations for each combination of categories. 2. Calculating Expected Frequencies If two variables are independent, we can calculate the expected frequency for each cell in our contingency table using the row and column totals. This formula tells us: "If there's no relationship between the variables, how many observations would we expect in this cell based on the marginal distributions?" 3. The Chi-Square Test Statistic We measure how different the observed frequencies (O) are from the expected frequencies (E) using the chi-square statistic: We sum this calculation across all cells in the contingency table. Larger values indicate greater differences between observed and expected frequencies. To determine if our χ² statistic is statistically significant, we need the degrees of freedom for our test: Where r is the number of rows and c is the number of columns in the contingency table (excluding totals). After calculating χ² and df, we compare our test statistic to the chi-square distribution to get a p-value.
This is the written version of the interactive lesson above. See the full Statistics course.