# 14.3: χ² Statistic

- Page ID
- 7178

The calculations for our test statistic in \(\chi^{2}\) tests combine our information from our observed frequencies (\(O\)) and our expected frequencies (\(E\)) for each level of our categorical variable. For each cell (category) we find the difference between the observed and expected values, square them, and divide by the expected values. We then sum this value across cells for our test statistic. This is shown in the formula:

\[\chi^{2}=\sum \dfrac{(\mathrm{O}-\mathrm{E})^{2}}{\mathrm{E}} \]

For our pet preference data, we would have:

\[\chi^{2}=\dfrac{(14-12)^{2}}{12}+\dfrac{(17-12)^{2}}{12}+\dfrac{(5-12)^{2}}{12}=0.33+2.08+4.08=6.49 \nonumber \]

Notice that, for each cell’s calculation, the expected value in the numerator and the expected value in the denominator are the same value. Let’s now take a look at an example from start to finish.

## Contributors

Foster et al. (University of Missouri-St. Louis, Rice University, & University of Houston, Downtown Campus)