Steply

Chi-square independence: junior 30 bus 20 car 10 walk, senior 20 bus…

Step by step, with the reason for every step · Chi-square · University Statistics

Step by step

The question

Question: junior: 30 bus, 20 car, 10 walk; senior: 20 bus, 35 car, 15 walk: at the 5% level, is the answer linked to the group?

junior: 30 bus, 20 car, 10 walk; senior: 20 bus, 35 car, 15 walk; α = 0.05

1 Write the hypotheses

H₀ is the "nothing new" idea.

Here: the group and the answer are independent.

H0 : the group and the answer are independent

Hₐ is what we want to show.

Here: the group and the answer are not independent.

Ha : the group and the answer are not independent

Independent means no link: the answer does not depend on the group.

independent: no link, the answer does not depend on the group

2 Totals

The counts in a table.

Each row's total: junior, 60; senior, 70.

Each column's total: bus, 50; car, 55; walk, 25.

And everyone: 130.

3 Expected counts

If there is no link, each cell expects its row total times its column total, over the grand total.

E = row total × column totaltotal

Junior, bus: 60 times 50, over 130, is about 23.0769.

= junior, bus: 60 × 50 ÷ 130 ≈ 23.0769

Junior, car: 60 times 55, over 130, is about 25.3846.

= junior, car: 60 × 55 ÷ 130 ≈ 25.3846

Junior, walk: 60 times 25, over 130, is about 11.5385.

= junior, walk: 60 × 25 ÷ 130 ≈ 11.5385

Senior, bus: 70 times 50, over 130, is about 26.9231.

= senior, bus: 70 × 50 ÷ 130 ≈ 26.9231

Senior, car: 70 times 55, over 130, is about 29.6154.

= senior, car: 70 × 55 ÷ 130 ≈ 29.6154

Senior, walk: 70 times 25, over 130, is about 13.4615.

= senior, walk: 70 × 25 ÷ 130 ≈ 13.4615

4 Each part

Chi-square adds up, for each cell, the observed minus the expected, squared, over the expected.

χ2 = add up all (O − E)2E

A table: each cell, what we saw, O, and what we expected, E.

30 minus 23.0769 is 6.9231.

Squared, 47.9293.

Over 23.0769: 2.0769.

20 minus 25.3846 is −5.3846.

Squared, 28.9939.

Over 25.3846: 1.1422.

10 minus 11.5385 is −1.5385.

Squared, 2.367.

Over 11.5385: 0.2051.

20 minus 26.9231 is −6.9231.

Squared, 47.9293.

Over 26.9231: 1.7802.

35 minus 29.6154 is 5.3846.

Squared, 28.9939.

Over 29.6154: 0.979.

15 minus 13.4615 is 1.5385.

Squared, 2.367.

Over 13.4615: 0.1758.

5 Add them

2.0769 plus 1.1422 plus 0.2051 plus 1.7802 plus 0.979 plus 0.1758 is 6.3592.

χ2 = 2.0769 + 1.1422 + 0.2051 + 1.7802 + 0.979 + 0.1758 = 6.3592

6 The cut-off

df is rows minus 1, times columns minus 1: 1 times 2 is 2.

df = (rows − 1)(columns − 1) = (2 − 1)(3 − 1) = 2

Careful!

Not the number of cells minus 1.

Rows minus 1, times columns minus 1: 2.

Careful: not df = 5 ✗

Chi-square is always a right-tail test: big means far from what we expected.

Row 2, column 0.05.

Row 2, column .05: the cut-off is 5.991.

7 Decide

The chi-square curve for df 2.

Past the cut-off, 5.991, is the reject part.

6.3592 is past the cut-off.

So we reject H zero.

= χ2 = 6.3592 > 5.991 → reject H0

8 Say it in words

At the 5% level, there is enough evidence that

In words: at the 5% level, there is enough evidence that the group and the answer are not independent.

the group and the answer are not independent.

9 Check

Let's check: the expected counts give the same row totals.

Junior: 23.0769 plus 25.3846 plus 11.5385 is 60.

junior: E 23.0769 + 25.3846 + 11.5385 = 60 = 60

Senior: 26.9231 plus 29.6154 plus 13.4615 is 70.

So it is right!

senior: E 26.9231 + 29.6154 + 13.4615 = 70 = 70

Let's look back.

First: write the hypotheses.

Then: totals.

Then: expected counts.

Then: each part.

Then: add them.

Then: the cut-off.

Then: decide.

Then: say it in words.

Last: check.

Answer
= χ2 = 6.3592 > 5.991 → reject H0

Your turn

Try this one yourself, then check:

junior: 20 bus, 31 car, 10 walk; senior: 35 bus, 20 car, 15 walk; α = 0.05
Show the answer
reject H0

More from Chi-square

The whole lesson: Chi-square →