4.8A

Contingency Tables & Stating Hypotheses

The $\chi^2$ test for independence evaluates whether two categorical variables (e.g., student gender and preferred extracurricular activity) are statistically independent or associated.

Writing IB Hypotheses Accurately:

  • $H_0$ (Null Hypothesis): The two variables are independent (i.e. there is no association between Variable A and Variable B).
  • $H_1$ (Alternative Hypothesis): The two variables are not independent (i.e. there is an association between Variable A and Variable B).

Exam Note: Always state hypotheses explicitly in the exact context given in the question.

4.8B

Expected Frequencies ($f_e$) & Validity Rule

Under the assumption that $H_0$ is true, the expected frequency for a cell in row $i$ and column $j$ is calculated as:

$$f_e = \frac{\text{Row Total} \times \text{Column Total}}{\text{Grand Total (N)}}$$

The Validity Condition: A $\chi^2$ test is valid only if all expected frequencies are greater than or equal to 5 ($f_e \ge 5$). If any expected cell count is $< 5$, categories must be combined before conducting the test.

4.8C

Degrees of Freedom ($\text{df}$ or $\nu$) & Test Statistic

For an $r \times c$ two-way contingency table with $r$ rows and $c$ columns:

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

The test statistic compares observed counts ($f_o$) with expected counts ($f_e$):

$$\chi^2_{\text{calc}} = \sum \frac{(f_o - f_e)^2}{f_e}$$
4.8D

Decision Rules: Critical Value vs. $p$-value

Given significance level $\alpha$ (typically $5\%$ or $0.05$):

$$\text{If } p\text{-value} < \alpha \implies \text{Reject } H_0 \quad (\text{Significant association})$$ $$\text{If } p\text{-value} \ge \alpha \implies \text{Fail to reject } H_0 \quad (\text{Insufficient evidence of association})$$ $$\text{Equivalently: If } \chi^2_{\text{calc}} > \chi^2_{\text{crit}} \implies \text{Reject } H_0$$

GDC Automation: Enter observed frequencies into Matrix [A]. Navigate to STAT > TESTS > χ²-Test. Your calculator computes $\chi^2_{\text{calc}}$, $p$-value, $\text{df}$, and automatically populates Matrix [B] with all expected frequencies!

Goodness of fit: one categorical variable

  • Independence uses a two-way table; goodness of fit compares one observed frequency distribution with specified probabilities. State H0andH1for the claimed distribution.
  • Expected counts $E_i=Np_i$ must sum toN. Use $\chi^2=\sum(O_i-E_i)^2/E_i$. For a fully specified k-category SLmodel,df=k−1. Fitted parameters require a degree-of-freedom adjustment in more advanced settings.
  • Check independent observations and adequate expected counts. Combine categories only when substantively appropriate and before interpreting the revised test. Failure to reject is insufficient evidence against H0, not proof that H0is true.
  • Worked die test:60rolls give counts8,9,10,11,12,10. Fair-die expectations10each; statistic(4+1+0+1+4+0)/10=1,df5. With p≈0.9626, fail to reject fairness at5%; do not claim the die is proved fair.
Exercise 1 [3 marks]

A sample of 200 high school students was surveyed regarding their beverage preference (Tea, Coffee, Juice) across two grade levels (Grade 11, Grade 12). State the null and alternative hypotheses for a $\chi^2$ test of independence.

Solution:

$H_0$: Beverage preference is independent of grade level. [A1]

$H_1$: Beverage preference is not independent of grade level (or there is an association between beverage preference and grade level). [A1]

Stated clearly in the context of the question. [R1]

Exercise 2 [4 marks]

In a $3 \times 4$ contingency table, the row total for Row 2 is 85, the column total for Column 3 is 60, and the total number of observations is 250.

  1. Find the expected frequency for the cell in Row 2, Column 3.
  2. Calculate the degrees of freedom for this contingency table.

Solution:

(a) $f_e = \frac{\text{Row Total} \times \text{Column Total}}{N} = \frac{85 \times 60}{250}$ [M1]

$f_e = \frac{5100}{250} = 20.4$ [A1]

