CHAPTER 05 · TOPIC 02
Chi-Square Goodness-of-Fit Test
Compare observed counts with counts expected from specified theoretical proportions to assess an entire categorical distribution.
On this page
The chi-square goodness-of-fit test examines whether the observed frequencies of a categorical variable fit a prespecified theoretical proportion.
From binomial distribution to multinomial distribution#
If the probability of k exclusive categories is π₁,…,πk and the frequency is O₁,…,Ok, then the frequency vector follows a multinomial distribution.
Data and model conditions#
- Each unit of observation falls into only one category
- Observations are independent
- The total theoretical ratio is 1
- Chi-square approximation has sufficient expected power
Hypotheses#
Pearson chi-square statistic#
For two categories#
O₁=a, O₂=n−a, and substituting the expected values np and n(1−p) corresponds to the square of the one-proportion Z statistic.
The reason why the degree of freedom is k−1#
Since the total number n is fixed, when k−1 frequencies are determined, the last one is automatically determined. If m parameters are estimated from the same data, subtract m further.
Difference with independence test#
| method | Number of variables | Expected count |
| goodness of fit test | one categorical variable | Calculated from pre-specified theoretical proportions |
| independence test | two categorical variables | Estimated from row and column marginal proportions |
Testing Procedure#
- Predefine categories and theoretical proportions
- Calculate Eᵢ=nπᵢ and check the approximation conditions
- Calculate Pearson χ² and degrees of freedom
- Determine suitability from the right tail p-value
- If significant, check the residuals for each category and interpret the location of the deviation.