SME
Grade 12 Math · Problem type
Chi-square test of independence
Use this for “Is the way students get to school independent of their grade?” from a 2 × 3 table.
Table
200 in all: Grade 11 100, Grade 12 100
Expected counts are in parentheses under the observed
Expected
=
row
total
×
column
total
grand
total:
100
×
50
200
=
25
χ
2
=
Σ
(observed − expected)
2
÷
expected
=
(20 − 25)
2
÷
25
+
…
=
4
Degrees of freedom (2 − 1) × (3 − 1) = 2
This is an example. Type your own values to start a new problem.
a
Grade 11 students who walk
example
b
Grade 11 students who take the bus
example
c
Grade 11 students who come by car
example
d
Grade 12 students who walk
example
e
Grade 12 students who take the bus
example
f
Grade 12 students who come by car
example
X²
Chi-square statistic
worked out (not typed)
P
p-value
worked out (not typed)
α
Significance level
example
Formulas
X
2
=
Σ
(O − E)
2
÷
E
over
the
cells
a
,
b
,
c
,
d
,
e
,
f
4
=
Σ
(O − E)
2
÷
E
over
the
cells
20,
30,
50,
30,
20,
50
P
=
χ
2
cdf
(
X
2
,
∞,
2)
0.1353
=
χ
2
cdf
(4,
∞,
2)
Assumptions
•
H₀: the two variables are independent; each cell then expects row total × column total ÷ grand total.
•
Every expected count should be at least 5; df = (2 − 1)(3 − 1) = 2.
•
A test of homogeneity (do two groups share one distribution?) uses the same arithmetic.
Step-by-step
WE KNOW
a = 20, b = 30, c = 50, d = 30, e = 20, f = 50, α = 0.05
FIND
chi-square statistic (X²), p-value (P)
Step 1 · Find chi-square statistic (X²)
Use X² = Σ(O − E)² ÷ E over the cells a, b, c, d, e, f
Each
cell
expects
row
total
×
column
total
grand
total;
walk,
grade
11:
100
×
50
200
=
25.
Row
by
row
they
are
25,
25,
50,
25,
25,
50.
X
2
=
(
a
− 25)
2
÷
25
+
(
b
− 25)
2
÷
25
+
(
c
− 50)
2
÷
50
+
(
d
− 25)
2
÷
25
+
(
e
− 25)
2
÷
25
+
(
f
− 50)
2
÷
50
X
2
=
(20 − 25)
2
÷
25
+
(30 − 25)
2
÷
25
+
(50 − 50)
2
÷
50
+
(30 − 25)
2
÷
25
+
(20 − 25)
2
÷
25
+
(50 − 50)
2
÷
50
X
2
=
25
25
+
25
25
+
0
50
+
25
25
+
25
25
+
0
50
X
2
=
1
+
1
+
0
+
1
+
1
+
0
X
2
=
4
Step 2 · Find p-value (P)
Use P = χ²cdf(X², ∞, 2)
The area under the chi-square curve with df 2 past the statistic.
P
=
χ
2
cdf
(4,
∞,
2)
P
=
0.1353
→
0.1353
≥
α
=
0.05:
fail
to
reject
H₀
Check
Put the numbers back in. Both sides should match.
(20 − 25)
2
÷
25
+
(30 − 25)
2
÷
25
+
(50 − 50)
2
÷
50
+
(30 − 25)
2
÷
25
+
(20 − 25)
2
÷
25
+
(50 − 50)
2
÷
50
=
4
✓
0.1353
=
χ
2
cdf
(4,
∞,
2)
✓
← Previous lesson
Goodness of fit with five categories
Next lesson →
Inference for the slope of a regression line
Topic check
See what you know: 5 questions on this topic
New questions each time. Pass to mark it complete.