Counts against a claim
A die is rolled 60 times, and the number of times each face comes up is counted. Faces 1 to 6 come up 8, 13, 9, 12, 7 and 11 times.
The claim being tested is : the die is fair, so every face has probability . The alternative is : the die is not fair. A goodness of fit test asks whether the counts fit the model that describes.
The observed count for each face. The dashed line across the bars is at 10, the count a fair die expects for every face.
What the claim predicts
If the die is fair, each face is expected times. The expected frequencies are 10, 10, 10, 10, 10 and 10, and like the observed ones they add up to 60.
Even a fair die almost never gives exactly 10 of each in 60 rolls. The test asks whether the counts are further from 10 than chance would usually make them.
The same statistic
The statistic is the one used for a two-way table: χ² , added over every category. The gaps O − E are 8 − 10 = −2, 13 − 10 = 3, −1, 2, −3 and 1. They add up to 0.
Their squares are 4, 9, 1, 4, 9 and 1, which total 28. Every expected count is 10, so χ² = 28 ÷ 10 = 2.8.
Degrees of freedom
The six counts must add up to 60. Once five of them are known, the sixth is fixed: if faces 1 to 5 came up 8, 13, 9, 12 and 7 times, face 6 must have come up 60 − 49 = 11 times. So 5 counts are free, and there are 6 − 1 = 5 degrees of freedom.
For a goodness of fit test, the degrees of freedom are the number of categories minus one. One more is lost for each number in the model that is estimated from the data, such as a mean worked out from the same counts. Here the model, for each face, was given in full, so nothing is estimated.
The gold curve is the chi-squared distribution with 5 degrees of freedom, highest at 3. The shaded tail from 11.07 holds 5 percent of the area. The observed total, 2.8, is far to the left of it.
The verdict
With 5 degrees of freedom, P(χ² , so the critical region at the 5 percent level is χ² .
2.8 < 11.07, so do not reject . The p-value is P(χ² : a fair die gives counts at least this uneven about 73 times in 100. Stated about the die: there is no evidence that it is unfair.
That does not prove the die fair. A slight bias could be there, too small for 60 rolls to show.
A model that is not uniform
The claimed probabilities need not be equal. A spinner is claimed to land on red with probability and on blue and green with probability each. In 80 spins it lands on red 32 times, blue 28 times and green 20 times.
The expected counts are , and 20. The gaps are −8, 8 and 0, so χ² .
There are 3 − 1 = 2 degrees of freedom, and the 5 percent critical value is 5.991. 4.8 < 5.991, so do not reject : there is no evidence at the 5 percent level against the claimed probabilities. The p-value is P(χ² .
Expected counts of at least 5
As for a two-way table, every expected count should be at least 5. When a category expects fewer, it is combined with a neighboring one before χ² is worked out, and the degrees of freedom are counted from the categories that remain.
The usual mistakes
Expecting the wrong count. A fair die rolled 60 times expects 60 ÷ 6 = 10 of each face, not 60 and not 6.
Using 6 degrees of freedom. The total of 60 fixes the last count, so there are 5.
Taking a parameter as lost when none was estimated. With the model given in full, the degrees of freedom are the categories minus one.
Saying the die is certainly fair. Not rejecting leaves the claim standing; it does not prove it.
A games club’s suspect die
In the application below, a die is thrown 120 times. A fair die expects 20 of each score, and the same six gaps, squares and degrees of freedom decide whether the club has evidence against it.
Worked example: A Games Club's Suspect Die Thrown 120 Times and Tested for Fairness
Question A games club suspects that one of its dice is not fair. It is thrown 120 times, and the scores 1 to 6 come up 14, 22, 18, 26, 17 and 23 times. (a) Find the expected frequencies if the die is fair, and the value of χ2. (b) Test at the 5% level whether the die is fair, and state the conclusion in context.
1.H0: the die is fair, so each score has probability 16. H1: the die is not fair. The expected frequency of each score is 120 × 16 = 20.
The bars are the observed frequencies; the dashed line is the expected frequency of 20 for a fair die. 2.The differences O − E are −6, 2, −2, 6, −3 and 3, which add up to 0 as they must. Their squares are 36, 4, 4, 36, 9 and 9, a total of 98.
Each bar's distance from the line is O − E; the distances add up to 0 and their squares to 98. 3.(a) Every expected frequency is 20, so χ2 = 9820 = 4.9.
(a) All six expected frequencies are 20, so χ2 = 9820 = 4.9. 4.There are 6 classes and one constraint, that the frequencies add up to 120, so there are 6 − 1 = 5 degrees of freedom. The critical value of χ2(5) at the 5% level is 11.070.
Six classes and one constraint leave 5 degrees of freedom; 5% of χ2(5) lies beyond 11.070. 5.(b) 4.9 < 11.070, so do not reject H0. There is not enough evidence at the 5% level that the die is unfair: differences as large as these often happen with a fair die in 120 throws. Had the statistic been above 11.070, the club would have had evidence that the die is biased.
(b) 4.9 is well outside the critical region, so do not reject H0: there is not enough evidence that the die is unfair.
Answer: (a) each expected frequency is 20, and χ2 = 4.9; (b) 4.9 < 11.070 on 5 degrees of freedom, so do not reject H0: there is not enough evidence that the die is unfair
Common mistakes
- Using 6 degrees of freedom, one for each score. The six expected frequencies must add up to 120, which fixes the last one, so there are 5.
- Concluding that the test has proved the die is fair. Not rejecting H0 only means that 120 throws give no clear evidence against fairness; a small bias could still be there.