Likelihood-ratio test of independence in a contingency table
= Likelihood-ratio test of independence in a contingency table
For observed counts $y_{ij}$ and fitted counts $\widehat\mu_{ij}=y_{i+}y_{+j}/y_{++}$ under independence, the likelihood-ratio statistic is
$$
G^2=2\sum_{i,j:y_{ij}>0}y_{ij}\log\frac{y_{ij}}{\widehat\mu_{ij}}.
$$
Under independence and standard large-sample regularity conditions, $G^2$ converges in distribution to $\chi^2_{(r-1)(c-1)}$.