[R] Generalized linear models
David Winsemius
dwinsemius at comcast.net
Tue Apr 28 00:46:28 CEST 2009
On Apr 27, 2009, at 5:19 PM, mathallan wrote:
>
> I have to fit a generalized linear model in R, and I have never done
> this
> before, so I'm in very much doubt.
>
> I have a dataset (of 4036 observations)
>
> claims sum grp
> 1 3852 34570293 1
> 2 1194 7776468 1
> 3 3916 26343305 1
> 4 1258 5502915 1
> 5 11594 711453346 1
> ...
>
> there are 4 groups (grp).
>
> The task is to determine the effect of sum and grp (and interactions
> between
> them) on the claims.
>
> I have to test using different link functions and distributions
>
>
> What I think I should do is (in R)
>
>> glm(claims~sum*grp, family=gaussian(link="log"))
>
> Call: glm(formula = claims ~ sum * grp, family = gaussian(link =
> "log"))
>
> Coefficients:
> (Intercept) sum grp sum:grp
> 1.215e+01 -4.466e-09 6.814e-02 5.294e-09
>
> Degrees of Freedom: 4035 Total (i.e. Null); 4032 Residual
> Null Deviance: 3.371e+16
> Residual Deviance: 3.355e+16 AIC: 131500
>
>
> Is this right? And how can the output be interpreted?
It is very difficult to determine "rightness" since you have omitted
essential background information. The most glaring omission is what
sort of data is in "sum". If this is either the number of policies or
the dollar amount at risk then a categorical "NO" is the answer to the
question.
>
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list