Chi-square goodness of fit
This test asks whether observed counts match the counts a model predicts. The statistic is the sum of (observed - expected) squared / expected, with k - 1 degrees of freedom for k categories.
Last updated
Analogy
Checking a die by rolling it many times and comparing each face's count with the fair share.
Example
60 rolls, expected 10 per faceObserved: 5, 8, 9, 8, 10, 20Sum of (O-E)^2/E= (25+4+1+4+0+100)/10 = 13.4df = 5, critical 11.07, p = 0.02
In practice
Tests whether sales are equal across days, or whether genetics data follow a predicted ratio.
Practice
Flashcards
- Chi-square statistic formula?Sum of (observed - expected) squared / expected.
Questions people ask
How do I read the chi-square statistic?
Each term measures how far a count is from its expected value, scaled by that expected value. A large total means the data is far from the model. Compare it with the chi-square distribution for the right degrees of freedom to get a p-value.
Can the chi-square statistic be negative?
No. Every term is a squared difference divided by a positive expected count, so the sum is zero or larger. Zero means the observed counts match the expected exactly. Larger values mean worse fit, so only the upper tail matters.