Re: [R] GLM quasipoisson error

2009-10-06 Thread Alain Zuur



atorso wrote:
 
 Hello,
 
 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)
 
 
 
 
 
 I guess that those variables are factors, and that you have empty
 combinations? Make a coplot, and see whether you have data for all
 combinations of the levels of your factors. Formulated differently..does
 it make sense, or is it possible to fit the 3-way interaction for your
 data?
 
 Also..you may want to use the str command to see whether response is
 indeed coded correctly.
 
 Alain
 
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?
 
 Thank you in advance, 
 
 Ana 
 
 __
 R-help@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.
 
 


-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://www.nabble.com/GLM-quasipoisson-error-tp25754404p25770491.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


[R] GLM quasipoisson error

2009-10-05 Thread atorso
Hello,

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?

Thank you in advance, 

Ana 

__
R-help@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.


Re: [R] GLM quasipoisson error

2009-10-05 Thread Ben Bolker



atorso wrote:
 
 Hello,
 
 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)
 anova(mq,test=Chi)

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) +
(CLONE_M:CLONE_F:HATCHING), family=quasipoisson)

or even better (compactly) as 

model-glm(response ~  CLONE_M*CLONE_F*HATCHING, 
family=quasipoisson)

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.

__
R-help@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.