01 / 21
\(\chi^2\)

The \(\chi^2\) Distribution

Understand the chi-squared distribution, its properties, and how it powers goodness-of-fit and independence tests in statistics.

IB Mathematics AA HL

What is the \(\chi^2\) Distribution?

The chi-squared distribution arises when you sum the squares of independent standard normal random variables. If \( Z_1, Z_2, \ldots, Z_k \) are independent with \( Z_i \sim N(0,1) \), then:

It is a continuous, non-negative distribution used extensively in hypothesis testing: goodness-of-fit tests, tests for independence, and homogeneity tests.

Shape Depends on Degrees of Freedom

0 4 8 12 16 20
\(x\)
\(f(x)\)
\(\text{df} = 2\)
Exponential-like: steep decline from \(x=0\)
\(\text{df} = 5\)
Right-skewed with a clear peak
\(\text{df} = 10\)
Approaches a bell shape as df grows

Key Properties of \(\chi^2(k)\)

Mean
\( E(X) = k \)
Variance
\( \text{Var}(X) = 2k \)
Support
\( x \ge 0 \) only

The distribution is always right-skewed, but the skewness decreases as the degrees of freedom increase: \(\text{skewness} = \sqrt{8/k}\).

The \(\chi^2\) Test Statistic

In hypothesis testing, we compute a test statistic that measures the discrepancy between observed and expected frequencies:

Under \(H_0\), this statistic approximately follows a \(\chi^2\) distribution. A large value of \(\chi^2_{\text{calc}}\) means the data deviate significantly from expectation.

GoF vs Independence Tests

Goodness-of-Fit Test for Independence
Purpose Does a single variable fit a claimed distribution? Are two categorical variables independent?
Data One row of observed counts Contingency table (rows × columns)
Degrees of freedom \( k - 1 \) \( (r-1)(c-1) \)
\( H_0 \) Data follows the proposed distribution The two variables are independent
Expected freq. \( f_e = n \cdot p_i \) \( f_e = \frac{\text{row total} \times \text{col total}}{n} \)

Understanding Degrees of Freedom

Degrees of freedom (df) represent the number of values that are free to vary once constraints are applied. They determine which \(\chi^2\) curve to use for critical values.

GoF Test
\( \text{df} = k - 1 \)
where \(k\) = number of categories
Independence Test
\( \text{df} = (r-1)(c-1) \)
where \(r\) = rows, \(c\) = columns

The Critical Region

The shaded region shows where we would reject \(H_0\) at significance level \(\alpha\). The critical value \(\chi^2_{\text{crit}}\) is read from tables or a GDC using df and \(\alpha\).

How to Conduct a \(\chi^2\) Test

1
State hypotheses. \(H_0\): no difference (data fits model / variables are independent). \(H_1\): there is a difference.
2
Calculate expected frequencies. Use \(f_e = np_i\) (GoF) or \(f_e = \frac{\text{row} \times \text{col}}{n}\) (independence). Check all \(f_e \ge 5\).
3
Compute the test statistic. \(\chi^2_{\text{calc}} = \sum \frac{(f_o - f_e)^2}{f_e}\)
4
Find the critical value or \(p\)-value. Use df and significance level \(\alpha\) (often 0.05).
5
Make a decision. If \(\chi^2_{\text{calc}} > \chi^2_{\text{crit}}\) (or \(p\)-value < \(\alpha\)), reject \(H_0\).

Example 1: Goodness-of-Fit

A die is rolled 60 times. The results are shown below. Test at the 5% significance level whether the die is fair.

Face 1 2 3 4 5 6
\(f_o\) 14 8 12 15 5 6
\(f_e\) 10 10 10 10 10 10

Example 1: Calculation

\(\text{df}\)
\(\text{df} = k - 1 = 6 - 1 = 5\)
\(\chi^2_{\text{crit}}\)
\(\chi^2_{\text{crit}}(5, 0.05) = 11.07\)

Example 2: Test for Independence

A survey of 200 students asked about their preferred study method and exam result. Test at \(\alpha = 0.05\) whether the variables are independent.

Pass Fail Total
Visual 48 12 60
Auditory 56 24 80
Kinesthetic 36 24 60
Total 140 60 200

Example 2: Expected Values and Result

Example 3: When We Reject \(H_0\)

A biologist claims that flower colour in a species follows a \(3:1\) ratio (red : white). In a sample of 200 flowers, 130 are red and 70 are white. Test at \(\alpha = 0.05\).

Common Mistakes to Avoid

✕ Using Percentages
Always use frequencies (counts), never percentages or proportions in the formula.
✕ Ignoring \(f_e \ge 5\)
All expected frequencies must be at least 5. Combine categories if needed.
✕ Wrong \(\text{df}\)
GoF: \(k-1\). Independence: \((r-1)(c-1)\). Mixing these up changes the critical value.
✕ Two-Tailed Test
The \(\chi^2\) test is always right-tailed. Never halve \(\alpha\) or check the left tail.
✕ Proving Independence
Failing to reject \(H_0\) does not prove independence: it means insufficient evidence.

Summary Reference Card

Concept Formula / Rule
Test statistic \(\chi^2_{\text{calc}} = \sum \frac{(f_o - f_e)^2}{f_e}\)
Mean \(E(X) = k\)
Variance \(\text{Var}(X) = 2k\)
GoF \(\text{df}\) \(k - 1\)
Independence \(\text{df}\) \((r-1)(c-1)\)
Expected (GoF) \(f_e = n \cdot p_i\)
Expected (Ind.) \(f_e = \frac{\text{row} \times \text{col}}{n}\)
Condition All \(f_e \ge 5\)
Decision Reject \(H_0\) if \(\chi^2_{\text{calc}} > \chi^2_{\text{crit}}\)

Question 1 of 5

If \(X \sim \chi^2(8)\), what are the mean and variance of \(X\)?

Question 2 of 5

A goodness-of-fit test has 4 categories. What are the degrees of freedom?

Question 3 of 5

In a \(\chi^2\) test, \(\chi^2_{\text{calc}} = 12.4\) and \(\chi^2_{\text{crit}} = 9.49\) at \(\alpha = 0.05\). What is the conclusion?

Question 4 of 5

A \(3 \times 3\) contingency table is used for a test of independence. What are the degrees of freedom?

Question 5 of 5

Which condition must be met before conducting a \(\chi^2\) test?