Chi-Squared Test for Goodness of Fit/Examples/Cast of Dice
Jump to navigation
Jump to search
![]() | This page has been identified as a candidate for refactoring of medium complexity. In particular: Extract the gist of this into a result to be transcluded, and put the detail into a proof (not transcluded) to streamline main page Until this has been finished, please leave {{Refactor}} in the code.
New contributors: Refactoring is a task which is expected to be undertaken by experienced editors only. Because of the underlying complexity of the work needed, it is recommended that you do not embark on a refactoring task until you have become familiar with the structural nature of pages of $\mathsf{Pr} \infty \mathsf{fWiki}$.To discuss this page in more detail, feel free to use the talk page. When this work has been completed, you may remove this instance of {{Refactor}} from the code. |
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.
![]() | This article, or a section of it, needs explaining. You can help $\mathsf{Pr} \infty \mathsf{fWiki}$ by explaining it. To discuss this page in more detail, feel free to use the talk page. When this work has been completed, you may remove this instance of {{Explain}} from the code. |
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.
Sources
- 1998: David Nelson: The Penguin Dictionary of Mathematics (2nd ed.) ... (previous) ... (next): chi-squared test: 1.
- 2008: David Nelson: The Penguin Dictionary of Mathematics (4th ed.) ... (previous) ... (next): chi-squared test: 1.