The Chi-Square Goodness of Fit Statistic

This statistic enables us to test whether observed frequencies are close to
those we would expect.

1. Expected frequencies

These expectations can come from many sources. For example, if we
have an honest die we would expect 1/6 of all cases to show any of
the 6 possible faces to come up.

So, for example, if we roll a die 60 times we would expect:
X     f

1     10
2     10
3     10
4     10
5     10
6     10
60

Or, as a null hypothesis we have: The alternative hypothesis here is complicated!

If we actually roll a die 60 times we wouldn't expect each of the faces
to come up exactly 10 times, only "close to" 10 times. How many
times each face actually comes up is the observed frequency for that face. For example, let us say that we get the following results:

X     fo     fe

1     12     10
2       9     10
3     10     10
4     11     10
5       8     10
6       9    10
60

Are these observed frequencies close or far away from what we would expect if all sides have an equal probability of coming up?

In 1900, Karl Pearson discovered a statistic that can tell us the  fo = the observed frequency fe = the expected frequency

Although this is called a "goodness of fit" statistic, it actually measures "badness of fit"

This statistic has C-1 degrees of freedom, where C is the number of sides ("catagories") that the die has.

Thus, to calculate this statistic for the data above we do the
following: X     fo     fe     (fo-fe)     (fo-fe)2     (fo-fe)2/fe

1     12     10         2             4                 .4
2       9     10       -1             1                 .1
3     10     10         0             0               0.0
4     11     10         1             1                 .1
5       8     10        -2             4                 .4
6     10     10         0             0                 0.0
60                                           1.0

Is this a big discrepancy or a small one? To answer this question we look up a "critical number" in a chi-square table.

The d.f. for this statistic equals C - 1, or in our case, 5.  Looking
up the magic number for 5 d.f. gives us 11.07 if type 1 error
= .05

Thus, our sample chi-square value (1.0) does not fall in the
rejection region (which starts at 11.07), and we fail to reject
the null hypothesis above.  That null hypothesis says that
the die is an honest die. 