2

Let's say I fit the following two models in R:


mod.a = glm(log(mpg) ~ log(wt), data = mtcars, family = gaussian)

mod.b = glm(mpg ~ wt, data = mtcars, family = Gamma)

and I want to compare these two models in terms of AIC. I know the response has different distributions for the two models, hence in order to compare the AIC values some transform of the AIC must be made. Hence I'm wondering how the AIC values can be transformed so that the two models can be compared with AIC?

@probabilityislogic discusses this in their answer in this thread Prerequisites for AIC model comparison but they do not disclose much details of how the transformation is actually derived.

Pame
  • 321
  • There is a comment under that answer that cites a particular section of Burnham & Anderson's book; have you checked it out? – Richard Hardy Oct 25 '22 at 11:23
  • @RichardHardy Yes I checked it out. From what I can gather it is essentially just saying that models with different response variables cannot be compared with AIC. – Pame Oct 25 '22 at 11:36
  • @Pame The answer by probabilityislogic to the question you link to gives the correct answer (that is, you need to add the log of the Jacobian determinant $-\sum \ln y_i$ to the LM log-likelihood). – Jarle Tufto Oct 25 '22 at 13:10
  • @JarleTufto Is this not only when comparing two linear models with Gaussian likelihoods, where the response in one of the models is logged? Since one of the models I'm considering has a Gamma distributed response and the other log-normal I'm assuming there is some other Jacobian determinant to consider? – Pame Oct 25 '22 at 13:21
  • 1
    No, it works as long as the models are density functions for the same data $y_1,y_2,\dots,y_n$. The maximum likelihood based on log transformed $y_i$ is $L_{\ln y_i}(\hat\theta)=\prod f_{\ln Y_i}(\ln y_i;\hat\theta)$ (logLik(mod.a)), however. What you need is the likelihood implied by the LM on the original scale, $L_{y_i}(\hat\theta)=\prod f_{Y_i}(y_i;\hat\theta)$ which differs by a factor of $\prod \frac{d\ln y_i}{d y_i}=\prod 1/y_i$ from what you get when fitting the LM. – Jarle Tufto Oct 25 '22 at 13:45
  • @JarleTufto So you can compare the AIC of any two GLM's regardless of which distribution the response has, as long as the two are not normal and log-normal? I can see that the difference in the likelihood between the normal and log-normal is this $\prod 1/y_i$ term, but seems strange to me that only when comparing normal and log-normal GLM's with AIC you need to add the log of a Jacobian determinant. But for the normal and gamma GLM's which have completely different likelihoods there is no such need. – Pame Oct 25 '22 at 18:27

0 Answers0