Goodness-of-Fit — Definition, Formula & Example
Goodness-of-fit describes how closely the counts you actually observe match the counts a model predicts. In AP Statistics, the chi-square goodness-of-fit test checks whether one categorical variable follows a claimed distribution.
The chi-square goodness-of-fit test evaluates : the population proportions equal specified values , against : at least one differs. The test statistic has an approximate chi-square distribution with degrees of freedom when is true. The approximation requires a random sample and all expected counts . The tests for homogeneity and independence use the same statistic with two-way tables.
Key Formula
Where:
- = observed count in category i
- = expected count in category i if the null hypothesis is true
- = total sample size
- = hypothesized proportion for category i
- = number of categories
Worked Example
Problem: A spinner has 4 equal sections: A, B, C, D. You spin it 100 times and get A = 30, B = 20, C = 28, D = 22. At the level, is there convincing evidence that the spinner is unfair?
Step 1: State the hypotheses. : each section has probability . : at least one probability differs from . Under , each expected count is 25, which is at least 5, so the condition holds.
Step 2: Compute each category's contribution and add them.
Step 3: Use . The P-value is the area to the right of 2.72 under the chi-square curve with 3 degrees of freedom.
Answer: Because the P-value of about 0.44 is greater than 0.05, you fail to reject . There is not convincing evidence that the spinner is unfair.
Why It Matters
Goodness-of-fit tests appear on the AP Statistics exam in the inference unit on categorical data. Geneticists use them to check whether offspring ratios match Mendelian predictions such as 9:3:3:1. Auditors use them to test whether reported digits follow Benford's law.
Common Mistakes
Mistake: Using (sample size minus 1) for the degrees of freedom.
Correction: For goodness-of-fit, use , where is the number of categories. In the spinner example, , not 99.
