[R] glm.nb, anova.negbin

Ben Bolker ben at zoo.ufl.edu
Wed Sep 26 15:42:30 CEST 2001


On Wed, 26 Sep 2001, juli g. pausas wrote:

> OK, sorry for asking too much. I just thought maybe I was also helping the developers
> in locating a bug.
>
> I'm a basic user of R, and I don't really know what's a patch and how to generate a
> patch. So please apologise if I don't report  the patch to you.
> I've been able to skip the first bug by masking the function "print.summary.negbin" of
> MASS with the same fuction (and the same name) but with the modifications you suggested
> me (moving brakets). Sure it's not the best way but it works. Don't know yet how to
> solve the second one.
> Thanks
>
> juli
>

  A "patch" would be a change in the underlying R code that fixed the
problem.
  The best thing for helping to solve the second problem (if you're not up
to digging in and debugging it yourself) would be to provide a simple
example that replicates the bug, that people can run themselves.  This can
be hard if the error only occurs with particular (large) datasets, or in
the middle of a complicated analysis, but in this case I think it's not
too bad:

library(MASS)
tax <- rnbinom(10,mu=1,size=1)
areal <- runif(10)
tanual <- runif(10)
t <- glm.nb(tax ~ areal)  ## ignore warning messages about convergence
t2 <- update(t, .~ .+tanual) ## ditto
anova(t,t2)  ## OK
anova(t)  ## OK
anova(t2)

This replicates the error on my system (1.3.1, i686-pc-linux-gnu).

After getting the error, run

traceback()

to see where the error is coming from -- then

debug(anova.glm)

to step through the code one line at a time

The procedure crashes because method is NULL and nvars==1 when we hit the
following code in anova.glm():

    if (nvars > 1) {
       method <- object$method
       if (!is.function(method))
           method <- get(method, mode = "function")
   ...

 I don't have time to trace the problem further right now -- I don't blame
you for not being able to debug this, though, it does get into the middle
of some pretty hairy R code ...

  Ben Bolker





-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list