# Denominator term in Chi-Square-Test for association in a contingency table

The general formula for the Chi Square Test for association in a contingency table with $I$ rows and $J$ columns, and cell counts $n_{ij}$ is $$\chi^2 = \sum_{i=1}^I \sum_{j=1}^J \frac{(n_{ij} - n_{ij}^*)^2}{n_{ij}^*}$$ where $$n_{ij}^* = \frac{n_{i\cdot} \cdot n_{\cdot j}}{n}$$ denotes the expected frequency. That the difference between expected value (in case of independence) and observed value is taken into account is totally clear, but where does the denominator term comes from? Can someone please explain why we need to divide by $n_{ij}^*$ each squared difference?

• – whuber
Dec 15, 2014 at 19:18

Suppose you conducted a survey to see if having blue eyes was related to knowledge of Stackexchange, and you surveyed 100 people at random at the mall. Let say you found a table like this: $$\begin{array}{lll} & \mbox{Blue} & \mbox{Not blue} \\ \mbox{Stackexchange yes} & 20 & 30 \\ \mbox{Stackexchange no} & 30 & 20. \end{array}$$ The expected counts are 25, all around, and your deviations are $$\begin{array}{lll} & \mbox{Blue} & \mbox{Not blue} \\ \mbox{Stackexchange yes} & -5 & 5 \\ \mbox{Stackexchange no} & 5 & -5. \end{array}$$
Now, suppose we conducted the survey again, this time asking 1000 people, and found the following contigency table: $$\begin{array}{lll} & \mbox{Blue} & \mbox{Not blue} \\ \mbox{Stackexchange yes} & 245 & 255 \\ \mbox{Stackexchange no} & 255 & 245 \end{array}$$ which of course, also yields proportional expected values of 250, and the same deviations of $\pm 5$.