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.
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
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 \(\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
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.
Common mistakes
- Forgetting to state the conclusion in context. "Reject \(H_0\)" alone rarely earns full marks - the final answer needs to say what that means for the actual situation, e.g. "there is evidence the machine underfills."
- Mixing up rows and columns in the degrees-of-freedom formula. \(\nu = (r-1)(c-1)\) uses the number of rows and columns in the table, not the total number of cells or the sample size.
- Ignoring the expected-frequency condition. The test is only valid on this course when every expected frequency exceeds 5 - if a question mentions combining categories, this condition is usually why.
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.