Skip to content

glm.nb, anova.negbin

5 messages · juli g. pausas, Brian Ripley, Danardono +1 more

#
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):
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
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 ...)
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:

            
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.
[...]
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

Juli
--
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Hello,

Given this list object x,
x <-
structure(list("772307" = structure(list(age.day = c(81, 141,
234, 321, 437, 499, 601, 689, 801, 884, 961), state = c(0, 0,
0, 0, 0, 0, 1, 1, 0, 99, 1)), .Names = c("age.day", "state"), class =
"data.frame", row.names = c("1",
"2", "3", "4", "5", "6", "7", "8", "9", "10", "11")), "1084506" =
structure(list(
    age.day = c(80, 148, 249, 344), state = c(0, 0, 99, 99)), .Names =
c("age.day",
"state"), class = "data.frame", row.names = c("1", "2", "3",
"4"))), .Names = c("772307", "1084506"))

that looks like this:
$"772307"
   age.day state
1       81     0
2      141     0
3      234     0
4      321     0
5      437     0
6      499     0
7      601     1
8      689     1
9      801     0
10     884    99
11     961     1

$"1084506"
  age.day state
1      80     0
2     148     0
3     249    99
4     344    99

How to stack "772307" and "1084506", preferrably with "772307" and
$"1084506" as indicator (the original data consists of thousands "ID" such
"772307" and "1084506")?
The expected result will be like,
ID       age.day state
772307       81     0
772307      141     0
772307      234     0
772307      321     0
772307      437     0
772307      499     0
772307      601     1
772307      689     1
772307      801     0
772307      884    99
772307      961     1
1084506      80     0
1084506     148     0
1084506     249    99
1084506     344    99

Thank you.
Danar.




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
"Danardono" <daodao99 at student.umu.se> writes:
This seems to do it:

do.call("rbind",lapply(names(x),function(i)
                                  cbind(ID=rep(i,nrow(x[[i]])),x[[i]])))