MathsFurther Statistics 1 › Contingency tables

Contingency tables

Cross-tabulate two categorical variables and one chi-squared test asks whether they are independent: expected counts come from the margins, and the degrees of freedom from the shape of the table.

Year FMEDEXCEL 9FM0 FS1

Builds on Goodness-of-fit tests and Conditional probability.

IN THIS TOPIC

  • Compute expected frequencies as row total × column total ÷ grand total.
  • Use (rows − 1)(columns − 1) degrees of freedom.
  • State the hypotheses as independence and association, and conclude in context.

WHAT YOU PROBABLY THINK

Expected frequencies in a contingency table come from assuming every cell is equally likely.

Expectations from the margins

The null hypothesis is that the two variables are independent, not that the cells are equal. Under independence, the probability of a cell is the product of its row and column probabilities, so multiplying by the grand total gives:

Eij = row total × column totalgrand total

Equal cells would be a far stronger claim, and one nobody tests here: a row holding twice as many observations should expect twice as much in every column, which is exactly what the formula delivers. The opening claim confuses independence with uniformity.

Observed counts with their margins, and the expected counts independence demands: row total times column total over 1502030106030204090505050150observed202020303030expectedχ² = 16.67 on 2 degrees of freedom: an association
FIG. 1A 2 × 3 table with its margins: each expected count is the row total times the column total over 150, so the two rows expect the same split in different sizes.

WORKED EXAMPLE

Testing an association

A survey cross-tabulates two variables as rows (20, 30, 10) and (30, 20, 40). Test at the 5% level whether the variables are independent.

Row totals 60 and 90; column totals 50, 50, 50; grand total 150. Expected: 60 × 50/150 = 20 across the first row, and 30 across the second.

χ² = 0 + 5 + 5 + 0 + 3.33 + 3.33 = 16.67.

Degrees of freedom (2 − 1)(3 − 1) = 2, critical value 5.991.

16.67 > 5.991, so reject H₀: there is evidence of an association between the two variables.

Counting the freedom in a grid

Once the margins are fixed, filling in one cell of a 2 × 2 table forces every other. In general only (rows − 1)(columns − 1) cells are free, and that is the degrees of freedom. No extra subtraction is needed for estimated parameters: the margins have already absorbed them.

Fixed margins on a 2 × 3 table: two free cells force the other four, so only two degrees of freedom remainfreefreeforcedfixedforcedforcedforcedfixedfixedfixedfixedrow and column totals are known(2 − 1)(3 − 1) = 2 degrees of freedom
FIG. 2Fixed margins on a 2 × 3 table: choosing two cells forces the other four, so the table carries just two degrees of freedom.

YOUR TURN

Degrees of freedom and pooling

A contingency table has 4 rows and 3 columns, and no expected frequency falls below 5. State the degrees of freedom and the 5% critical value's degrees of freedom if two rows had to be combined.

Show the working

As it stands: (4 − 1)(3 − 1) = 6 degrees of freedom.

Combining two rows leaves 3 rows: (3 − 1)(3 − 1) = 4.

Pooling always costs degrees of freedom, because it removes cells that were free to vary.

THE EXAM BIT

  • Write the hypotheses as 'no association' against 'some association', naming both variables.
  • Compute expected frequencies to one decimal place and show at least one calculation in full.
  • Degrees of freedom are (r − 1)(c − 1); do not subtract again for estimated parameters.
  • If any expected frequency is below 5, combine categories before computing the statistic.

CHECK YOURSELF

A contingency table has 3 rows and 4 columns. State the degrees of freedom, and find the expected frequency for a cell whose row total is 40 and column total is 30, with grand total 200.

Show a hint

(r − 1)(c − 1), and row × column ÷ total.

Show the answer

D

e

g

r

e

e

s

o

f

f

r

e

e

d

o

m

(

3

1

)

(

4

1

)

=

6

.

E

x

p

e

c

t

e

d

f

r

e

q

u

e

n

c

y

4

0

×

3

0

/

2

0

0

=

6

.

Expected = row total × column total ÷ grand total, which is independence written as arithmetic.

Degrees of freedom are (rows − 1)(columns − 1): the margins have already used up the rest.

WORKBOOK

Printable practice for this topic: original exam-style questions with room to work, and a fully worked answer book. Free to use; please do not redistribute or sell.

CHECK YOUR PROGRESS

Rate how confident you feel with each objective for this lesson. Ratings are saved in this browser, on this device only.

  • Compute expected frequencies as row total × column total ÷ grand total.
  • Use (rows − 1)(columns − 1) degrees of freedom.
  • State the hypotheses as independence and association, and conclude in context.

Open the full revision checklist to see every objective in the course in one place.

No animated video for this topic yet; these notes stand alone.