Mathfolis

Chi-Square Goodness-of-Fit Test

Unit 8 · Inference for Categorical Data: Chi-Square

What AP Stats asks here

A goodness-of-fit test compares observed counts in kk categories to a hypothesized distribution. The statistic χ2=(OE)2/E\chi^2 = \sum (O - E)^2/E is squared, so the test is always right-tailed — a small chi-square means agreement, large means disagreement. Two recurring AP traps: doubling the p-value as if it were two-sided, and dropping (rather than merging) categories with small expected counts.

Goodness-of-fit

Expected count
Ei=npiE_i = n p_i
Statistic
χ2=i=1k(OiEi)2Ei\chi^2 = \sum_{i=1}^{k} \dfrac{(O_i - E_i)^2}{E_i}
Degrees of freedom
df=k1\text{df} = k - 1
p-value
P(χk12>χobs2) — right-tailed onlyP(\chi^2_{k-1} > \chi^2_{\text{obs}}) \text{ — right-tailed only}

Conditions

Random sample
required\text{required}
Large counts
all Ei5\text{all } E_i \ge 5
10%
n<0.10Nn < 0.10 N
AP Tip: When the problem says 'fair', 'uniform', 'no preference', or 'equal across categories', the hypothesized proportions are 1/k each. Derive them from the wording.
Caution: Never double the chi-square p-value. The test is right-tailed because the statistic is a sum of squares — there is no left tail of 'unusually good fit' that counts as evidence.
Type 1

Expected counts and the chi-square statistic

Compute Ei=npiE_i = n p_i for each category, then sum the squared standardized deviations.

Example 1
A bag of 200 M&Ms is tested against the company's stated 24/20/16/14/13/13 percentages. The observed counts are 56/38/30/28/26/22. Which gives the chi-square statistic and df? (A) χ22.17\chi^2 \approx 2.17, df = 5 (B) χ212.5\chi^2 \approx 12.5, df = 6 (C) χ25.00\chi^2 \approx 5.00, df = 5 (D) χ22.17\chi^2 \approx 2.17, df = 6

Practice more of this type— AI-generated · always-new problems

Generate Problems →
Type 2

df = k − 1; always right-tailed

Once the first k1k - 1 counts are fixed, the last one is determined by the total — one degree of freedom is 'spent'. The chi-square distribution lives on [0,)[0, \infty), so the test is right-tailed only.

Example 2
A student computes χ2=12.5\chi^2 = 12.5 for a goodness-of-fit test with k=6k = 6 categories and reports 'two-sided p-value = 2P(χ52>12.5)0.0582 \cdot P(\chi^2_5 > 12.5) \approx 0.058'. Which critique is correct? (A) The student is correct — chi-square tests are two-sided. (B) The chi-square test is always right-tailed. The correct p-value is P(χ52>12.5)0.029P(\chi^2_5 > 12.5) \approx 0.029. Doubling it can flip the decision. (C) The p-value should be left-tailed instead. (D) The student should use df = 6.

Practice more of this type— AI-generated · always-new problems

Generate Problems →
Type 3

Combine low-expected categories

If Ei<5E_i < 5 for some category, merge it with a related one. Dropping a category changes the total and invalidates the test.

Example 3
A goodness-of-fit setup has five categories with expected counts 40, 20, 12, 6.4, 1.6. What should you do? (A) Drop the category with E=1.6E = 1.6 and run the test on the remaining four. (B) Combine the E=1.6E = 1.6 category with the E=6.4E = 6.4 category to form a single E=8E = 8 category, reducing df by one. (C) Proceed as is — small expected counts do not affect the test. (D) Combine all categories below 10 into one — even those above 5.

Practice more of this type— AI-generated · always-new problems

Generate Problems →
Chi-Square Goodness-of-Fit Test | AP Statistics — Mathfolis