[R] Overdispersed poisson - negative observation

vito muggeo vito.muggeo at giustizia.it
Thu Jan 16 17:19:58 CET 2003


Roughtly speaking, your code is correct, but you can not fit your data with
negative value:

> glm.qD93 <- glm(paym ~ alpha + beta, family=quasipoisson())
Error in eval(expr, envir, enclos) : Negative values not allowed for the
quasiPoisson family

Anyway, in general, quasi-likelihood is a way to handle (low) overdispersion
in count data: for modest or large amount of overdispersion you could use
negative binomial models, namely glm.nb() in MASS or gnlr() in the Jim
Lindsey packages.

best,
vito



----- Original Message -----
From: <peter.fledelius at wgo.royalsun.com>
To: <r-help at stat.math.ethz.ch>
Sent: Thursday, January 16, 2003 4:45 PM
Subject: [R] Overdispersed poisson - negative observation


> Dear R users
>
> I have been looking for functions that can deal with overdispersed poisson
> models. Some (one) of the observations are negative. According to
actuarial
> literature (England & Verall, Stochastic Claims Reserving in General
> Insurance , Institute of Actiuaries 2002) this can be handled through the
> use of quasi likelihoods instead of normal likelihoods. The presence of
> negatives is not normal in a poisson model, however, we see them
frequently
> in this type of data, and we would like to be able to fit the model
anyway.
>
> At the moment R is complaining about negative values and the link function
> = log.
>
> My code looks like this. Do any of you know if this problem can be solved
> in R? Any suggestions are welcomed.
>
> Kind regards,
>
> Peter Fledelius (new R user)
>
> *********** Code ************
> paym   <- c(5012, 3257, 2638,  898, 1734, 2642, 1828,  599,   54,  172,
>              106, 4179, 1111, 5270, 3116, 1817, -103,  673,  535,
>             3410, 5582, 4881, 2268, 2594, 3479,  649,  603,
>             5655, 5900, 4211, 5500, 2159, 2658,  984,
>             1092, 8473, 6271, 6333, 3786,  225,
>             1513, 4932, 5257, 1233, 2917,
>              557, 3463, 6956, 1368,
>             1351, 5596, 6165,
>             3133, 2262,
>             2063)
> alpha   <- factor(c(1,1,1,1,1,1,1,1,1,1,
>              2,2,2,2,2,2,2,2,2,
>              3,3,3,3,3,3,3,3,
>              4,4,4,4,4,4,4,
>              5,5,5,5,5,5,
>              6,6,6,6,6,
>              7,7,7,7,
>              8,8,8,
>              9,9,
>              10))
> beta    <- factor(c(1,2,3,4,5,6,7,8,9,10,
>              1,2,3,4,5,6,7,8,9,
>              1,2,3,4,5,6,7,8,
>              1,2,3,4,5,6,7,
>              1,2,3,4,5,6,
>              1,2,3,4,5,
>              1,2,3,4,
>              1,2,3,
>              1,2,
>              1))
> d.AD <- data.frame(paym, alpha, beta)
> glm.qD93 <- glm(paym ~ alpha + beta, family=quasipoisson())
> glm.qD93
> ************ Code end ***************
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list