11. Chi-Square Methods: Variance, Fit, and Independence
Explanation
The chi-square distribution
The chi-square (χ²) distribution arises as the sum of squares of df independent standard normal variables: χ² = Z₁² + Z₂² + … + Z_df². Its properties:
- It takes only values ≥ 0.
- It is skewed to the right; the shape depends on the degrees of freedom (df). With few df it is very skewed; as df grows it becomes more symmetric and, for large df (the textbook says above about 90), it approximates a normal curve.
- Its mean equals df.
- Tests based on it are almost always right-tailed, because a large statistic means a large discrepancy between what was observed and what was expected.
The textbook groups the uses into four problem types: (i) does data fit a particular distribution, (ii) do two populations have the same distribution, (iii) are two factors independent, (iv) is variability different from what was expected.
Test of a single variance
Used to test a claim about variability (σ² or σ), for example whether a machine's output is more variable than the standard allows. Hypotheses are written in terms of σ². Test statistic: χ² = (n − 1)s²/σ₀², with df = n − 1. The test can be left-, right-, or two-tailed. It assumes the population is normal and is quite sensitive to departures from normality, so it is unreliable for skewed data even with a large sample. A confidence interval for σ² uses both a lower and an upper chi-square critical value.
Goodness-of-fit test
It asks whether observed counts match a claimed distribution (equal likelihood of die faces, a stated percentage breakdown, a known model such as binomial).
- H₀: the data come from the claimed distribution. Hₐ: they do not.
- Expected count for each category: E = n × (claimed probability).
- Statistic: χ² = Σ (O − E)²/E, summed over the k categories; df = k − 1 (minus one more for each parameter estimated from the data).
- Condition: every expected count should be at least 5 (combine small categories if necessary).
- The test is right-tailed. A small p-value means the data do not fit the claimed distribution. Failing to reject only says there is no evidence against the claim.
Test of independence
It asks whether two categorical variables from one sample are related, using a contingency table.
- H₀: the two variables are independent. Hₐ: they are dependent (associated).
- Expected count for a cell = (row total × column total)/grand total. This is what you would see if independence were true.
- Statistic: χ² = Σ (O − E)²/E over all cells, df = (rows − 1)(columns − 1). Right-tailed, expected counts at least 5.
- The conclusion describes association in words (not cause).
Test of homogeneity (related test)
The textbook also treats the test for homogeneity: do two (or more) separate populations have the same distribution of a categorical variable? The mechanics (expected counts, statistic, df) are identical to the test of independence; what differs is the design: samples are drawn separately from each population and the null states that the distributions are the same.
Comparing the tests
Goodness-of-fit: one categorical variable against a stated distribution. Independence: two variables, one sample. Homogeneity: one variable, several populations. Single variance: one numerical variable, variability claim.
Common mistakes
Using percentages instead of counts; forgetting expected counts must be at least 5; getting the wrong df; using the single-variance test for non-normal data; using a two-tailed approach for the goodness-of-fit or independence tests; concluding "proved independent" when failing to reject.
Practice tasks
- How many df for a goodness-of-fit test with 5 categories? For a 3 × 4 contingency table?
- A row total is 40, column total 30, and n = 120. Find the expected count for that cell.
- H₀: σ² = 16 vs Hₐ: σ² > 16, s² = 25, n = 21. Compute χ² and decide at 0.05 (critical value 31.41).
- A die rolled 60 times gives 8, 12, 10, 9, 11, 10 for faces 1–6. Test fairness (critical value for df = 5 is 11.07).
- Table: Group A: Yes 30, No 20; Group B: Yes 20, No 30. Test independence (critical 3.841).
- In task 5, state H₀, Hₐ, and the conclusion in words.
- Why is a goodness-of-fit test not appropriate for comparing two numerical means? Why can't a "fail to reject" in task 4 prove the die is fair?
Original author (OpenStax, Rice University). License / permission: CC BY-NC-SA 4.0. If you noticed a mistake or copyright issues, please contact: lebroskiofficial@proton.me