[Rd] Re: AIC & logLik for glm

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Mon, 17 Sep 2001 19:10:29 +0200


[diverted to R-devel;  I'm really discussing future development]

>>>>> "BDR" == Prof Brian Ripley <ripley@stats.ox.ac.uk> writes:

    BDR> On Tue, 11 Sep 2001, juli g. pausas wrote:
    >> Dear R collegues,
    >> I'm trying to understand what's AIC in R (ver. 1.3.1), and I'm getting a
    >> different answer if I look at the AIC(of the fitted model) or the aic in
    >> the summary( of the fitted model). Is this correct? Can somebody explain
    >> me the difference between the two values? or Is the AIC criterion not
    >> appropiated for Poisson models?

    BDR> It's the AIC _function_ that is inappropriate for glm models.
    BDR> There is no glm method, so the lm method is used.

actually, the AIC.lm() is just from the nlme package and it is very
much appropriate insofar as it entirely builds on logLik() {itself a generic}.
I've found recently, that I'd like to *rename* the current AIC.lm to
AIC.default since it is really correct whenever logLik() is correct.
For a private package, I recently found that I just could do
     AIC.myclass <- AIC.lm (and define a correct  logLik.myclass !!)
where the definition of AIC.myclass would have been unnecessary, had
AIC.lm been called AIC.default.  AIC() would then barf whenever there's no
logLik() method for the given model class which I'd think to be fine (no?)

    BDR> Martin: I think you moved AIC and logLik into base R: this needs
    BDR> sorting out.

yes.  However, I haven't changed the AIC.lm and logLik.lm methods, and the
currrent behavior is just what *was* the former behavior after
library(nlme) had been called, then.

What really needs a fix is logLik.lm(), probably by providing a
logLik.glm() method which seems almost trivial, given the way our glm
families are implemented, the internal aic() function is really -2*logLik(.).
For the quasi "family", the result would be NA, rightly.

BTW, I'm more and more wondering if we shouldn't commit these as patches to
1.3.x rather than only for 1.4..

Martin


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._