Chi-Square Test
of Independence
Discover how to determine whether two categorical variables are related using the powerful \( \chi^2 \) test of independence.
What Is the \( \chi^2 \) Test of Independence?
The chi-square test of independence is a hypothesis test used to determine whether there is a statistically significant association between two categorical variables. It answers: are these two variables independent, or are they related?
Working with Categorical Variables
Anatomy of a Contingency Table
| Healthy | Unhealthy | Row Total | |
|---|---|---|---|
| None | 15 | 35 | 50 |
| Moderate | 40 | 30 | 70 |
| High | 55 | 25 | 80 |
| Column Total | 110 | 90 | 200 |
Setting Up the Hypotheses
The \( \chi^2 \) Statistic Formula
Computing Expected Frequencies
For each cell in the contingency table, the expected frequency assumes the row and column variables are independent. If they are, the proportion in each cell should reflect the product of the marginal proportions.
Degrees of Freedom
The \( \chi^2 \) Distribution
Independence vs Goodness of Fit
| Test of Independence | Goodness of Fit | |
|---|---|---|
| Purpose | Are two variables related? | Does one variable match a specified distribution? |
| Variables | Two categorical variables | One categorical variable |
| Data Format | Two-way contingency table | One-way frequency table |
| df Formula | \( (r-1)(c-1) \) | \( k - 1 \) |
| Expected Values | From marginals | From hypothesized proportions |
Conditions for Validity
How to Perform the \( \chi^2 \) Test
Worked Example: Setup
A researcher surveys 200 students on study method (Flashcards, Practice Problems, Reading) and exam result (Pass, Fail). Is there an association at \( \alpha = 0.05 \)?
| Pass | Fail | Total | |
|---|---|---|---|
| Flashcards | 38 | 12 | 50 |
| Practice Problems | 56 | 14 | 70 |
| Reading | 42 | 38 | 80 |
| Total | 136 | 64 | 200 |
Expected Values Computed
| Pass (E) | Fail (E) | |
|---|---|---|
| Flashcards | \( \frac{50 \times 136}{200} = 34 \) | \( \frac{50 \times 64}{200} = 16 \) |
| Practice Problems | \( \frac{70 \times 136}{200} = 47.6 \) | \( \frac{70 \times 64}{200} = 22.4 \) |
| Reading | \( \frac{80 \times 136}{200} = 54.4 \) | \( \frac{80 \times 64}{200} = 25.6 \) |
Computing \( \chi^2 \)
Drawing a Conclusion
Common Mistakes
Summary at a Glance
| Component | Details |
|---|---|
| Purpose | Test whether two categorical variables are independent |
| Formula | \( \chi^2 = \sum \frac{(O-E)^2}{E} \) |
| Expected Value | \( E = \frac{\text{Row Total} \times \text{Col Total}}{\text{Grand Total}} \) |
| Degrees of Freedom | \( (r - 1)(c - 1) \) |
| Key Condition | All expected counts \( \geq 5 \) |
| Decision Rule | Reject \( H_0 \) if \( \chi^2 \geq \chi^2_{\text{crit}} \) or if \( p \leq \alpha \) |
| Conclusion | Evidence of association (not causation) |
Interpreting the P-Value
The p-value represents the probability of observing a \( \chi^2 \) value as extreme or more extreme than our test statistic, assuming \( H_0 \) is true. A smaller p-value provides stronger evidence against independence.
Question 1 of 5
The null hypothesis for a chi-square test of independence states that:
Question 2 of 5
A contingency table has 4 rows and 3 columns. What are the degrees of freedom for the \( \chi^2 \) test of independence?
Question 3 of 5
In a \( 2 \times 2 \) table, one cell has a row total of 30, a column total of 40, and a grand total of 200. What is the expected frequency for that cell?
Question 4 of 5
Which condition must be met before performing a chi-square test of independence?
Question 5 of 5
A chi-square test of independence yields \( \chi^2 = 9.21 \) with \( df = 2 \). The critical value at \( \alpha = 0.01 \) is 9.210. What is the correct conclusion?