Chi-Square & ANOVA
Every test you have met so far has compared one mean, or two. Real questions are rarely that tidy. You want to know whether a whole set of categories falls out the way somebody claimed, whether two categorical variables travel together, or whether three, four, or five groups have the same average. This chapter gives you three tools for exactly those jobs — the chi-square goodness-of-fit test, the chi-square test of independence, and one-way analysis of variance — and then it tells you the truth that most courses rush past: what these tests require before you may trust them, and what to do the moment one of them comes back significant. The arithmetic is mostly subtraction, squaring, and division. If you can do that, you can do this.
By the end of this chapter you can
- Compute expected counts and the chi-square statistic, χ2 = Σ(O − E)2/E, by hand.
- Run a goodness-of-fit test to decide whether data match a claimed distribution, using df = k − 1.
- Run a test of independence on a two-way table, using df = (r − 1)(c − 1), and describe the association you find.
- Partition variability into between-group and within-group sums of squares and build a complete ANOVA table.
- Explain why the F statistic is a ratio of two variance estimates, and why many t tests are a bad substitute for one F test.
- State and check the assumptions behind chi-square and ANOVA, and name the right alternative when one fails.
- Carry out and interpret a post-hoc comparison (Tukey's HSD or a Bonferroni correction) after a significant F.
- Interpret p-values, confidence intervals, and effect sizes precisely, without the usual overstatements.
Section 1Chi-square goodness of fit

The question this test answers
You have one categorical variable with k categories, and somebody has made a claim about how the population splits across those categories. A manufacturer says its bags of candy are 30% red, 30% brown, and 40% yellow. A textbook says a fair die lands on each face one-sixth of the time. A subscription service says its customers split 25/40/35 across three tiers. You collect a sample and count. The counts never match the claim exactly — sampling sees to that. The goodness-of-fit test asks a single question: is the mismatch bigger than sampling noise can comfortably explain?
The hypotheses are stated in words as much as symbols:
- H0: the population proportions are exactly as claimed (p1 = 0.25, p2 = 0.40, p3 = 0.35, say).
- Ha: at least one proportion differs from its claimed value.
Notice that the alternative is vague on purpose. It says something is off; it does not say which category or in which direction. That vagueness is the price of testing all the categories at once, and it comes back to bite us in Section 5 in the ANOVA setting.
Observed, expected, and the statistic
The observed counts O are what you actually tallied. The expected counts E are what the null hypothesis predicts on average for a sample of your size: Ei = n × pi. Expected counts are frequently not whole numbers — 200 × 0.35 = 70 is tidy, but 137 × 0.35 = 47.95 is not, and you must not round it. Rounding expected counts is one of the most common ways a chi-square gets quietly wrecked by hand.
The statistic adds up one contribution per category:
χ2 = Σ (O − E)2 / E
Read that formula slowly, because it is the whole chapter in miniature. The numerator, (O − E)2, measures how far a category strayed from prediction, squared so that overshoots and undershoots both count as evidence. Dividing by E puts that miss on a fair scale: being 10 counts off when you expected 20 is a scandal; being 10 counts off when you expected 2,000 is nothing. Because every term is a square divided by a positive number, χ2 is never negative, and a value near zero means the data hug the claim. Big values, and only big values, are evidence against H0 — which is why the chi-square test is always right-tailed.
The degrees of freedom are df = k − 1, one less than the number of categories. The intuition: once you know the total and all but one category count, the last one is forced, so only k − 1 counts are free to vary. (If you had to estimate m parameters from the data to build the expected counts — fitting a Poisson model, for instance — you subtract those too: df = k − 1 − m.)
A worked example, start to finish
A meal-plan service claims its subscribers split across three tiers as Bronze 25%, Silver 40%, Gold 35%. A random sample of n = 200 subscribers gives Bronze 40, Silver 95, Gold 65. Test at α = 0.05.
Step 0 — check the conditions first. The four requirements are laid out in Section 4, and they are met here: the data are raw counts, not percentages; the sample is random; each subscriber is counted once and lands in exactly one tier, so the observations are independent; and every expected count computed in Step 1 is at least 5 (the smallest is 50). Do this before you look at any p-value, not after.
Step 1 — expected counts. EBronze = 200(0.25) = 50; ESilver = 200(0.40) = 80; EGold = 200(0.35) = 70. They sum to 200, which is a useful arithmetic check — expected counts always total n.
| Category | Observed O | Claimed p | Expected E = np | O − E | (O − E)2/E |
|---|---|---|---|---|---|
| Bronze | 40 | 0.25 | 50 | −10 | 100/50 = 2.0000 |
| Silver | 95 | 0.40 | 80 | +15 | 225/80 = 2.8125 |
| Gold | 65 | 0.35 | 70 | −5 | 25/70 = 0.3571 |
| Total | 200 | 1.00 | 200 | 0 | χ2 = 5.170 |
Step 2 — the statistic. 2.0000 + 2.8125 + 0.3571 = χ2 = 5.17.
Step 3 — degrees of freedom and critical value. k = 3 categories, so df = 3 − 1 = 2. From the table below, the critical value at α = 0.05 with df = 2 is 5.991.
| Degrees of freedom | α = 0.10 | α = 0.05 | α = 0.01 |
|---|---|---|---|
| 1 | 2.706 | 3.841 | 6.635 |
| 2 | 4.605 | 5.991 | 9.210 |
| 3 | 6.251 | 7.815 | 11.345 |
| 4 | 7.779 | 9.488 | 13.277 |
| 5 | 9.236 | 11.070 | 15.086 |
| 6 | 10.645 | 12.592 | 16.812 |
Step 4 — decide. 5.17 is less than 5.991, so we fail to reject H0. The p-value is about 0.075, which is larger than 0.05 and confirms the same decision.
Step 5 — say what that means, carefully. "At the 5% level, these data do not provide sufficient evidence that the true tier proportions differ from the claimed 25/40/35 split." That sentence is doing something specific. It does not say the claim is true. We fail to reject H0; we never accept it. Those are different verdicts — "not guilty" is not "innocent" — and a sample of 200 simply may not have had the power to detect a mismatch of the size that is really there. Absence of evidence is not evidence of absence. And the p-value of 0.075 is not a 7.5% chance that the provider is right. It is this: if the claimed split were exactly correct, samples of 200 would produce a mismatch this extreme or worse about 7.5% of the time. The probability lives in the data-generating process, not in the hypothesis.
- Goodness of fit compares one categorical variable's observed counts against a claimed distribution.
- E = n × p; never round expected counts, and check that they sum to n.
- χ2 = Σ(O − E)2/E is never negative, and the test is always right-tailed; df = k − 1.
- A p-value is the probability of data this extreme given H0 — not the probability that H0 is true.
- Check the four conditions before the p-value, and remember that fail to reject never means accept.
Section 2Chi-square test of independence

Two variables, one table
Now you have two categorical variables measured on the same people, and you cross them into a contingency table (also called a two-way table or crosstab) with r rows and c columns. Does exercise habit go with sleep quality? Does region go with brand preference? Does treatment group go with outcome category? The test of independence asks whether knowing a person's row tells you anything about their column.
- H0: the two variables are independent in the population — there is no association.
- Ha: the two variables are associated — they are not independent.
The statistic is the same formula as Section 1, cell by cell, and the test is still right-tailed. Only two things change: how you get the expected counts, and how you count degrees of freedom.
Expected counts from the margins
Under independence, the probability of landing in a particular row and a particular column is the product of the two separate probabilities. Translate that into counts and you get the working formula every cell obeys:
E = (row total × column total) / grand total
Why it works: the row total divided by n estimates the probability of that row; multiply by the column total and you get how many of that column's members should fall in that row if the row split were the same everywhere. That last phrase is the practical meaning of independence — every row has the same column profile.
Degrees of freedom are df = (r − 1)(c − 1). Same logic as before: with the margins fixed, once you fill in an (r − 1) by (c − 1) block of the table, subtraction forces every remaining cell.
A worked example, start to finish
A researcher surveys n = 300 adults, recording whether they exercise regularly and how they rate their sleep. Test for association at α = 0.05.
| Observed counts | Good sleep | Fair sleep | Poor sleep | Row total |
|---|---|---|---|---|
| Exercises regularly | 75 | 50 | 25 | 150 |
| Does not exercise | 45 | 55 | 50 | 150 |
| Column total | 120 | 105 | 75 | 300 |
Step 1 — expected counts. Top-left: (150 × 120)/300 = 60.0. Top-middle: (150 × 105)/300 = 52.5. Top-right: (150 × 75)/300 = 37.5. Because the two row totals happen to be equal here, the bottom row repeats those values. Every expected count is at least 5, so the test is safe to run.
| Cell | Observed O | Expected E | O − E | (O − E)2/E |
|---|---|---|---|---|
| Exercise & Good | 75 | 60.0 | +15.0 | 225/60 = 3.7500 |
| Exercise & Fair | 50 | 52.5 | −2.5 | 6.25/52.5 = 0.1190 |
| Exercise & Poor | 25 | 37.5 | −12.5 | 156.25/37.5 = 4.1667 |
| No exercise & Good | 45 | 60.0 | −15.0 | 225/60 = 3.7500 |
| No exercise & Fair | 55 | 52.5 | +2.5 | 6.25/52.5 = 0.1190 |
| No exercise & Poor | 50 | 37.5 | +12.5 | 156.25/37.5 = 4.1667 |
| Total | 300 | 300.0 | 0 | χ2 = 16.071 |
Step 2 — the statistic. Adding the last column: χ2 = 16.07.
Step 3 — degrees of freedom. r = 2 rows, c = 3 columns, so df = (2 − 1)(3 − 1) = 2. Critical value at α = 0.05 is again 5.991.
Step 4 — decide and interpret. 16.07 far exceeds 5.991, and the p-value is roughly 0.0003. We reject H0: there is strong evidence of an association between regular exercise and self-rated sleep quality in this population.
Step 5 — describe the association. The test says "associated" and stops there, so you have to look at the cells yourself. The two largest contributions are the two "Poor" cells at 4.1667 each — Exercise-and-Poor (observed 25, expected 37.5) and No-exercise-and-Poor (observed 50, expected 37.5) — followed by the two "Good" cells at 3.7500 each. Because the row totals happen to be equal here, the contributions come in mirrored pairs, so it is the Good and Poor columns together that drive the result: exercisers landed in "Good" more often and "Poor" less often than independence predicts, and non-exercisers did the reverse. A tidier way to say the same thing is the standardized residual, (O − E)/√E; for Exercise-and-Good that is 15/√60 = +1.94, and for Exercise-and-Poor it is −12.5/√37.5 = −2.04, with the no-exercise row reversing both signs. Residuals beyond roughly ±2 mark the cells that drove the result — here only the two Poor cells clear that bar, with the two Good cells just short of it.
Step 6 — measure how big it is. With 300 people, even a modest association gets a tiny p-value, so report an effect size. Cramér's V = √[χ2 / (n × min(r−1, c−1))] = √[16.071 / (300 × 1)] = √0.05357 = 0.23. On a 0-to-1 scale, that is a real but moderate association — statistically unmistakable, practically modest.
- The test of independence crosses two categorical variables in an r × c table.
- E = (row total × column total)/grand total; df = (r − 1)(c − 1).
- Rejecting H0 means "associated," not "which way" — read the cells and standardized residuals to describe the pattern.
- Report an effect size such as Cramér's V; with large n, significance alone says very little about importance.
Section 3One-way ANOVA

Why not just run a lot of t tests?
Suppose you have three training methods and you want to know whether their mean test scores differ. The obvious move is three t tests: A vs B, A vs C, B vs C. The obvious move is wrong, and it is worth seeing exactly why.
Each test at α = 0.05 has a 5% chance of a false alarm. If the three tests were independent, the chance that at least one raises a false alarm would be 1 − (0.95)3 = 1 − 0.857 = 0.143. With five groups there are ten pairwise tests, and the figure climbs to 1 − (0.95)10 = 0.401. Be honest about that calculation: pairwise tests on the same groups are not independent, because every pair reuses a sample the other pairs also used. So treat 14% and 40% as illustrations of the size of the problem rather than exact rates. The direction is what matters, and it is not in doubt — you set out to run a 5% risk and quietly took on a far larger one. This inflated risk is the family-wise error rate, and it is the reason ANOVA exists: one test, one α, one answer.
- H0: μ1 = μ2 = μ3 = … = μk (all population means are equal).
- Ha: at least one mean differs from at least one other. (Not "all means differ" — a very common misstatement.)
The idea: two ways to measure spread
The name is honest — you analyze variance in order to learn about means. Here is the trick. If all the group means were truly equal, then two completely different calculations would both estimate the same population variance σ2:
- Within-group variability (MSW): pool the scatter inside each group. Nothing about group differences touches this number — it is pure background noise, and it estimates σ2 whether H0 is true or not.
- Between-group variability (MSB): measure how far the group means sit from the grand mean. If H0 is true, the means differ only by sampling noise and this also estimates σ2. If H0 is false, real mean differences inflate it.
So the ratio
F = MSB / MSW = (signal + noise) / noise
should sit near 1 when the means are equal and grow large when they are not. That is why ANOVA, like chi-square, is a right-tailed test — only big F values are evidence against H0. And because both mean squares are sums of squares divided by positive degrees of freedom, neither can be negative, so F is never negative either.
The building blocks, with N = total observations, k = number of groups, nj and x̄j the size and mean of group j, and x̄ the grand mean:
- SSbetween = Σ nj(x̄j − x̄)2, with df = k − 1
- SSwithin = ΣΣ(x − x̄j)2, with df = N − k
- SStotal = SSbetween + SSwithin, with df = N − 1
- MS = SS / df in each row, and F = MSB/MSW with (k − 1, N − k) degrees of freedom
A worked example, start to finish
Three training methods, five participants each (N = 15, k = 3), test scores. Conditions first, as always: the groups are independent, each is roughly symmetric with no outliers, the response is quantitative, and the equal-variance condition is checked explicitly with these very numbers in Section 4. ANOVA is the right tool here.
| Group | Scores | Sum | nj | Mean x̄j | Σ(x − x̄j)2 |
|---|---|---|---|---|---|
| A | 68, 71, 72, 73, 76 | 360 | 5 | 72 | 16+1+0+1+16 = 34 |
| B | 72, 75, 77, 79, 82 | 385 | 5 | 77 | 25+4+0+4+25 = 58 |
| C | 78, 80, 82, 83, 87 | 410 | 5 | 82 | 16+4+0+1+25 = 46 |
| Overall | — | 1155 | 15 | x̄ = 77 | SSwithin = 138 |
Step 1 — grand mean. (360 + 385 + 410)/15 = 1155/15 = 77.
Step 2 — between-group sum of squares. SSbetween = 5(72 − 77)2 + 5(77 − 77)2 + 5(82 − 77)2 = 5(25) + 5(0) + 5(25) = 125 + 0 + 125 = 250.
Step 3 — within-group sum of squares. Add the last column of the table: 34 + 58 + 46 = 138.
Step 4 — check the partition. SStotal should equal 250 + 138 = 388. Computing it directly from all fifteen deviations about 77 gives 159 + 58 + 171 = 388. The identity holds, which is a strong sign the arithmetic is right.
Step 5 — mean squares and F. MSB = 250/2 = 125.00. MSW = 138/12 = 11.50. F = 125.00/11.50 = 10.87.
| Source | SS | df | MS = SS/df | F | p-value |
|---|---|---|---|---|---|
| Between groups | 250 | k − 1 = 2 | 125.00 | 10.87 | ≈ 0.0020 |
| Within groups (error) | 138 | N − k = 12 | 11.50 | — | — |
| Total | 388 | N − 1 = 14 | — | — | — |
Step 6 — decide. The critical value for F(2, 12) at α = 0.05 is 3.89. Our 10.87 sails past it, p ≈ 0.0020, so we reject H0.
| Numerator df (k − 1) | Denominator df (N − k) | Critical F, α = 0.05 |
|---|---|---|
| 2 | 12 | 3.89 |
| 2 | 20 | 3.49 |
| 3 | 20 | 3.10 |
| 3 | 30 | 2.92 |
| 4 | 30 | 2.69 |
Step 7 — interpret precisely. "There is strong evidence that at least one of the three method means differs from the others." That is all the F test earns you. It does not say A differs from B, and it does not say every pair differs. Section 5 is where you find out which pairs are really separated — and the answer will surprise you.
Step 8 — report an effect size. Eta squared, η2 = SSbetween/SStotal = 250/388 = 0.64. About 64% of the variation in test scores is explained by which method a participant received — a large effect, and a far more useful number to a decision-maker than "p < 0.05."
- Running many pairwise t tests inflates the family-wise error rate — 14% with three groups, 40% with five.
- ANOVA compares MSB (between-group variability) to MSW (within-group noise): F = MSB/MSW.
- SStotal = SSbetween + SSwithin; df are k − 1, N − k, and N − 1.
- A significant F means at least one mean differs — never "all means differ." Report η2 alongside it.
Section 4Assumptions

What chi-square requires
A p-value is a promise, and the promise is conditional. Every chi-square p-value assumes four things, and software will happily print a number even when all four are violated.
1. The data are counts. Chi-square consumes raw frequencies — how many people, how many items. Feeding it percentages, proportions, or group means is the single most frequent misuse. If your table holds "42%" rather than "42 people," convert back to counts first, and if you cannot, you do not have the data you need.
2. Observations are independent, and each falls in exactly one cell. One row of data per person or item. If the same person is counted twice — before and after an intervention, say — the observations are paired and chi-square is the wrong test; use McNemar's test for a paired 2 × 2 table.
3. Expected counts are large enough. The chi-square curve is a continuous approximation to a discrete count problem, and the approximation frays when expected counts are tiny. The common working rule: all expected counts ≥ 5. Cochran's slightly more forgiving version allows up to 20% of cells to have E between 1 and 5, provided none falls below 1. Note that this is a condition on expected, not observed, counts — an observed zero is perfectly legal.
4. The sample is random. Every inferential claim depends on the sample representing the population. No formula repairs a convenience sample.
When rule 3 fails, you have real options: collapse sparse categories into a sensible larger one (two adjacent, rarely used response levels become a single "other" category), collect more data, or switch to Fisher's exact test, which computes the probability directly and needs no large-sample approximation at all.
What ANOVA requires
1. Independence, both within and between groups. This is the assumption ANOVA is least willing to forgive, and no amount of data fixes a violation. If the same subjects appear in every group, you need repeated-measures ANOVA instead.
2. Approximate normality of the response within each group (equivalently, of the residuals). ANOVA is genuinely robust here: with roughly equal group sizes and a sample of decent size, moderate skew barely dents the F test, and the Central Limit Theorem is on your side. The condition matters most when groups are small (under about 15) or the data are strongly skewed or heavily outlier-ridden. Check it with a histogram or normal quantile plot per group, not with a formal normality test on tiny samples.
3. Homogeneity of variance — the population spreads are equal across groups. MSW pools all the groups' scatter into one number, and that pooling only makes sense if there is one common σ2 to pool. Two quick checks: the largest sample standard deviation should be less than about twice the smallest, or equivalently the largest variance less than about four times the smallest. Levene's test is the formal version.
4. The response is quantitative and measured on an interval or ratio scale. You cannot average a category.
Let us actually run check 3 on the Section 3 data. The within-group sums of squares were 34, 58, and 46, each with df = 4:
| Group | SS | s2 = SS/(n−1) | s |
|---|---|---|---|
| A | 34 | 34/4 = 8.50 | 2.92 |
| B | 58 | 58/4 = 14.50 | 3.81 |
| C | 46 | 46/4 = 11.50 | 3.39 |
Largest s divided by smallest s = 3.81/2.92 = 1.31, comfortably under 2. Largest variance over smallest = 14.50/8.50 = 1.71, comfortably under 4. The equal-variance condition is satisfied, so the pooled MSW of 11.50 was a legitimate thing to compute.
When a condition fails
A failed assumption is not the end of the analysis. It is a signpost to a different test.
| Condition that failed | Symptom | What to do instead |
|---|---|---|
| Expected counts too small | Any E < 5, sparse table | Combine categories; or use Fisher's exact test |
| Paired categorical data | Same subjects measured twice | McNemar's test |
| Unequal ANOVA variances | smax/smin > 2, especially with unequal n | Welch's ANOVA (does not pool variances) |
| Strong non-normality, small groups | Heavy skew or clear outliers | Kruskal–Wallis test (rank-based) |
| Same subjects in every group | Repeated measurements | Repeated-measures ANOVA |
| Non-random sample | Convenience or self-selected data | Describe only; no valid inference to a population |
- Chi-square needs counts, independent observations, expected counts ≥ 5, and a random sample.
- ANOVA needs independence, approximate normality within groups, equal variances, and a quantitative response.
- Rules of thumb: all E ≥ 5; smax/smin < 2 (or variance ratio < 4).
- Failed conditions point to a specific replacement test — Fisher's exact, McNemar, Welch, or Kruskal–Wallis.
Section 5After a significant ANOVA

The F test leaves you with a question
We rejected H0 in Section 3 with F = 10.87. What we know is that the three method means are not all equal. What we do not know is which ones differ. That gap is exactly what post-hoc ("after this") comparisons fill: they go back through the pairs, one at a time, while keeping the total false-alarm risk across the whole family of comparisons at α.
And this is where you cannot simply run ordinary t tests, for the very reason ANOVA existed in the first place. Three unadjusted pairwise tests carry a family-wise error rate in the neighborhood of 14%. Post-hoc procedures are pairwise tests with the inflation engineered out.
Two workhorses: Bonferroni and Tukey
The Bonferroni correction is the simplest honest fix in all of statistics: if you plan m comparisons, test each one at α/m. With three groups, m = 3 and each comparison is judged at 0.05/3 = 0.0167. Equivalently, multiply each raw p-value by 3 and compare to 0.05. It works for any set of comparisons, it takes ten seconds to explain, and it is somewhat conservative — it protects against false alarms so firmly that it can miss real differences, especially when m is large.
Tukey's HSD (Honestly Significant Difference) is purpose-built for the specific job of comparing all pairs after an ANOVA, and for that job it is more powerful than Bonferroni. Instead of a t distribution it uses the studentized range distribution q, which already accounts for the fact that you are looking at the largest gaps among k means. For equal group sizes the rule is beautifully simple: any two means further apart than the HSD value are significantly different.
HSD = qα, k, N−k × √(MSW / n)
Working it out on our data
From the ANOVA table: MSW = 11.50, N − k = 12, k = 3, n = 5 per group. The studentized range value q for α = 0.05, k = 3, df = 12 is 3.77.
Step 1 — the standard error piece. √(MSW/n) = √(11.50/5) = √2.30 = 1.517.
Step 2 — the HSD threshold. HSD = 3.77 × 1.517 = 5.72. Any two sample means more than 5.72 points apart are significantly different; any pair closer than that is not.
Step 3 — compare every pair. The means were A = 72, B = 77, C = 82.
| Comparison | Difference in means | |Difference| | vs. HSD = 5.72 | Conclusion |
|---|---|---|---|---|
| A vs B | 72 − 77 = −5 | 5.00 | 5.00 < 5.72 | Not significant |
| A vs C | 72 − 82 = −10 | 10.00 | 10.00 > 5.72 | Significant |
| B vs C | 77 − 82 = −5 | 5.00 | 5.00 < 5.72 | Not significant |
Read that result carefully, because it is the whole point of the section. The overall F was highly significant, yet only one of the three pairs separates. Method C beats method A; neither can be distinguished from the middle method B. An analyst who reported "the ANOVA was significant, so all three methods differ" would have gotten the science wrong while getting the arithmetic right.
Step 4 — give intervals, not just verdicts. Tukey also produces confidence intervals: difference ± HSD. For A vs C that is −10 ± 5.72, or (−15.72, −4.28). Because the interval excludes zero, the difference is significant — and the interval says far more than the p-value does, namely that the plausible advantage of C over A runs from about 4 to about 16 points. Say what such an interval means with care: the procedure that produced it captures the true mean difference in 95% of all possible samples. It is not a 95% chance that this particular interval, already computed and sitting on the page, contains the parameter. The parameter is fixed; the interval is what varies from sample to sample.
Step 5 — cross-check with Bonferroni. The standard error of a difference is √[MSW(1/n + 1/n)] = √[11.50(0.4)] = √4.60 = 2.145. For A vs C, t = 10/2.145 = 4.66; for A vs B, t = 5/2.145 = 2.33. The Bonferroni critical value is the t for α = 0.0167 two-tailed with df = 12, about 2.78. So A vs C (4.66) clears it and A vs B (2.33) does not — the same conclusion Tukey reached, which is reassuring.
Choosing a method, and when not to bother
| Method | Best used for | Character |
|---|---|---|
| Tukey's HSD | All pairwise comparisons after ANOVA | The default choice; most powerful for this exact job |
| Bonferroni | A small, pre-specified set of comparisons | Simple, universally valid, conservative |
| Dunnett's test | Every group vs. a single control group | More powerful than Tukey when only control contrasts matter |
| Scheffé's method | Any contrast, including ones you thought of afterward | Most flexible, most conservative |
| Games–Howell | Pairwise comparisons with unequal variances | The post-hoc partner to Welch's ANOVA |
Two habits keep this honest. First, if the overall F is not significant, do not go fishing through the pairs hoping one turns up — that is precisely the error-inflation the F test protected you from. (Planned contrasts specified before seeing the data are the legitimate exception.) Second, always show the picture. Side-by-side boxplots of the three groups convey the overlap between A and B, and the clean separation between A and C, more immediately than any table of p-values.
- A significant F says "at least one mean differs"; post-hoc tests identify which pairs.
- Tukey's HSD = q × √(MSW/n) is the standard for all pairwise comparisons; Bonferroni (α/m) is the simple general-purpose fix.
- Significant overall does not mean every pair differs — here only A vs C separated.
- A 95% interval is a statement about the long-run procedure, not a 95% chance for the interval in front of you.
The chapter in one breath
- Every chi-square test uses χ2 = Σ(O − E)2/E, is never negative, and is always right-tailed.
- Goodness of fit tests one categorical variable against a claimed distribution: E = np, df = k − 1.
- Test of independence tests two categorical variables for association: E = (row × column)/total, df = (r − 1)(c − 1) — and association is not causation.
- One-way ANOVA compares three or more means with F = MSB/MSW, avoiding the family-wise error that many t tests would create.
- The partition SStotal = SSbetween + SSwithin is both the engine of ANOVA and a built-in arithmetic check.
- Chi-square needs counts, independence, and expected counts ≥ 5; ANOVA needs independence, rough normality, and equal variances — each failure has a named alternative.
- A significant F means at least one mean differs; Tukey's HSD or a Bonferroni correction tells you which pairs, without inflating α.
- Always pair a p-value with an effect size (Cramér's V, η2) and an interval, and state both with the precision they demand.
ReferenceWords worth knowing
A quick reference for the terms in this chapter — skim it now, or circle back whenever a word trips you up.
- Alpha (α)
- The significance level: the risk of a false alarm you agree to accept before collecting data, most often 0.05.
- Analysis of variance (ANOVA)
- A procedure that compares three or more population means by comparing two estimates of variance, between-group and within-group.
- Bonferroni correction
- Testing each of m planned comparisons at α/m so the family-wise error rate stays at α. Simple and conservative.
- Chi-square statistic (χ2)
- Σ(O − E)2/E, a non-negative measure of total mismatch between observed and expected counts.
- Contingency table
- A two-way table of counts crossing two categorical variables, with row, column, and grand totals in the margins.
- Cramér's V
- An effect size for a contingency table, √[χ2/(n × min(r−1, c−1))], running from 0 (no association) to 1.
- Degrees of freedom
- The number of values free to vary once the constraints are imposed; k − 1 for goodness of fit, (r−1)(c−1) for independence, and (k−1, N−k) for ANOVA.
- Eta squared (η2)
- SSbetween/SStotal: the proportion of variation in the response explained by group membership.
- Expected count (E)
- The count a cell would show on average if the null hypothesis were true. Never round it.
- F statistic
- The ratio MSB/MSW. Near 1 when group means are equal, large when they are not; never negative, and always tested in the upper tail.
- Family-wise error rate
- The probability of at least one false alarm across a whole family of tests. It inflates rapidly as the number of comparisons grows.
- Goodness-of-fit test
- A chi-square test of whether one categorical variable's observed counts match a claimed distribution.
- Homogeneity of variance
- The ANOVA condition that all groups share the same population variance; checked with smax/smin < 2 or Levene's test.
- Kruskal–Wallis test
- A rank-based alternative to one-way ANOVA used when the normality condition fails badly.
- Mean square (MS)
- A sum of squares divided by its degrees of freedom — that is, a variance estimate. MSB and MSW are the two that build F.
- Observed count (O)
- The actual tally in a category or cell of your sample.
- p-value
- The probability of getting data at least as extreme as yours if the null hypothesis were true. It is not the probability that the null hypothesis is true.
- Post-hoc test
- A follow-up comparison run after a significant ANOVA to identify which specific groups differ, with the family-wise error rate controlled.
- Standardized residual
- (O − E)/√E for one cell; values beyond roughly ±2 flag the cells driving a significant chi-square.
- Sum of squares (SS)
- A total of squared deviations. In ANOVA, SStotal splits exactly into SSbetween + SSwithin.
- Test of independence
- A chi-square test of whether two categorical variables measured on the same subjects are associated.
- Tukey's HSD
- Honestly Significant Difference: q × √(MSW/n), the standard post-hoc method for comparing all pairs of means after ANOVA.