# The Chi-Square Statistic Formula and How to Use It

The chi-square statistic measures the difference between actual and expected counts in a statistical experiment. These experiments can vary from two-way tables to multinomial experiments. The actual counts are from observations, the expected counts are typically determined from probabilistic or other mathematical models.

## The Formula for Chi-Square Statistic

In the above formula, we are looking at n pairs of expected and observed counts. The symbol ek denotes the expected counts, and fk denotes the observed counts. To calculate the statistic, we do the following steps:

1. Calculate the difference between corresponding actual and expected counts.
2. Square the differences from the previous step, similar to the formula for standard deviation.
3. Divide every one of the squared difference by the corresponding expected count.
4. Add together all of the quotients from step #3 in order to give us our chi-square statistic.

The result of this process is a nonnegative real number that tells us how much different the actual and expected counts are. If we compute that χ2 = 0, then this indicates that there are no differences between any of our observed and expected counts. On the other hand, if χ2 is a very large number then there is some disagreement between the actual counts and what was expected.

An alternate form of the equation for the chi-square statistic uses summation notation in order to write the equation more compactly. This is seen in the second line of the above equation.

## Calculating the Chi-Square Statistic Formula

To see how to compute a chi-square statistic using the formula, suppose that we have the following data from an experiment:

• Expected: 25 Observed: 23
• Expected: 15 Observed: 20
• Expected: 4 Observed: 3
• Expected: 24 Observed: 24
• Expected: 13 Observed: 10

Next, compute the differences for each of these. Because we will end up squaring these numbers, the negative signs will square away. Due to this fact, the actual and expected amounts may be subtracted from one another in either of the two possible options. We will stay consistent with our formula, and so we will subtract the observed counts from the expected ones:

• 25 – 23 = 2
• 15 – 20 =-5
• 4 – 3 = 1
• 24 – 24 = 0
• 13 – 10 = 3

Now square all of these differences: and divide by the corresponding expected value:

• 22/25 = 0 .16
• (-5)2/15 = 1.6667
• 12/4 = 0.25
• 02/24 = 0
• 32 /13 = 0.5625

Finish by adding the above numbers together: 0.16 + 1.6667 + 0.25 + 0 + 0.5625 = 2.693

Further work involving hypothesis testing would need to be done to determine what significance there is with this value of χ2.