[R] glm

Prof Brian D Ripley ripley at stats.ox.ac.uk
Tue Feb 1 09:40:44 CET 2000

On Tue, 1 Feb 2000, Jim Lindsey wrote:

> > 4. I don't think AIC is stricly correct. My understanding of AIC is that
> > it is the log likelihood maximised over all the parameters, including
> > the dispersion parameter. Now the problem is that the mle of the
> > dispersion parameter for the gamma family (and the exponential family in
> > general) is really awkward - I think it has to be found by interative
> > methods, using the derivative of the gamma function - I see from a print
> > of Gamma that you are using dev/n, but I don't think this is the mle....
> Yes you are right. I chose this only as a reasonable approximation for the
> gamma and inverse Gaussian distributions. If you want the exact AIC,
> you can get it from the gnlr function in my gnlm library.

Another way to get the MLE of the dispersion parameter from the glm output
is to use the function gamma.shape.glm (by Bill Venables) in the MASS
package.  Its help says


     A glm fit for a Gamma family correctly calculates the maximum
     likelihood estimate of the mean parameters but provides only a
     crude estimate of the dispersion parameter.  This function takes
     the results of the glm fit and solves the maximum likelihood
     equation for the reciprocal of the dispersion parameter, which is
     usually called the shape (or exponent) parameter.

and yes it is optimized over an expression using the digamma and trigamma
functions, but the code is about 30 lines only including all the warnings
and housekeeping. (Such things show the power of S over GLIM: it would be
`really awkward' in GLIM.)

Note, though, that McCullagh and Nelder argue hard against the MLE of
dispersion in the gamma family.


Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help 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-help-request at stat.math.ethz.ch

More information about the R-help mailing list