Steply

Chi-square independence: first 15 red 25 blue 10 green, second 25…

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

Step by step

The question

Question: first: 15 red, 25 blue, 10 green; second: 25 red, 15 blue, 10 green: at the 5% level, is the answer linked to the group?

first: 15 red, 25 blue, 10 green; second: 25 red, 15 blue, 10 green; α = 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: first, 50; second, 50.

Each column's total: red, 40; blue, 40; green, 20.

And everyone: 100.

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

First, red: 50 times 40, over 100, is 20.

= first, red: 50 × 40 ÷ 100 = 20

First, blue: 50 times 40, over 100, is 20.

= first, blue: 50 × 40 ÷ 100 = 20

First, green: 50 times 20, over 100, is 10.

= first, green: 50 × 20 ÷ 100 = 10

Second, red: 50 times 40, over 100, is 20.

= second, red: 50 × 40 ÷ 100 = 20

Second, blue: 50 times 40, over 100, is 20.

= second, blue: 50 × 40 ÷ 100 = 20

Second, green: 50 times 20, over 100, is 10.

= second, green: 50 × 20 ÷ 100 = 10

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.

15 minus 20 is −5.

Squared, 25.

Over 20: 1.25.

25 minus 20 is 5.

Squared, 25.

Over 20: 1.25.

10 minus 10 is 0.

Squared, 0.

Over 10: 0.

25 minus 20 is 5.

Squared, 25.

Over 20: 1.25.

15 minus 20 is −5.

Squared, 25.

Over 20: 1.25.

10 minus 10 is 0.

Squared, 0.

Over 10: 0.

5 Add them

1.25 plus 1.25 plus 0 plus 1.25 plus 1.25 plus 0 is 5.

χ2 = 1.25 + 1.25 + 0 + 1.25 + 1.25 + 0 = 5

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.

5 is not past the cut-off.

So we do not reject H zero.

= χ2 = 5 < 5.991 → do not reject H0

8 Say it in words

At the 5% level, there is not enough evidence that

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

the group and the answer are not independent.

This does not prove H zero is true.

We just cannot rule it out.

not rejecting H0 does not prove H0

9 Check

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

First: 20 plus 20 plus 10 is 50.

first: E 20 + 20 + 10 = 50 = 50

Second: 20 plus 20 plus 10 is 50.

So it is right!

second: E 20 + 20 + 10 = 50 = 50

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 = 5 < 5.991 → do not reject H0

Your turn

Try this one yourself, then check:

first: 10 red, 25 blue, 15 green; second: 10 red, 16 blue, 25 green; α = 0.05
Show the answer
do not reject H0

More from Chi-square

The whole lesson: Chi-square →