Chi-squared Test (AI HL)

The chi-squared test asks whether two categorical variables are related (the independence test) or whether observed frequencies match an expected model (the goodness-of-fit test). Both run entirely on the GDC once you've set up the observed table, but the degrees of freedom and the expected-frequency condition are things you're expected to know by hand. It's part of the broader Hypothesis Testing topic.

11 questions on this sub-topic.

Practise the chi-squared test → Try exam-style questions

Degrees of freedom and expected frequency

Covered under IB syllabus reference SL4.11: the \(\chi^2\) test for independence and the \(\chi^2\) goodness-of-fit test, with expected frequencies required to be greater than 5.

Degrees of freedom (independence)

\(\nu = (r-1)(c-1)\)

Not in the formula booklet. \(r\) rows and \(c\) columns in the contingency table - once the totals are fixed, only this many cells can vary freely.

Expected frequency (independence)

\(E = \dfrac{(\text{row total})(\text{column total})}{\text{grand total}}\)

Not in the formula booklet. The GDC computes every expected frequency for you, but you should be able to find one by hand.

Need the full syllabus wording and formula-booklet reference table? See Hypothesis Testing.

Worked examples

1
Medium
GDC
[4 marks]

In a contingency table, a row total is 60, the column total is 75 and the grand total is 200.

(a) Find the expected frequency for that cell.

(b) State the formula used.

Worked solution

(a) \(E = \dfrac{60 \times 75}{200}\) M1
\(= 22.5.\) A1

(b) \(E = \dfrac{(\text{row total})(\text{column total})}{\text{grand total}}.\) M1 A1

A GDC is permitted on this paper, so you may evaluate or verify this result directly on the calculator.

M1 Substitute A1 Correct answer of \(22.5\) M1 Stating the correct Formula A1 Correct
2
Medium
GDC
[5 marks]

A \(\chi^2\) test of independence on a \(4\times3\) table gives \(\chi^2 = 13.1.\) The critical value at the 5% level is 12.59.

(a) Find the degrees of freedom.

(b) State the conclusion at the 5% level.

Worked solution

(a) \(\nu = (4-1)(3-1)\) M1
\(= 6.\) A1

(b) \(13.1 > 12.59\), so reject \(H_0\): R1 A1
the variables are not independent. A1

M1 Df formula A1 \(\nu=6\) R1 Compare A1 Reject A1 Conclusion
3
Easy
Calculator
[1 mark]

A goodness-of-fit test checks whether a six-sided die is fair (6 categories), with no parameters estimated.
State the degrees of freedom.

Worked solution

For a GOF test with no estimated parameters, \(\nu=(\text{categories})-1.\)
Six faces give \(\nu=6-1\) \(=5.\) A1
Once five expected counts are fixed, the sixth is determined by the total - hence one fewer degree of freedom than categories.

A1 ν = 5

Common mistakes

Ready to practise properly?

10 chi-squared-test questions, marked instantly like the real exam.

Quick answers

How do I find degrees of freedom for a chi-squared test of independence?

For an \(r\)-by-\(c\) contingency table, \(\nu = (r-1)(c-1)\).

What condition must expected frequencies satisfy?

Every expected frequency must be greater than 5 for the chi-squared test to be valid on this course. See the parent topic's GDC guidance for how to run the test itself.

← Back to Applications & Interpretation HL topics