Updated · By Pete Bromfield, IB examiner

IA statistics, step by step · χ² test for independence

The χ² test for independence, step by step

AI SLAI HL

Is year group linked to how students travel to school? This page builds the expected frequencies, finds a problem (expected counts below 5), fixes it by combining categories, and carries out the test — every number shown.

Example data, invented for this guide. The context is realistic, but the numbers were made up to show the method. Use your own collected or sourced data in your IA.

When to use it

  • Two categorical variables recorded for each individual (year group and travel mode, weather and lateness).
  • You have counts, not percentages or means.
  • Each individual is counted once, in one cell.

Course fit: AI SL and HL: the χ² test for independence with contingency tables, degrees of freedom, critical values and p-values is in the AI SL core. It is not in the AA courses — AA students can use it if they explain it.

The example data

168 students from three year groups (a stratified random sample) said how they usually travel to school.

Example data: observed counts
Year group \ Usual way to travel to schoolWalkBusCarCycle
Year 101822144
Year 111525123
Year 12920242

First try: the full 3 × 4 table

The observed table with every travel mode, and the expected frequencies if year group and travel were independent.

Step 1 · Observed frequencies and totals

Observed frequencies O
Year group \ Usual way to travel to schoolWalkBusCarCycleTotal
Year 10182214458
Year 11152512355
Year 1292024255
Total4267509168

Step 2 · Expected frequencies if the variables are independent

E = (row total × column total) / grand total

For example, the first cell: 58 × 42 / 168 = 14.50.

Expected frequencies E
WalkBusCarCycle
Year 1014.5023.1317.263.107
Year 1113.7521.9316.372.946
Year 1213.7521.9316.372.946

Smallest expected frequency: 2.946. 3 expected frequencies are below 5, so the test is not reliable as it stands: combine categories (rows or columns) that make sense together, and recalculate.

Bar chart of usual way to travel to school by year group
Observed counts by year group. Note how few students cycle.

In the full worked analysis

  • After combining: walk or cycle
  • What the example shows, in context
  • On a GDC: TI-84 Plus CE, TI-Nspire CX and Casio fx-CG50
  • What examiners look for
  • Common mistakes
  • Limitations to discuss

How this maps to the IA criteria

These are the current criteria A–E, for exams up to November 2028. For the new courses (first assessment May 2029) the IB has confirmed one set of four criteria for SL and HL: A Problem specification (4 marks), B Abstraction (6), C Computation (4) and D Interpretation (6), still 20 marks and 20% of the grade at both levels — see the IB's new AA and AI subject briefs. The detailed descriptors come with the new guide; check with your teacher which criteria apply to you. The advice is our summary, not the IB's wording.

Get feedback on your write-up Self-check your draft

Frequently asked questions

What if my expected frequencies are less than 5?

The χ² test is not reliable. Combine rows or columns that make sense together in your context (or collect more data), recalculate, and explain what you combined and why.

How do I find the degrees of freedom for a χ² test for independence?

ν = (number of rows − 1)(number of columns − 1), counted after any combining.

My p-value is above 0.05. Is my IA ruined?

No. Not rejecting H₀ is a valid result. Interpret it in context, discuss the sample size and what else could be investigated — that is good reflection.

Next steps

Related: Chi-squared goodness of fit · Choosing the right test. Or analyse your own data, find a data set in the IA data bank, and see what the IA package adds.

Free: the IA checklist an examiner uses

Every check for Criteria A–E in a 4-page PDF, the mistakes that cost the most marks and a self-assessment grid. We'll email it with a short IA tip every few days, timed to your deadline if you give it. Free — no account, no payment.