As far as I understood it, chi-square provides a measure for determining the similarity of the expected and observed (empirical and theoretical) distributions of nominal variables. It can be employed, for example, in a goodness-of-fit-test that enables to assign a probability to an observed distribution not having been produced by an expected theoretical distribution.
Consider the following example: variable $X $ can be a
with a probability of 60%, b
with a probability of 30%, and c
with a probability of 10%. We may have observed $X $ being a
55 times, being b
21 times, and being c
16 times. The total number of observations is 55 + 21 + 16 = 92. We can then calculate the chi-square statistics as follows.
$\chi^2 = \frac{(55-.6*92)^2}{.6*92} + \frac{(21-.3*92)^2}{.3*92} + \frac{(16-.1*92)^2}{.1*92} $
$\chi^2 = 0.000724638 + 1.578260870 + 5.0260869570 $
$\chi^2 = 6.605072465 $
If we have, however, only a small number of observations, chi-square does not provide reliable results anymore. This is compensated for by Fisher's exact test and Yates's Correction (see Wikipedia). Without compensation, the following problem occurs. Assume our number of observations to be a
: 2 times, b
: 1 time, and c
: 0 times. The total number of observations now is merely 3.
$\chi^2 = \frac{(2-.6*3)^2}{.6*3} + \frac{(1-.3*3)^2}{.3*3} + \frac{(0-.1*3)^2}{.1*3} $
$\chi^2 = 0.022222222 + 0.011111111 + 0.3 $
$\chi^2 = 0.333333333 $
Although the three observations are distributed as closely as possible according to the expected probabilities, we still observe $0 < \chi^2 $. The first part of my question is: Is the impossibility to distribute discrete occurrences exactly according to given probabilities the reason for chi-square's inability to deal with low frequencies?
Following from this is this thought. If the above gives rise to the problems with lower frequencies, can the expected empirical distribution be constructed from integers instead of floating point numbers? In the case above, the expectations for calculating chi-square could be determined as follows.
- Initially: expected empirical distribution
a
: 0 times,b
: 0 times,c
: 0 times - Sum of probability differences to expected theoretical distribution: $|.0 - .6| + |.0 - .3| + |.0 - .1| = 1 $.
- Adding 1 to
a
changes the differences to $|1. - .6| + |.0 - .3| + |.0 - .1| = .8 $. - Adding 1 to
b
changes the differences to $|0. - .6| + |1. - .3| + |.0 - .1| = 1.4 $. - Adding 1 to
c
changes the differences to $|0. - .6| + |.0 - .3| + |1. - .1| = 1.8 $. - One of the three observations is added to
a
, as it minimizes the difference to the target distribution. - The same is repeated until all observations are 'distributed' and we end up with the expected empirical distribution
a
: 2 times,b
: 1 time,c
: 0 times.
The chi-square value from comparing a sparse observations with such expectations would be $0 $. The second part of my question is: Is this a valid method and does it enable chi-square to handle low frequencies?