Chi-Squared Test for Goodness of Fit/Examples/Cast of Dice

From ProofWiki
Jump to navigation Jump to search



Example of Use of Chi-Squared Test for Goodness of Fit

Let $D$ be a die which we want to determine is fair or not.

Let $D$ be cast $96$ times.

Then:

$x_i \in \set {1, 2, 3, 4, 5, 6}$

If $D$ is fair, then for all $i$, the number of times we expect to observe each face of $D$ is:

$E_i = 96 \times \dfrac 1 6 = 16$

Suppose in our trial, the number of times each face comes up is shown in the table below:

\(\ds O_1\) \(=\) \(\ds 14\)
\(\ds O_2\) \(=\) \(\ds 19\)
\(\ds O_3\) \(=\) \(\ds 11\)
\(\ds O_4\) \(=\) \(\ds 21\)
\(\ds O_5\) \(=\) \(\ds 12\)
\(\ds O_6\) \(=\) \(\ds 19\)

Then:

\(\ds \chi^2\) \(=\) \(\ds \sum_{i \mathop = 1}^6 \dfrac {\paren {O_i - E_i}^2} {E_i}\)
\(\ds \) \(=\) \(\ds \dfrac {\paren {14 - 16}^2} {16} + \dfrac {\paren {19 - 16}^2} {16} + \dfrac {\paren {11 - 16}^2} {16} + \dfrac {\paren {21 - 16}^2} {16} + \dfrac {\paren {12 - 16}^2} {16} + \dfrac {\paren {19 - 16}^2} {16}\)
\(\ds \) \(=\) \(\ds \dfrac 4 {16} + \dfrac 9 {16} + \dfrac {25} {16} + \dfrac {25} {16} + \dfrac {16} {16} + \dfrac 9 {16}\)
\(\ds \) \(=\) \(\ds \dfrac {88} {16}\)
\(\ds \) \(=\) \(\ds 5.5\)

The expectation of $16$ is computed from the data, so there are $6 - 1 = 5$ degrees of freedom.



The $\chi^2$ value is not significant at the $5 \%$ level (i.e. is $< 11.07$), so the hypothesis that $D$ is fair is not rejected.

Chi squared.png


Sources