Steply

Chi-square goodness of fit: observed 33, 47, 70, 50; expected 20%…

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

Step by step

The question

Question: we saw the counts 33, 47, 70, 50, and expected 20%, 20%, 30%, 30%: at the 5% level, do the data fit?

observed 33, 47, 70, 50; expected 20%, 20%, 30%, 30%; α = 0.05

1 Write the hypotheses

H₀ is the "nothing new" idea.

Here: the data fit the expected parts.

H0 : the data fit the expected parts

Hₐ is what we want to show.

Here: the data do not fit.

Ha : the data do not fit

2 Expected counts

If H zero is true, each cell expects n times its part.

E = n × p (if H0 is true)

A: 200 times 0.2 is 40.

E(A) = 200 × 0.2 = 40

B: 200 times 0.2 is 40.

E(B) = 200 × 0.2 = 40

C: 200 times 0.3 is 60.

E(C) = 200 × 0.3 = 60

D: 200 times 0.3 is 60.

E(D) = 200 × 0.3 = 60

Every expected count is at least 5, so the test works.

all E at least 5: the test works

3 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.

33 minus 40 is −7.

Squared, 49.

Over 40: 1.225.

47 minus 40 is 7.

Squared, 49.

Over 40: 1.225.

70 minus 60 is 10.

Squared, 100.

Over 60: 1.6667.

50 minus 60 is −10.

Squared, 100.

Over 60: 1.6667.

Careful!

We always divide by the expected count, not the observed one.

Careful: divide by E (expected), not by O

4 Add them

1.225 plus 1.225 plus 1.6667 plus 1.6667 is 5.7834.

χ2 = 1.225 + 1.225 + 1.6667 + 1.6667 = 5.7834

5 The cut-off

df is the number of cells minus 1: 4 minus 1 is 3.

df = k − 1 = 4 − 1 = 3

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

Row 3, column 0.05.

Row 3, column .05: the cut-off is 7.815.

6 Decide

The chi-square curve for df 3.

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

5.7834 is not past the cut-off.

So we do not reject H zero.

= χ2 = 5.7834 < 7.815 → do not reject H0

7 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 data do not fit.

the data do not fit.

This does not prove H zero is true.

We just cannot rule it out.

not rejecting H0 does not prove H0

8 Check

Let's check: the expected counts add up to 200, like the observed ones.

E: 40 + 40 + 60 + 60 = 200 = n

And the differences O minus E add up to 0.

So it is right!

O − E: (−7) + 7 + 10 + (−10) = 0

Let's look back.

First: write the hypotheses.

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.7834 < 7.815 → do not reject H0

Your turn

Try this one yourself, then check:

observed 70, 33, 50, 47; expected 30%, 20%, 30%, 20%; α = 0.05
Show the answer
do not reject H0

More from Chi-square

The whole lesson: Chi-square →