(b) $\nu = (r - 1)(c - 1) = (3 - 1)(4 - 1)$ [M1]

$\nu = 2 \times 3 = 6$ [A1]

Exercise 3 [3 marks]

A $\chi^2$ test at the $5\%$ significance level gives $\chi^2_{\text{calc}} = 8.421$ with degrees of freedom $\nu = 3$. The critical value from tables is $\chi^2_{\text{crit}} = 7.815$. State the conclusion of the test in context.

Solution:

Since $\chi^2_{\text{calc}} = 8.421 > \chi^2_{\text{crit}} = 7.815$ [R1]

We reject $H_0$ (null hypothesis). [A1]

There is sufficient evidence at the $5\%$ level of significance to suggest that the two variables are not independent (there is a significant association). [A1]

Exercise 4 [3 marks]

For a $\chi^2$ test of independence tested at the $1\%$ level of significance ($\alpha = 0.01$), the GDC yields a $p$-value of $0.0248$. State the decision and explain your reasoning.

Solution:

Comparing $p$-value to significance level: $0.0248 > 0.01$ (i.e. $p\text{-value} > \alpha$). [R1]

Decision: Fail to reject $H_0$ (or accept $H_0$). [A1]

There is insufficient evidence at the $1\%$ significance level to conclude that an association exists between the variables. [A1]

Exercise 5 [5 marks]

A survey of 100 people asked whether they exercise regularly (Yes, No) and their sleep quality (Good, Average, Poor). The observed frequencies are:

Exercise Good Average Poor
Yes (Total 50)25187
No (Total 50)152213

Find the expected frequency table and verify that all cells satisfy the $\chi^2$ validity condition.

Solution:

Column totals: Good $= 40$, Average $= 40$, Poor $= 20$. Grand total $N = 100$. Row totals are both 50.

Expected values for Yes: Good $= \frac{50 \times 40}{100} = 20$; Average $= \frac{50 \times 40}{100} = 20$; Poor $= \frac{50 \times 20}{100} = 10$. [M1][A1]

Expected values for No: identical due to equal row totals: $20, 20, 10$. [A1]

Minimum expected frequency is $10 \ge 5$. [R1]

Therefore, the validity condition for the $\chi^2$ test is satisfied. [A1]

Exercise 6 [4 marks]

Using the data in Exercise 5, calculate $\chi^2_{\text{calc}}$ manually by finding $\sum \frac{(f_o - f_e)^2}{f_e}$.

Solution:

Cell calculations:

Yes, Good: $\frac{(25 - 20)^2}{20} = \frac{25}{20} = 1.25$

Yes, Avg: $\frac{(18 - 20)^2}{20} = \frac{4}{20} = 0.20$

Yes, Poor: $\frac{(7 - 10)^2}{10} = \frac{9}{10} = 0.90$ [M1]

No, Good: $\frac{(15 - 20)^2}{20} = 1.25$; No, Avg: $\frac{(22 - 20)^2}{20} = 0.20$; No, Poor: $\frac{(13 - 10)^2}{10} = 0.90$ [M1]

$\chi^2_{\text{calc}} = 1.25 + 0.20 + 0.90 + 1.25 + 0.20 + 0.90$ [M1]

$\chi^2_{\text{calc}} = 4.70$ [A1]

Exercise 7 [3 marks]

For the test in Exercise 6 with $\nu = (2-1)(3-1) = 2$ degrees of freedom, the critical value at the $5\%$ level is $5.991$. Test at $5\%$ significance whether exercise is independent of sleep quality.

Solution:

$\chi^2_{\text{calc}} = 4.70 < \chi^2_{\text{crit}} = 5.991$. [R1]

Fail to reject $H_0$. [A1]

There is insufficient evidence at the $5\%$ level to conclude that exercise and sleep quality are associated (they appear independent). [A1]

Exercise 8 [4 marks]

A standard six-sided die is rolled 120 times to test whether it is fair ($\chi^2$ goodness of fit test).

  1. State the expected frequency for each face outcome under $H_0$.
  2. State the number of degrees of freedom for this goodness of fit test.

