IA statistics, step by step · χ² test for independence
The χ² test for independence, step by step
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.
| Year group \ Usual way to travel to school | Walk | Bus | Car | Cycle |
|---|---|---|---|---|
| Year 10 | 18 | 22 | 14 | 4 |
| Year 11 | 15 | 25 | 12 | 3 |
| Year 12 | 9 | 20 | 24 | 2 |
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
| Year group \ Usual way to travel to school | Walk | Bus | Car | Cycle | Total |
|---|---|---|---|---|---|
| Year 10 | 18 | 22 | 14 | 4 | 58 |
| Year 11 | 15 | 25 | 12 | 3 | 55 |
| Year 12 | 9 | 20 | 24 | 2 | 55 |
| Total | 42 | 67 | 50 | 9 | 168 |
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.
| Walk | Bus | Car | Cycle | |
|---|---|---|---|---|
| Year 10 | 14.50 | 23.13 | 17.26 | 3.107 |
| Year 11 | 13.75 | 21.93 | 16.37 | 2.946 |
| Year 12 | 13.75 | 21.93 | 16.37 | 2.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.
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
- A Criterion A (Presentation): Observed table, expected table, test and conclusion in a clear order, each table labelled.
- B Criterion B (Mathematical communication): H₀, H₁, O, E, χ², ν and p used correctly; tables titled.
- C Criterion C (Personal engagement): A question about your own school or community, and combining decisions that show you know the context.
- D Criterion D (Reflection): Interpreting a non-significant result honestly and discussing the sample and the combining.
- E Criterion E (Use of mathematics): Expected frequencies, χ², ν and the decision all correct.
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.
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
- Criterion E: use of mathematicsWhat “commensurate with the level of the course” means for statistics, at SL and HL.
- Criterion D: reflectionSample, bias, assumptions and causation: where statistics IAs gain or lose marks.
- Plan your statistics IAThe section-by-section framework for a statistics exploration, with your own notes.
- Get feedback on your write-upCriterion-by-criterion feedback on your draft, with evidence from your own text.
- Exemplar: Sleep and reactions (statistics)AI SL · a statistics exploration that uses this technique, marked criterion by criterion.
- Exemplar: Bus lateness and rain (AI SL)AI SL · a statistics exploration that uses this technique, marked criterion by criterion.
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.
While you wait for the email: read the full statistics workflow →