[R] I have some problem about GLM function.

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jan 10 13:19:49 CET 2005


On Sun, 9 Jan 2005, may sawasdee wrote:

> Dear R-Help
>
> I 'm using GLM function to Modelling. But when I used Gamma Family in GLM, then I can't run.
> It was error
>
>> glm(DamageRatio~MinTEMP+MaxTEMP+DayRain+Group1+Group2+Group3+Year,family=Gamma())
> Error in eval(expr, envir, enclos) : Non-positive values not allowed for the gamma family
>
> Can Gamma Distribution use data begin 0 ?

No,  That is an impossible value from a gamma distribution: see ?dgamma 
and note what it says about x.

> and then when I used GLM in S-Plus Program then it done, but it didn't have AIC value.
>
> Last Question why are not the AIC in R and S-plus equal.

You have just said S-Plus does not have an AIC value.! However, since a 
gamma GLM is not fitted by ML, you cannot get AIC from a glm fit unless 
you specify the dispersion (unlikely).  Did you notice what ?glm says 
about the aic component?  See also ?logLik.

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list