# 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 '14 at 19:18

## 1 Answer

The links that whuber provided, especially Why does independence test use the chi-squared distribution? give some mathematical justification, but maybe here's an intuitive explanation for you.

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$.

Now which experiment do you think provides stronger evidence against the null of no association of eye color? With ~250 people per cell, a deviation of 5 counts can more easily come about through the sampling variability, compared to ~25 people per cell. In fact, the adjustment in the denominator of the statistic is precisely what's needed to account for the additional variance (Binomial variance) present for larger cell sizes.