The Chi-Square
Distribution
Master the right-skewed distribution that powers categorical inference: from goodness-of-fit tests to tests of independence.
What is the Chi-Square Distribution?
When you square independent standard normal variables and add them together, the result follows a chi-square distribution. If \( Z_1, Z_2, \ldots, Z_k \) are independent \( N(0,1) \) variables, then:
The parameter \( k \) is called the degrees of freedom (df). It controls the shape, center, and spread of the distribution.
Why Does It Matter in Biostatistics?
Shape Across Degrees of Freedom
Key Properties
The Test Statistic
For both goodness-of-fit and independence tests, the test statistic has the same form. Let \( O_i \) be the observed count and \( E_i \) the expected count for category \( i \):
A large \( \chi^2 \) value means observed data deviate greatly from expectation, providing evidence against the null hypothesis.
Goodness-of-Fit vs Independence
| Goodness-of-Fit | Test of Independence | |
|---|---|---|
| Purpose | Does one variable match a theoretical distribution? | Are two categorical variables related? |
| Data layout | One row of counts | Two-way contingency table |
| Degrees of freedom | \( k - 1 \) | \( (r-1)(c-1) \) |
| \( H_0 \) | Observed fits expected proportions | Variables are independent |
| Example | Mendelian \( 9:3:3:1 \) ratio | Drug vs placebo outcome |
How to Perform a Chi-Square Test
Example 1: Mendelian Genetics
A geneticist crosses two heterozygous pea plants and observes 320 offspring. Under the Mendelian \( 3:1 \) ratio, we expect 240 dominant and 80 recessive. The observed counts are 218 dominant and 102 recessive.
Example 2: Test of Independence
A clinical trial tests whether treatment type (Drug A vs Drug B) is associated with outcome (Improved vs Not Improved). Here is the \( 2 \times 2 \) table of observed counts:
| Improved | Not Improved | Total | |
|---|---|---|---|
| Drug A | 45 | 15 | 60 |
| Drug B | 30 | 30 | 60 |
| Total | 75 | 45 | 120 |
Example 2: Calculation
Example 3: Blood Type Distribution
A researcher surveys 200 patients and wants to test whether the distribution matches the known population proportions: O = 45%, A = 40%, B = 11%, AB = 4%.
| O | A | B | AB | |
|---|---|---|---|---|
| Observed | 85 | 76 | 28 | 11 |
| Expected | 90 | 80 | 22 | 8 |
Reading the Critical Value Table
| df | \( \alpha = 0.10 \) | \( \alpha = 0.05 \) | \( \alpha = 0.01 \) |
|---|---|---|---|
| 1 | 2.706 | 3.841 | 6.635 |
| 2 | 4.605 | 5.991 | 9.210 |
| 3 | 6.251 | 7.815 | 11.345 |
| 4 | 7.779 | 9.488 | 13.277 |
| 5 | 9.236 | 11.070 | 15.086 |
Conditions and Assumptions
Common Mistakes to Avoid
Question 1 of 5
A chi-square goodness-of-fit test has 6 categories. What are the degrees of freedom?
Question 2 of 5
In a \( 3 \times 4 \) contingency table, what are the degrees of freedom for a test of independence?
Question 3 of 5
For a category with observed count 30 and expected count 25, what is the contribution to \( \chi^2 \)?
Question 4 of 5
A researcher calculates \( \chi^2 = 4.12 \) with \( \text{df} = 2 \). The critical value at \( \alpha = 0.05 \) is 5.991. What is the correct conclusion?
Question 5 of 5
Which condition must be met before performing a chi-square test?