Chi-Squared Test Details
If we flip a coin 100 times and we get 60 heads and 40 tails, is the coin fair? The simplest way of testing this is using a z-score, which has the following formula.
We can then calculate the z-score as follows.
Using the normal curve (also known as a "bell curve"), we can use this z-score to make an educated guess as to whether the coin is fair or not.
What if we try to use a chi-squared test instead? The chi-squared statistic has the following formula.
For the coin flipping case, we get the following value.
Notice how in this case, . When the statistic has one degree of freedom, it is equivalent to the square of the statistic.
Let's verify this relationship with several examples. The table below shows various coin flip scenarios and compares with :
| Pr(Heads) | Heads | Tails | z² | χ² | |z² - χ²| |
|---|---|---|---|---|---|
| 0.10 | 60 | 40 | 277.78 | 277.78 | 0.00 |
| 0.20 | 60 | 40 | 100.00 | 100.00 | 0.00 |
| 0.30 | 60 | 40 | 42.86 | 42.86 | 0.00 |
| 0.40 | 60 | 40 | 16.67 | 16.67 | 0.00 |
| 0.50 | 60 | 40 | 4.00 | 4.00 | 0.00 |
| 0.60 | 60 | 40 | 0.00 | 0.00 | 0.00 |
| 0.70 | 60 | 40 | 4.76 | 4.76 | 0.00 |
| 0.80 | 60 | 40 | 25.00 | 25.00 | 0.00 |
| 0.90 | 60 | 40 | 100.00 | 100.00 | 0.00 |