HookWomen and children first — did the Titanic actually follow the rule?
Of the 2,201 people aboard the Titanic, 711 survived — an overall rate of 32.3%. If survival had had nothing to do with who you were, that 32.3% would have fallen roughly evenly across the ship. It did not. Of 325 first-class passengers, 203 survived (62.5%); of 285 in second class, 118 (41.4%); of 706 in third class, 178 (25.2%); of 885 crew, 212 (24.0%). Under pure chance you would expect about 105 first-class survivors; there were 203. The question a statistician asks is not whether the numbers differ — they always differ — but whether they differ by more than sampling variation could plausibly produce. For this table the answer is emphatic: the test you will learn in this section returns a statistic of roughly 190 against a 5% benchmark of 7.815. Class and survival were associated beyond any reasonable doubt, and the pattern of the discrepancies — first class far above expectation, steerage and crew below — tells you exactly where the association lived.
That is the entire architecture of the chi-squared test for association. Cross-classify individuals in a contingency table; compute the frequencies you would expect if the two classifications were independent; measure the mismatch with \(\sum\frac{(O_i-E_i)^2}{E_i}\); compare against the \(\chi^2\) distribution with the right degrees of freedom. Around the core sit the working conventions — every expected frequency above 5, Yates' correction for \(2\times 2\) tables — and, at the end, the skill examiners prize most: reading the individual contributions to say, in context, where the association comes from.
ModelContingency tables and the meaning of 'expected'
A contingency table cross-classifies each member of a sample by two categorical variables at once — class by survival, age group by voting intention, treatment by outcome — giving an \(n\times m\) grid of observed counts \(O_i\), with row totals, column totals and a grand total \(N\). The null hypothesis is always the same: \(H_0\colon\) the two classifications are independent (no association); \(H_1\colon\) they are associated. Note the language — the test never claims one variable causes the other, only that the pattern of counts is or is not compatible with independence.
The expected frequencies are what independence would predict. If a fraction \(\frac{\text{row total}}{N}\) of everyone sits in a given row, and independence holds, then that same fraction of each column should sit in that row, giving the workhorse formula
\[E=\frac{\text{row total}\times\text{column total}}{N}\]
for every cell. Two bookkeeping facts follow and serve as instant checks: the expected frequencies reproduce the observed row and column totals exactly, and \(\sum O_i=\sum E_i=N\). Expected frequencies are almost never whole numbers — 104.98 first-class survivors is a perfectly good expectation, because it is a long-run average, not a prediction of an actual count. Keep them to at least two decimal places; rounding them to integers is a genuine accuracy leak in the statistic that follows.
From the Titanic totals: the expected number of surviving first-class passengers under independence is \(E=\frac{325\times 711}{2201}=104.98\), against an observed 203. For the crew, \(E=\frac{885\times 711}{2201}=285.88\) expected survivors against 212 observed. Every one of the eight cells of the \(4\times 2\) table gets the same treatment, and the eight expected values sum — like the observed ones — to 2,201.
ModelThe statistic, its degrees of freedom, and a full test from scratch
The mismatch between observation and independence is measured by
\[X^2=\sum\frac{(O_i-E_i)^2}{E_i},\]
summed over all \(nm\) cells. Each term asks: how far is this cell from expectation, relative to the size of the expectation? Squaring makes surpluses and deficits count alike; dividing by \(E_i\) stops big cells drowning out small ones. Under \(H_0\), this statistic follows the \(\chi^2\) distribution approximately — it is a continuous approximation to a discrete quantity, a fact that funds two later blocks — with
\[\nu=(n-1)(m-1)\]
degrees of freedom for an \(n\times m\) table. The subtraction of one per dimension is not ritual: with the margins fixed, once \(n-1\) rows and \(m-1\) columns of a table are filled in, the final row and column are forced — only \((n-1)(m-1)\) cells are free to vary, and the distribution knows it. The test is always one-tailed upper: only large values of \(X^2\) indicate association (small values mean suspiciously good agreement with independence). Reject \(H_0\) if \(X^2\) exceeds the critical value of \(\chi^2_\nu\) at the chosen level.
A sixth form tracks 200 students by main revision method and GCSE maths outcome. Observed: flashcards 40 at grade 7+, 40 below (total 80); past papers 45 and 25 (70); rereading 15 and 35 (50). Column totals: 100 and 100. Step 1 — expected frequencies: \(E=\frac{80\times 100}{200}=40\) and 40 for flashcards, 35 and 35 for past papers, 25 and 25 for rereading; all exceed 5, so no pooling is needed. Step 2 — contributions: flashcards \(\frac{(40-40)^2}{40}=0\) twice; past papers \(\frac{(45-35)^2}{35}=2.857\) twice; rereading \(\frac{(15-25)^2}{25}=4.000\) twice. Step 3 — statistic: \(X^2=0+0+2.857+2.857+4.000+4.000=13.71\). Step 4 — degrees of freedom: \(\nu=(3-1)(2-1)=2\), critical value 5.991 at the 5% level (9.210 at 1%). Step 5 — conclusion in context: \(13.71>9.210\), so reject \(H_0\) even at the 1% level — there is very strong evidence of an association between revision method and outcome. Step 6 — source: the largest contributions (4.000 each) come from the rereading cells, with 10 fewer high grades than independence predicts; past-paper users sit 10 above expectation. The flashcard rows contribute nothing at all — the association is a past-papers-versus-rereading story.
MechanismThe small-cell rule — why every expected frequency should exceed 5
The \(\chi^2\) distribution is only an approximation to how \(X^2\) behaves, and the approximation is bankrolled by cell sizes. Each cell's contribution divides by \(E_i\); when an expected frequency is small, a chance fluctuation of one or two individuals produces an enormous \(\frac{(O-E)^2}{E}\), the statistic becomes jumpy, and the smooth \(\chi^2\) curve no longer describes it — tail probabilities read from tables become fiction. The working convention on this specification: every expected frequency should exceed 5. (It is the expected values that matter — observed zeros are fine if their expectations are healthy.)
When a table breaks the rule, the remedy is to pool: merge the offending row or column with an adjacent, contextually sensible one — combine 'strongly agree' with 'agree', merge the two oldest age bands — then recompute the expected frequencies and the degrees of freedom, which shrink because the table has shrunk. Pooling costs information: a merged category can no longer show where within it any association sits, which is the price paid for a trustworthy approximation. Choose merges that make real-world sense; folding 'under 18' into '65 and over' rescues the arithmetic and ruins the meaning.
MechanismYates' correction — the 2×2 special case
The \(2\times 2\) table has exactly one degree of freedom, and there the continuous-approximating-discrete problem bites hardest: with a single free cell, \(X^2\) can only take a sparse set of values, and the smooth \(\chi^2_1\) curve systematically overstates the evidence — the uncorrected test rejects \(H_0\) too readily. Yates' continuity correction compensates by shaving half a unit off each discrepancy before squaring:
\[X^2=\sum\frac{\big(|O_i-E_i|-0.5\big)^2}{E_i}.\]
Apply it when — and only when — the table is \(2\times 2\); with more cells the discreteness is milder and the correction would over-punish. A useful structural fact makes the arithmetic quick: in a \(2\times 2\) table with fixed margins, \(|O-E|\) is the same number in all four cells — call it \(d\) — so the corrected statistic is just \((d-0.5)^2\sum\frac{1}{E_i}\). The correction always lowers the statistic, so it can only ever pull a result back from significance, never push it over the line — a deliberate act of caution against an approximation known to flatter the evidence.
Fifty seedlings get a new fertiliser and fifty the standard one. Thriving after a month: 29 of the treated, 19 of the controls. The table: 29/21 and 19/31, margins 50, 50, 48, 52, \(N=100\). Step 1 — expected frequencies: \(\frac{50\times 48}{100}=24\), \(\frac{50\times 52}{100}=26\), and the same pair again — all exceed 5. Step 2 — the common discrepancy: \(|O-E|=5\) in every cell. Step 3 — uncorrected statistic: \(X^2=5^2\left(\frac{1}{24}+\frac{1}{26}+\frac{1}{24}+\frac{1}{26}\right)=25\times 0.16026=4.01\), which beats the \(\chi^2_1\) critical value of 3.841 — significant at 5%. Step 4 — with Yates: \(X^2=(5-0.5)^2\times 0.16026=20.25\times 0.16026=3.25<3.841\) — not significant. Step 5 — conclusion: with the correction properly applied there is insufficient evidence at the 5% level of an association between fertiliser and thriving. The two calculations disagree, and the corrected one is the answer this specification expects for a \(2\times 2\) table — a borderline result exposed as an artefact of the approximation.
CaseReading the wreckage — sources of association, and what the test cannot say
Rejecting \(H_0\) is the start of the answer, not the end. The statistic is a sum, and its terms are a diagnostic readout: the cells with the largest \(\frac{(O-E)^2}{E}\) are where the association lives, and the sign of \(O-E\) says which way. Return to the Titanic table. The two first-class cells contribute roughly 91.5 and 43.7 of the total statistic of about 190 — first-class passengers survived at nearly double the independence prediction (203 observed against 105 expected). The crew cells add about 19.1 and 9.1, with 74 fewer surviving crew than expectation; third class sits 50 below its expected 228. A full-credit interpretation names cells, compares \(O\) with \(E\), and states the direction: 'first-class passengers were substantially over-represented among survivors, third-class passengers and crew under-represented'.
What the test does not license is a causal verdict. Association is symmetric and mechanism-blind: the table cannot distinguish 'class caused survival' from confounding routes — cabin location relative to the boat deck, time of warning, language of the stewards' instructions — and a chi-squared test on observational data can never rule such routes out. The disciplined phrasing is 'significant evidence of association between class and survival', followed, if asked, by plausible contextual explanations clearly labelled as speculation. That final sentence — statistically watertight, causally modest, anchored in the biggest contributions — is what the last mark of every chi-squared question is for.
VocabularyKey terms the mark scheme pays for
TrapsMisconceptions that cost marks
ExamWhat examiners want
A chi-squared question is a fixed march, and examiners award it step by step: hypotheses in context ('\(H_0\): revision method and outcome are independent / not associated'); a full table of expected frequencies from \(\frac{\text{row}\times\text{column}}{N}\), quoted to at least two decimal places; an explicit check that every \(E\) exceeds 5, with pooling if not; the contributions cell by cell (tabulating them next to \(O\) and \(E\) is the layout that survives marking); the statistic; \(\nu=(n-1)(m-1)\) stated, not implied; comparison with the critical value; and a conclusion that names both variables and the context. The degrees-of-freedom line and the in-context conclusion are the two most commonly dropped cheap marks in the topic.
For \(2\times 2\) tables, expect the question to demand Yates' correction by name — use \((|O-E|-0.5)^2\) and exploit the fact that \(|O-E|\) is identical in all four cells to compress the arithmetic. Keep discrepancies unrounded until the final statistic, and quote it to three significant figures against the tabled critical value. When the follow-up asks for the source of the association, do not gesture at the whole table: name the one or two cells with the biggest contributions, state whether observed is above or below expected, and translate into the scenario's language. And police your own vocabulary — 'associated', not 'correlated' (these are categories, not measurements), and 'evidence of association', not 'proof of cause'.