Chi-Squared Tests for Independence in Contingency Tables | Applications and Interpretation IB Maths notes

Free preview: Chi-Squared Tests for Independence in Contingency Tables

Is There an Association?

Applications and interpretation: SL and HL (SL 4.11)

Watch: common mistake (1-minute fix)

Watch: 1-minute explainer

So far our tests have been about means: numbers like heights and times. But lots of real questions are about categories. Does the choice of activity depend on age? Is voting linked to region? Are left-handed people more likely to be artists? We can't average "Music" and "Sport". We can only count. This note tests for a link using counts.

Let's start with a survey. 180 people in three age groups each choose their favourite activity:

ObservedMusicSportArtTotal
Under 2528221060
25 to 5020251560
Over 5012232560
Total607050180
  • A table of counts like this is a contingency table. Each count is an observed frequency O.
  • Question: does preference depend on age, or are the two independent?
  • H0: age group and preference are independent (no association).
  • H1: age group and preference are not independent (there is an association).

Expected frequencies

  • If they were independent, each age group would split in the same proportions as the whole sample.
  • 60 of the 180 people (one third) prefer music, so we'd expect a third of each age group, 20, to prefer music.
  • These "if independent" counts are the expected frequencies E.

Diagram: Each bar is one age group, split into Music, Sport and Art. The bottom bar is what independence predicts.

What the picture shows

  • Each bar is one age group, split into Music, Sport and Art. The bottom bar is what independence predicts.
  • The whole sample splits 60 : 70 : 50, so under H0 every row of 60 should split as 20, 23.33 and 16.67.
  • The observed rows split very differently, for example 28 of the under 25s chose Music.
  • The test asks whether those differences are bigger than chance would give.

The formula for E

  1. For independent events, P(A∩B)=P(A)P(B).
  2. Estimate P(row)=row totalgrand total and P(column)=column totalgrand total.
  3. Multiply them, then multiply by the grand total to turn a probability into a count.

E=row total×column totalgrand total

  • Music: 60×60180=20. Sport: 60×70180=23.33. Art: 60×50180=16.67. The same for each row here, as every row total is 60.
  • Check: the expected frequencies have the same row and column totals as the observed ones.
  • Expected frequencies don't have to be whole numbers. Keep 2 d.p.

✏️ YOUR TURN 1

Try this first:

In a table with grand total 250, a row has total 90 and a column has total 120. Find the expected frequency for that cell under independence.

Answer:

  • E=90×120250=10800250=43.2.

The Test Statistic and Degrees of Freedom

Now we need one number that measures how far the whole table is from independence.

X2=∑(O−E)2E≈χν2,ν=(r−1)(c−1)

  • Each cell's contribution (O−E)2E measures how far that count is from what independence predicts.
  • Why square? So positive and negative gaps don't cancel. Why divide by E? A gap of 5 matters more when you expected 10 than when you expected 1000.
  • Big total means a poor match, so we reject H0 when X2 is large. The test is always upper-tailed.
  • The χ2 (chi-squared, "kye") distribution with ν degrees of freedom is the model for X2 when H0 is true.
  • For an r × c table, ν=(r−1)(c−1): once the totals are fixed, only that many cells are free. (Fill in all but the last row and last column, and the totals force the rest.)

Chi-squared curves with 2, 4 and 8 degrees of freedom; all are skewed to the right; the 4 degrees of freedom curve has its upper 5% tail beyond 9.488 shaded pink

Following the diagram

  • χ² curves start at 0 (a sum of squares can't be negative) and are skewed right.
  • More degrees of freedom move the curve to the right and spread it out. Its mean is ν.
  • For ν=4, the top 5% is beyond 9.488: that is the 5% critical value.

Unlock the full note: start 7 days free.

Log in or subscribe to read the rest of this note. Members also get the AI tutor, practice quizzes, mock exams and flashcards for this topic.

Log in · Subscribe · Start free trial

All notes in Hypothesis testing (SL 4.11)

  1. The Language of Hypothesis Testing
  2. Chi-Squared Tests for Independence in Contingency Tables
  3. Chi-Squared Goodness of Fit for Uniform, Binomial and Poisson Models
  4. The Two-Sample t-Test on Your GDC

Video

What's inside for this topic

4 teacher notes, 65 practice questions, 33 flashcards, 2 quizzes.

Get the full notes, every practice question, flashcards, quizzes and mock papers.

Start your free 7-day trial

Questions? Chat with us on WhatsApp · Try one live lesson

Previous note: The Language of Hypothesis Testing Next note: Chi-Squared Goodness of Fit for Uniform, Binomial and Poisson Models

Chi-Squared Tests for Independence in Contingency Tables on other exam boards

All Applications and Interpretation IB Maths topics · IB Maths