Solution:

(a) Under $H_0$, all 6 outcomes are equally likely ($p = \frac{1}{6}$). [M1]

$f_e = 120 \times \frac{1}{6} = 20$ for each face outcome. [A1]

(b) For a goodness of fit test with $k$ categories: $\nu = k - 1 = 6 - 1$ [M1]

$\nu = 5$ degrees of freedom. [A1]

Exercise 9 [3 marks]

Explain why researchers often prefer reporting the $p$-value rather than simply stating whether the test statistic exceeded the critical value.

Solution:

The $p$-value provides the exact probability of observing results as extreme as, or more extreme than, the observed data assuming $H_0$ is true. [R1]

It allows readers to assess significance at any chosen significance level $\alpha$ (e.g. $10\%$, $5\%$, or $1\%$) without needing separate critical value lookup tables. [R1]

It quantifies the continuous strength of evidence against $H_0$, rather than an all-or-nothing binary outcome. [A1]

Exercise 10 [4 marks]

A $2 \times 2$ contingency table yields observed frequencies where one expected frequency calculates to $3.8$. Describe two valid methodological actions a student could take to address this violation of the $\chi^2$ test condition.

Solution:

1. Increase the total sample size $N$ so that all expected counts scale up to $\ge 5$. [A2]

2. If applicable in larger tables, combine/merge adjacent sparse categories with related categories to pool counts (or use Fisher's exact test for $2 \times 2$ tables). [A2]

Exercise 11 [5 marks]

A stated distribution has probabilities0.5,0.3,0.2. Observed counts in100trials are40,35,25. Compute expected counts, statistic anddf, using critical value5.991at5%.

E50,30,20. χ²=100/50+25/30+25/20=49/12≈4.0833;df2. It is below5.991, so fail to reject. Insufficient evidence that the category proportions differ from the stated model.

Exercise 12 [5 marks]

A two-way2×2table is [[30,10],[10,30]]. Compute independence expectations and the test decision at5%using critical3.841.

Row and column totals40each,N80, so each expectation20. Statistic4(100/20)=20;df1. Reject independence because20>3.841. This establishes statistical association, not a causal mechanism.

Core Formulas (Topic 4.8 & 4.9)

Expected Frequency $$f_e = \frac{\text{Row Total} \times \text{Column Total}}{\text{Grand Total}}$$
Degrees of Freedom (Independence) $$\nu = (r - 1)(c - 1)$$
Degrees of Freedom (Goodness of Fit) $$\nu = k - 1$$ (for $k$ categories)
Test Statistic $$\chi^2_{\text{calc}} = \sum \frac{(f_o - f_e)^2}{f_e}$$

Top 5 IB Exam Traps to Avoid

  • Trap 1: Confusing Observed with Expected in the denominator: The denominator in $\chi^2$ is always $f_e$ (expected), never $f_o$!
  • Trap 2: Forgetting the Context in Hypotheses: Writing "$H_0$: The variables are independent" without naming the variables loses the method mark. You must say "$H_0$: Subject chosen is independent of gender."
  • Trap 3: Inverting the $p$-value Decision: Remember: "If $p$ is low, $H_0$ must go!" If $p < \alpha$, reject $H_0$.
  • Trap 4: Incorrect Degrees of Freedom: Do not count row totals and column totals as categories when determining $r$ and $c$.
  • Trap 5: Overlooking the $f_e \ge 5$ condition: Always check that all expected values are at least 5 before confirming test validity.

5-Question Concept Check

Score: - / 5

1. What are the degrees of freedom for a $4 \times 3$ contingency table testing for independence?

2. At a $5\%$ significance level ($\alpha = 0.05$), a GDC outputs a $p$-value of $0.038$. What is the correct conclusion?

3. What is the minimum expected frequency required in every cell for a $\chi^2$ test to be valid in IB Mathematics?

4. In a goodness of fit test with 5 distinct categories, how many degrees of freedom are there?

5. If $\chi^2_{\text{calc}} = 5.21$ and the critical value is $\chi^2_{\text{crit}} = 7.38$, what is the conclusion?