2

Can $G^2$ statistic of log-linear (unsaturated) model in contingency tables be negative? Since saturated model with perfect fit has $G^2=0$ I don't think the unsaturated models can get negative $G^2$. In need of insight, since I might have run into some miscalculations.

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
Nuclear03020704
  • 730
  • 4
  • 18
  • 1
    Depending on the order I’ve entered models in some R functions, I’ve run issues like this. – Dave May 04 '20 at 13:36

1 Answers1

0

Note from Wikipedia that the $G^2$-statistic has the form of (twice) a Kullback-Leibler divergence, see Why is Kullback Leibler Divergence always positive?. More precisely $$ \DeclareMathOperator{\KL}{KL} G^2 = 2\sum_i O_i \log\frac{O_i}{E_i}=2N\KL\left(\frac{O_i}{N} || \frac{E_i}{N} \right) $$ where $N$ is the total count. It is also related to the deviance in generalized linear models, and is in fact the Deviance (in R terminology, Null deviance - Residual deviance) in a logistic regression model for the contingency table.

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467