[R] GLM quasipoisson error
bolker at ufl.edu
Mon Oct 5 23:31:06 CEST 2009
> I'm having an error when trying to fit the next GLM:
>>>model<-glm(response ~ CLONE_M + CLONE_F + HATCHING
> +(CLONE_M*CLONE_F) + (CLONE_M*HATCHING) + (CLONE_F*HATCHING) +
> (CLONE_M*CLONE_F*HATCHING), family=quasipoisson)
>>> anova(model, test="Chi")
>>Error in if (dispersion == 1) Inf else object$df.residual :
> missing value where TRUE/FALSE needed
> If I fit the same model by using the Poisson distribution, it works.
> I have not a clue about where the problem could be. Do you have any
> idea or suggestion I could try?
It would help if you gave a reproducible example.
The following simple example seems to work.
> x = runif(100)
> y = rpois(100,x)
> mq = glm(y~x,family="quasipoisson")
Other points: (1) I think you're a little bit confused about
R model notation. * means "main effects and all interactions",
: means "interaction only". You could rewrite your model
more correctly as
model<-glm(response ~ CLONE_M + CLONE_F + HATCHING
+(CLONE_M:CLONE_F) + (CLONE_M:HATCHING) + (CLONE_F:HATCHING) +
or even better (compactly) as
model<-glm(response ~ CLONE_M*CLONE_F*HATCHING,
although all three ways give equivalent answers since the extra
main-effect terms get dropped silently.
(2) you should probably use test="F" rather than test="Chisq"
for a quasi- model: see Crawley 2002 and/or Venables and Ripley.
View this message in context: http://www.nabble.com/GLM-quasipoisson-error-tp25754404p25757025.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help