Goodness of Fit Test
Chi-Square Goodness-of-Fit Test for a Single Categorical Variable
The chi-square goodness-of-fit (GOF) test checks whether the observed counts in the categories of one categorical variable, measured on one simple random sample, match a set of hypothesized proportions. State H0 as the claimed category proportions and Ha as at least one population proportion differing; these may be written in words or mathematical notation.
- H0: the population proportions in each category equal the stated values.
- Ha: at least one population proportion differs from the stated value.
Observed vs. expected number of customers choosing each of five chip flavors (n = 200), tested against the hypothesis of equal preference (20% each).
Chip flavor preference study (n = 200)
Key equations
For each category compute the expected count using Ei=npi, where n is the total sample size and pi is the hypothesized proportion. The test statistic is
with degrees of freedom df=k−1, where k is the number of categories (assuming no parameters were estimated from the data). Compare χ2 to a critical value from the chi-square table, or compute a p-value; reject H0 if χ2 is large enough.
Worked example
Suppose a six-sided die is rolled n=60 times to test fairness, so pi=1/6 and Ei=10 for every face. The observed counts are 8, 9, 15, 7, 11, 10. Then
With df=5, the critical value at α=0.05 is 11.07. Since 4.00<11.07, we fail to reject H0; at α = 0.05, the data do not provide sufficient evidence that the die is unfair.
A quality-control manager wants to test whether monthly product returns are equally distributed among 6 product categories using a chi-square goodness-of-fit test. No parameters are estimated from the sample data. What is the correct number of degrees of freedom for this test?
A university claims that among its undergraduates, 25% are in Science, 20% in Arts, 15% in Engineering, 15% in Commerce, and 25% in other programs. In a random sample of 240 students, calculate the expected number of students who should be in Commerce if the university's claim is true.
Give your answer in students.