[R] Poisson GLM
David Winsemius
dwinsemius at comcast.net
Tue Jan 20 21:16:04 CET 2009
Since one method of modeling rates is to use
glm(... ,family="poisson") with the observed rate (events/
person_time) on the LHS of the formula and offset=log(expected_rates)
on the RHS, I am quite happy that no error is thrown in that situation.
Reading old entries in r-help, it appears there may have been a time
when an error was thrown, but now you just get a warning (assuming
that people were not misreporting what they were seeing). Quasi-
poisson models were recommended as an alternative.
?family
using a distorted version of the family = poisson() example in glm()
help page:
> d.AD[1,3] <- 17.5
> glm.D93 <- glm(counts ~ outcome + treatment, data=d.AD,
family=poisson())
Warning message:
In dpois(y, mu, log = TRUE) : non-integer x = 17.500000
> glm.qD93 <- glm(counts ~ outcome + treatment, data= d.AD,
family=quasipoisson())
#no warning
> coef(glm.qD93)
(Intercept) outcome2 outcome3 treatment2 treatment3
3.02984283 -0.44628710 -0.28501896 0.01005034 0.01005034
>
> coef(glm.D93)
(Intercept) outcome2 outcome3 treatment2 treatment3
3.02984283 -0.44628710 -0.28501896 0.01005034 0.01005034
# although vcov shows a difference
--
David Winsemius
On Jan 20, 2009, at 12:14 PM, bbbnc wrote:
>
> This is a basics beginner question.
>
> I attempted fitting a a Poisson GLM to data that is non-integer ( I
> believe
> Poisson is suitable in this case, because it is modelling counts of
> infections, but the data collected are all non-negative numbers with 2
> decimal places).
>
> My question is, since R doesn't return an error with this glm
> fitting, is it
> important that the data is non-integer. How does R handle the data?
> if there
> is a problem, how do i circumvent this.. data modification?
>
> many thanks
> --
> View this message in context: http://www.nabble.com/Poisson-GLM-tp21567460p21567460.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list