Dear R-collegues, I'm getting an error message (Error in round) when summarising a glm.nb model, and when using anova.negbin (in R 1.3.1 for windows):> m.nb <- glm.nb(tax ~ areal) > m.bnCall: glm.nb(formula = tax ~ areal, init.theta = 5.08829537115498, link = log) Coefficients: (Intercept) areal 3.03146 0.03182 Degrees of Freedom: 283 Total (i.e. Null); 282 Residual Null Deviance: 353.3 Residual Deviance: 293.3 AIC: -2334000> summary(m.nb)Call: glm.nb(formula = tax ~ areal, init.theta = 5.08829537115498, link = log) Deviance Residuals: Min 1Q Median 3Q Max -2.7107 -0.8313 -0.1159 0.5866 1.9634 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 3.031460 0.445165 6.810 9.78e-12 *** areal 0.031819 0.004151 7.666 1.78e-14 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 (Dispersion parameter for Negative Binomial(5.0883) family taken to be 1) Null deviance: 353.34 on 283 degrees of freedom Residual deviance: 293.34 on 282 degrees of freedom AIC: -2334394 Number of Fisher Scoring iterations: 1 Correlation of Coefficients: (Intercept) areal -0.9982 Error in round(x$theta, dp, nsmall = dp) : unused argument(s) (nsmall ...)> anova.negbin(m.nb)Error in get(x, envir, mode, inherits) : invalid first argument In addition: Warning message: tests made without re-estimating theta in: anova.negbin(m.nb)>Any suggestion of why I'm getting this error? Many thanks Juli -- Juli G. Pausas Centro de Estudios Ambientales del Mediterraneo (CEAM) C/ C.R. Darwin 14, Parc Tecnologic, 46980 Paterna, Valencia, SPAIN Tel: (+ 34) 96 131 8227; Fax: (+ 34) 96 131 8190 mailto:juli at ceam.es http://www.gva.es/ceam GCTE Fire Network - http://www.gva.es/ceam/FireNetwork -------------- next part -------------- An HTML attachment was scrubbed... URL: https://stat.ethz.ch/pipermail/r-help/attachments/20010925/5dbae6ec/attachment.html
On Tue, 25 Sep 2001, juli g. pausas wrote:> Dear R-collegues, > I'm getting an error message (Error in round) when summarising a glm.nb > model, and when using anova.negbin (in R 1.3.1 for windows): > > > m.nb <- glm.nb(tax ~ areal) > > m.bn > Call: glm.nb(formula = tax ~ areal, init.theta = 5.08829537115498, > link = log) > > Coefficients: > (Intercept) areal > 3.03146 0.03182 > > Degrees of Freedom: 283 Total (i.e. Null); 282 Residual > Null Deviance: 353.3 > Residual Deviance: 293.3 AIC: -2334000 > > > summary(m.nb) > > Call: > glm.nb(formula = tax ~ areal, init.theta = 5.08829537115498, > link = log) > > Deviance Residuals: > Min 1Q Median 3Q Max > -2.7107 -0.8313 -0.1159 0.5866 1.9634 > > Coefficients: > Estimate Std. Error z value Pr(>|z|) > (Intercept) 3.031460 0.445165 6.810 9.78e-12 *** > areal 0.031819 0.004151 7.666 1.78e-14 *** > --- > Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 > > (Dispersion parameter for Negative Binomial(5.0883) family taken to be > 1) > > Null deviance: 353.34 on 283 degrees of freedom > Residual deviance: 293.34 on 282 degrees of freedom > AIC: -2334394 > > Number of Fisher Scoring iterations: 1 > > Correlation of Coefficients: > (Intercept) > areal -0.9982 > > Error in round(x$theta, dp, nsmall = dp) : > unused argument(s) (nsmall ...) > > > anova.negbin(m.nb) > Error in get(x, envir, mode, inherits) : invalid first argument > In addition: Warning message: > tests made without re-estimating theta in: anova.negbin(m.nb) > > > > Any suggestion of why I'm getting this error?Because there is a copying error in lines cat("\n Theta: ", format(round(x$theta, dp, nsmall=dp)), "\n Std. Err.: ", format(round(x$SE.theta, dp, nsmall=dp)), "\n") if(!is.null(x$th.warn)) cat("Warning while fitting theta:", x$th.warn,"\n") cat("\n 2 x log-likelihood: ", format(round(x$twologlik, 3, nsmall=dp)), "\n Move the second ) before the nsmall. Or just use the debugging tools to find it ....> Many thanks > > Juli > > > -- > Juli G. Pausas > Centro de Estudios Ambientales del Mediterraneo (CEAM) > C/ C.R. Darwin 14, Parc Tecnologic, > 46980 Paterna, Valencia, SPAIN > Tel: (+ 34) 96 131 8227; Fax: (+ 34) 96 131 8190 > mailto:juli at ceam.es > http://www.gva.es/ceam > > GCTE Fire Network - http://www.gva.es/ceam/FireNetwork > >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Prof Brian Ripley escribi?:> On Wed, 26 Sep 2001, juli g. pausas wrote: > > > > > > > > > Any suggestion of why I'm getting this error? > > > > > > Because there is a copying error in lines > > > > > > cat("\n Theta: ", format(round(x$theta, dp, nsmall=dp)), > > > "\n Std. Err.: ", format(round(x$SE.theta, dp, > > > nsmall=dp)), > > > "\n") > > > if(!is.null(x$th.warn)) > > > cat("Warning while fitting theta:", x$th.warn,"\n") > > > cat("\n 2 x log-likelihood: ", format(round(x$twologlik, 3, > > > nsmall=dp)), "\n > > > > > > Move the second ) before the nsmall. > > > > > > Or just use the debugging tools to find it .... > > > > > > > Thank you very much. > > Also, it seems to me that anova.negbin is not working properly when testing a > > single model (although the help suggest that it can be used for a single model > > too). I have no problem when comparing different fitted models. > > > > > t <- glm.nb(tax ~ areal) > > > t2 <- update(t, .~. + tanual) > > > anova(t, t2) # OK > > [...] > > > anova(t2) > > Error in get(x, envir, mode, inherits) : invalid first argument > > In addition: Warning message: > > tests made without re-estimating theta in: anova.negbin(t2) > > > > Any other suggestion? Many thanks > > Let me repeat: > > Or just use the debugging tools to find it .... > > and then report the patch to me. I can't debug your examples, nor is > it reasonable to expect me to. >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> The other bug has been there for at least 6 months, so it looks as if > noone else is using this. > > > > > Juli > > > > > > > -- > > > Brian D. Ripley, ripley at stats.ox.ac.uk > > > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > > > University of Oxford, Tel: +44 1865 272861 (self) > > > 1 South Parks Road, +44 1865 272860 (secr) > > > Oxford OX1 3TG, UK Fax: +44 1865 272595 > > > > > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > > > 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 > > > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ > > > > -- > > Juli G. Pausas (Mr) > > Centro de Estudios Ambientales del Mediterraneo (CEAM) > > C/ C.R. Darwin 14, Parc Tecnologic, > > 46980 Paterna, Valencia, SPAIN > > Tel: (+ 34) 96 131 8227; Fax: (+ 34) 96 131 8190 > > mailto:juli at ceam.es > > http://www.gva.es/ceam > > > > GCTE Fire Network - http://www.gva.es/ceam/FireNetwork > > > > > > > > -- > Brian D. Ripley, ripley at stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272860 (secr) > Oxford OX1 3TG, UK Fax: +44 1865 272595-- Juli G. Pausas (Mr) Centro de Estudios Ambientales del Mediterraneo (CEAM) C/ C.R. Darwin 14, Parc Tecnologic, 46980 Paterna, Valencia, SPAIN Tel: (+ 34) 96 131 8227; Fax: (+ 34) 96 131 8190 mailto:juli at ceam.es http://www.gva.es/ceam GCTE Fire Network - http://www.gva.es/ceam/FireNetwork -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._