2
$\begingroup$

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.

$\endgroup$
6
  • $\begingroup$ There is a comment under that answer that cites a particular section of Burnham & Anderson's book; have you checked it out? $\endgroup$ Commented Oct 25, 2022 at 11:23
  • $\begingroup$ @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. $\endgroup$
    – Pame
    Commented Oct 25, 2022 at 11:36
  • $\begingroup$ @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). $\endgroup$ Commented Oct 25, 2022 at 13:10
  • $\begingroup$ @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? $\endgroup$
    – Pame
    Commented Oct 25, 2022 at 13:21
  • 1
    $\begingroup$ 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. $\endgroup$ Commented Oct 25, 2022 at 13:45

0