I have two glm, one with a gaussian distribution and identity link and one with gamma family and log link. The predictors are the same, the only thing that change is the response that in the gaussian glm is log-transformed and in the gamma glm is not.
The deviance is lower in the second model, and when plotting the residuals the second model looks much better than the first. However, when looking and the AIC, the first model has half the AIC of the second! How is that possible? Is it wrong to compare AIC of glm with different distribution families?
summary(mod1)
Call:
glm(formula = log_RS ~ DIET + log_Disp + log_II + log_LS + log_SM +
log_AS + log_LONG, family = gaussian)
Deviance Residuals:
Min 1Q Median 3Q Max
-5.1050 -0.2672 0.1063 0.3945 1.3012
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.061888 0.008574 123.856 < 2e-16 ***
DIETOH -0.077913 0.012762 -6.105 1.07e-09 ***
log_Disp 1.529989 0.006960 219.822 < 2e-16 ***
log_II -0.422808 0.006786 -62.310 < 2e-16 ***
log_LS 0.325270 0.006093 53.382 < 2e-16 ***
log_SM -0.268292 0.008372 -32.048 < 2e-16 ***
log_AS 0.185077 0.010166 18.205 < 2e-16 ***
log_LONG 0.067347 0.010494 6.418 1.45e-10 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for gaussian family taken to be 0.3246263)
Null deviance: 24060.5 on 9345 degrees of freedom
Residual deviance: 3031.4 on 9338 degrees of freedom
AIC: 16018
Number of Fisher Scoring iterations: 2
> summary(mod2)
Call:
glm(formula = RS ~ DIET + log_Disp + log_II + log_LS + log_SM +
log_AS + log_LONG, family = Gamma(link = log))
Deviance Residuals:
Min 1Q Median 3Q Max
-2.94338 -0.35264 -0.00239 0.27669 1.40915
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.186181 0.006435 184.332 < 2e-16 ***
DIETOH -0.075002 0.009579 -7.830 5.41e-15 ***
log_Disp 1.536406 0.005224 294.104 < 2e-16 ***
log_II -0.364580 0.005093 -71.585 < 2e-16 ***
log_LS 0.306213 0.004573 66.955 < 2e-16 ***
log_SM -0.233847 0.006283 -37.216 < 2e-16 ***
log_AS 0.156994 0.007630 20.575 < 2e-16 ***
log_LONG 0.053129 0.007876 6.745 1.62e-11 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for Gamma family taken to be 0.1828775)
Null deviance: 23484.5 on 9345 degrees of freedom
Residual deviance: 2349.8 on 9338 degrees of freedom
AIC: 33167
Number of Fisher Scoring iterations: 8
>