[R] GLM Gamma Family logLik formula?

Skipper Seabold jsseabold at gmail.com
Wed Jul 15 21:07:46 CEST 2009


Hello all,

I was wondering if someone can enlighten me as to the difference
between the logLik in R vis-a-vis Stata for a GLM model with the gamma
family.

Stata calculates the loglikelihood of the model as (in R notation)
some equivalent function of

-1/scale * sum(Y/mu+log(mu)+(scale-1)*log(Y)+log(scale)+scale*lgamma(1/scale))

where scale (or dispersion) = 1, Y = the response variable, and mu is
the fitted values given by the fitted model.

R seems to use a very similar approach, but scale is set equal to the
calculated dispersion for the gamma model.  However, when I calculate
the logLik by hand this way the answer differs slightly (about .5)
from the logLik(glm.m1).

I haven't been able to figure out why looking at the help.  If anyone
has any ideas, the insight would be much appreciated.

Cheers,

Skipper




More information about the R-help mailing list