Steply

Chi-square independence: x 40 yes 20 no, y 30 yes 30 no, z 20 yes 40…

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

Step by step

The question

Question: x: 40 yes, 20 no; y: 30 yes, 30 no; z: 20 yes, 40 no: at the 1% level, is the answer linked to the group?

x: 40 yes, 20 no; y: 30 yes, 30 no; z: 20 yes, 40 no; α = 0.01

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: x, 60; y, 60; z, 60.

Each column's total: yes, 90; no, 90.

And everyone: 180.

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

X, yes: 60 times 90, over 180, is 30.

= x, yes: 60 × 90 ÷ 180 = 30

X, no: 60 times 90, over 180, is 30.

= x, no: 60 × 90 ÷ 180 = 30

Y, yes: 60 times 90, over 180, is 30.

= y, yes: 60 × 90 ÷ 180 = 30

Y, no: 60 times 90, over 180, is 30.

= y, no: 60 × 90 ÷ 180 = 30

Z, yes: 60 times 90, over 180, is 30.

= z, yes: 60 × 90 ÷ 180 = 30

Z, no: 60 times 90, over 180, is 30.

= z, no: 60 × 90 ÷ 180 = 30

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.

40 minus 30 is 10.

Squared, 100.

Over 30: 3.3333.

20 minus 30 is −10.

Squared, 100.

Over 30: 3.3333.

30 minus 30 is 0.

Squared, 0.

Over 30: 0.

30 minus 30 is 0.

Squared, 0.

Over 30: 0.

20 minus 30 is −10.

Squared, 100.

Over 30: 3.3333.

40 minus 30 is 10.

Squared, 100.

Over 30: 3.3333.

5 Add them

3.3333 plus 3.3333 plus 0 plus 0 plus 3.3333 plus 3.3333 is 13.3332.

χ2 = 3.3333 + 3.3333 + 0 + 0 + 3.3333 + 3.3333 = 13.3332

6 The cut-off

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

df = (rows − 1)(columns − 1) = (3 − 1)(2 − 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.01.

Row 2, column .01: the cut-off is 9.210.

7 Decide

The chi-square curve for df 2.

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

13.3332 is past the cut-off.

So we reject H zero.

= χ2 = 13.3332 > 9.210 → reject H0

8 Say it in words

At the 1% level, there is enough evidence that

In words: at the 1% 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.

X: 30 plus 30 is 60.

x: E 30 + 30 = 60 = 60

Y: 30 plus 30 is 60.

y: E 30 + 30 = 60 = 60

Z: 30 plus 30 is 60.

So it is right!

z: E 30 + 30 = 60 = 60

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 = 13.3332 > 9.210 → reject H0

Your turn

Try this one yourself, then check:

x: 20 yes, 41 no; y: 41 yes, 20 no; z: 31 yes, 30 no; α = 0.01
Show the answer
reject H0

More from Chi-square

The whole lesson: Chi-square →