The Chi-Square Family, Small Expected Counts and the Link to z
AP Statistics · Unit 3 — Inference for Categorical Data: Proportions
What the chi-square distribution looks like
The $\chi^2$ statistic is a sum of squares, so it is never negative and its distribution is right-skewed, starting at $0$. There is one curve for each $df$; the mean of the curve equals $df$, and as $df$ grows the curve becomes more symmetric and shifts right. Because only large values of $\chi^2$ signal disagreement with $H_0$, the P-value is always the area in the upper tail: on a calculator, $\chi^2\text{cdf}(\text{statistic},\ \infty,\ df)$. Example: $\chi^2=4{,}0$ with $df=1$ gives P $\approx0{,}046$; the same $4{,}0$ with $df=3$ gives P $\approx0{,}26$ — the statistic means nothing without its $df$.
When an expected count is below 5
The $\chi^2$ approximation breaks down when expected counts are small. If a category has expected count under $5$, the standard remedy is to combine it with a neighbouring, logically similar category (e.g. "5 or more" absences), recompute the expected counts, and reduce $df$ accordingly because there are now fewer categories. If combining is not sensible, report that the condition fails and that the P-value is unreliable — that sentence earns the point.
Chi-square and z on a 2×2 table
For a $2\times2$ table the chi-square test of homogeneity and the two-sided two-proportion $z$ test are the same test: $\chi^2=z^2$ and the P-values agree exactly. The $z=2{,}0$ from the drug-versus-placebo study becomes $\chi^2=4{,}0$ with $df=1$ and the same P-value $0{,}046$. Use $z$ when the alternative is one-sided or when you need a confidence interval for the difference; chi-square cannot do either.
Worked example: combining categories when expected counts are too small
A candy maker claims the proportions of red : blue : yellow : orange : purple are $30:20:20:20:10$ ($\%$). A random bag of $40$ pieces has $15,\,6,\,9,\,7,\,3$ pieces in that order. Test the claim at $\alpha=0.05$.
Solution
State: $H_0$: the color distribution is as claimed; $H_a$: at least one proportion differs from the claim. Goodness-of-fit test.
Check: expected $=40\times$ proportion: $12,\,8,\,8,\,8,\,4$. Purple has expected count $4\lt5$ — the condition fails. Combine orange and purple into "orange/purple" ($30\%$): new expected counts $12,\,8,\,8,\,12$, observed $15,\,6,\,9,\,10$; every expected count $\ge5$. There are now $4$ categories so $df=3$.
Calculate:
$$\chi^2=\frac{3^2}{12}+\frac{2^2}{8}+\frac{1^2}{8}+\frac{2^2}{12}=0.75+0.50+0.125+0.333\approx1.71$$$df=3$, $P=\chi^2\text{cdf}(1.71,\infty,3)\approx0.63$.
Conclusion: $0.63\gt0.05$, do not reject $H_0$. There is no convincing evidence that the color distribution differs from the claim. Note in your answer: two categories were combined to meet the condition, and $df$ dropped from $4$ to $3$ as a result.