Chi-Square
Goodness-of-Fit
Learn how to test whether observed data matches an expected distribution using the \(\chi^2\) goodness-of-fit test: a cornerstone of biostatistics.
What Is the \(\chi^2\) Test?
The chi-square goodness-of-fit test is a non-parametric hypothesis test that determines whether a set of observed frequencies differs significantly from a set of expected frequencies.
It is widely used in genetics, ecology, epidemiology, and clinical trials to compare observed outcomes against theoretical models.
Key Vocabulary
When Do We Use It?
The \(\chi^2\) Formula
Each term measures how far an observed count deviates from its expectation, scaled by the expected count. Squaring ensures all deviations contribute positively.
The \(\chi^2\) Distribution
Setting Up Hypotheses
Goodness-of-Fit vs Independence
| Goodness-of-Fit | Test of Independence | |
|---|---|---|
| Variables | 1 categorical variable | 2 categorical variables |
| Data Layout | Single row of counts | Two-way contingency table |
| Question | Does data fit a model? | Are the variables related? |
| Degrees of Freedom | \(k - 1\) | \((r-1)(c-1)\) |
| Example | Is a die fair? | Is drug response related to gender? |
Step-by-Step Procedure
Example 1: Fair Die
A die is rolled 60 times. If it is fair, we expect each face to appear \(E = 60/6 = 10\) times. The observed results are:
Example 1: Decision
Example 2: Mendelian Genetics
A dihybrid cross predicts a 9:3:3:1 phenotype ratio. A biologist observes 160 offspring:
| Phenotype | Observed (\(O\)) | Expected (\(E\)) | \(\frac{(O-E)^2}{E}\) |
|---|---|---|---|
| Round Yellow | 98 | 90 | 0.711 |
| Round Green | 28 | 30 | 0.133 |
| Wrinkled Yellow | 26 | 30 | 0.533 |
| Wrinkled Green | 8 | 10 | 0.400 |
Example 3: A Significant Result
A hospital tests whether patient admissions are evenly distributed across 4 departments. With 200 total admissions, each department should have \(E = 50\). Observed data:
| Department | \(O\) | \(E\) | \(\frac{(O-E)^2}{E}\) |
|---|---|---|---|
| Cardiology | 72 | 50 | 9.68 |
| Neurology | 38 | 50 | 2.88 |
| Orthopedics | 55 | 50 | 0.50 |
| Oncology | 35 | 50 | 4.50 |
Understanding the P-value
Common Mistakes
Question 1 of 5
A researcher observes 200 organisms in 4 categories with expected proportions of 25% each. What are the expected counts for each category?
Question 2 of 5
A \(\chi^2\) goodness-of-fit test is run with 6 categories. What are the degrees of freedom?
Question 3 of 5
In a \(\chi^2\) GOF test, the calculated \(\chi^2 = 12.4\) and the critical value at \(\alpha = 0.05\) is \(9.49\). What is the correct conclusion?
Question 4 of 5
Which condition must be met before performing a \(\chi^2\) goodness-of-fit test?
Question 5 of 5
A biologist crosses plants expecting a 3:1 ratio. Of 80 offspring, 54 show the dominant trait and 26 the recessive. What is \(\chi^2\)?