What to carry out of this section
E = row total × column total ÷ n, and the formula is not a rule to memorise — it is a sentence. Independence means the joint chance factors: P(row and column) = P(row) × P(column). Estimate each piece from the margins, Ri / n and Cj / n, multiply them for the joint proportion, then multiply by n to convert a proportion into a headcount. The n's cancel down to RiCj / n. If you can say that sentence you never need to look the formula up, and you will also see instantly why the expected table has exactly the same margins as the observed one.
Expected counts are almost never whole numbers, and that is fine. E = 47×62÷300 = 9.71 does not mean 9.71 people. It is the long‑run average number of people who would land in that cell across many surveys of this size if the two variables were unrelated. Rounding it before computing the statistic is a small, needless error. Only the observed counts are forced to be integers — they are people.
df = (r − 1)(c − 1), and the bookkeeping is exact. There are rc cells. Subtract 1 because the counts must total n. Subtract another (r − 1) for the row proportions you estimated from the data, and (c − 1) for the column proportions. That leaves rc − 1 − (r−1) − (c−1) = rc − r − c + 1 = (r − 1)(c − 1). Compare with goodness of fit, where the claimed proportions arrived from outside the data and cost you nothing, so df was simply k − 1. Estimating things from your own data is not free. Drag r and c and watch the curve reshape underneath a table whose story has not changed.
Independence has a picture, and it is the first panel. “The two variables are independent” is the same statement as “the conditional distribution of ratings is identical for every commute mode” — every bar striped the same way. That equivalence is worth more than the formula, because it tells you what to look at before you compute anything, and it tells you what a significant result actually claims: somewhere, some row's profile differs from the others.
Association is not causation, and this design cannot rescue you. Suppose the test comes back overwhelming and the people on foot rate their commutes far more pleasantly. Three explanations remain wide open. Walking may genuinely make the trip nicer. Or people who already live somewhere pleasant to walk chose to walk — the exposure is self‑selected, and the causal arrow runs backwards. Or something behind both, like living downtown, drives the mode and the mood independently — a confounder. The χ² test cannot distinguish these, because it only ever saw a table of counts. It certifies that the pattern is more than noise. It says nothing whatsoever about where the pattern came from.
Significant and strong are different words. Load the Faint, huge survey preset. The p‑value is minuscule and Cramér's V is close to zero, and both are correct: the association is real and it is negligible. Because χ² grows roughly in proportion to n, any association that is not exactly zero becomes significant eventually, and with enough people you will reject independence over a difference nobody could act on. Always report an effect size next to the p‑value. A p‑value answers “could this be nothing?” It never answers “how big is it?”
The p‑value is not the probability that the variables are independent. It is computed by assuming independence and asking how often a table this discrepant, or worse, would arise from pure sampling noise. It is P(data this extreme | independence), not P(independence | data). Those two are not interchangeable, and swapping them is the single most common misstatement in applied statistics. It also explains why we never “accept” the null: a large p‑value means your data were compatible with independence, and small data are compatible with almost everything.
A significant χ² does not name the guilty cell. This is an omnibus test — one number for the entire table. The natural follow‑up is the adjusted residuals in the third panel: values beyond roughly ±2 mark cells pulling hardest, and their signs show the direction. But scanning rc cells after a significant result and reporting whichever ones look big is a fishing expedition, and any cell picked that way deserves confirmation in fresh data rather than a p‑value inherited from the omnibus test.
When the expected counts are too thin, stop — do not round up and continue. Load the Strong, tiny survey preset and look at the smallest expected count. With E's below 5, the χ² curve is a poor stand‑in for the discrete truth and the p‑value cannot be trusted in either direction. The real fixes are to collapse categories that genuinely belong together, gather more people, or use Fisher's exact test, which computes the answer from the exact distribution of tables with those margins instead of leaning on a curve.
Two different studies, one identical calculation. If you sample n people at random and record both answers, you are testing independence. If instead you deliberately recruit 150 drivers, 150 cyclists, and 150 walkers and ask each group one question, the row totals were fixed by you, not by chance, and you are testing homogeneity — whether several populations share one distribution. The expected counts, the statistic, the degrees of freedom and the table you read are all the same. What differs is the sentence you are entitled to write at the end, and which margins were yours to choose.
One last thing worth doing. Set the association to zero, so the two questions are genuinely unrelated, and run five thousand surveys. The mean χ² settles on (r − 1)(c − 1) — not approximately, and not by luck — and about one survey in twenty crosses the rejection line anyway. Those tables contain no association at all. They are ordinary surveys of an ordinary city, and they are the advertised, agreed‑upon price of drawing the line at 5%.