Chi-Squared Goodness-of-Fit Test
What you'll learn: You'll learn how to test whether your observed data follows a theoretical distribution using the chi-squared statistic.
The Core Idea
Imagine you roll a die 60 times and wonder: "Is this die fair?" You expect each face to appear 10 times (60 rolls ÷ 6 faces), but you observe something like: 12, 8, 11, 9, 13, 7. Are these differences just random variation, or is the die biased?
The chi-squared goodness-of-fit test answers this question by comparing observed frequencies with expected frequencies under a theoretical distribution.
How It Works
The test uses the chi-squared statistic:
where:
O_i= observed frequency in category iE_i= expected frequency in category i under your theoretical modelk= number of categories
The logic: If observed and expected frequencies are close, each term (O_i - E_i)²/E_i is small, making χ² small. Large χ² values suggest the data doesn't fit the theoretical distribution well.
The Testing Process
- State hypotheses: H₀: Data follows the theoretical distribution vs. H₁: It doesn't
- Calculate expected frequencies from your theoretical model
- Compute the χ² statistic using the formula above
- Find degrees of freedom: df = k - 1 - (number of estimated parameters)
- Compare your χ² to the chi-squared distribution with df degrees of freedom
- Decide: If the p-value is small (< significance level), reject H₀
Requirements
- Expected frequencies should be at least 5 in each category
- Categories must be mutually exclusive and exhaustive
- Observations must be independent
Key Takeaway: The chi-squared goodness-of-fit test quantifies how well observed categorical data matches a theoretical distribution by measuring squared deviations relative to expected frequencies.