[R] glm.nb stop on Error.
Ronaldo Reis Jr.
chrysopa at insecta.ufv.br
Tue Nov 9 14:01:34 CET 2004
Hi,
I make an analysis sequence on R. In some cases the function glm.nb fail to
ajust the model. Its Ok. The problem is that this error stop the program. I
need treat this error and not stop the program. Something like this:
...
model <- glm.nb(y~x,maxit=1000)
if(glm.nb fail) {
teste[i] <- 0
}
else {
teste[i] <- anova(modelo)$"P(>|Chi|)"[2]
}
...
I try this:
...
model <- NULL
model <- glm.nb(y~x,maxit=1000)
## When this fail model is not create, then model <- NULL
if(is.null(model)) {
teste[i] <- 0
}
else {
teste[i] <- anova(modelo)$"P(>|Chi|)"[2]
}
...
But the problem is the glm.nb error stop the program.
Any idea?
Thanks
Ronaldo
--
Existe uma diferença entre o acidente e a catástrofe. O acidente é quando cai
o avião. A catástrofe é quando morre todo mundo
--Pelé
--
|> // | \\ [***********************************]
| ( õ õ ) [Ronaldo Reis Júnior ]
|> V [UFV/DBA-Entomologia ]
| / \ [36571-000 Viçosa - MG ]
|> /(.''`.)\ [Fone: 31-3899-2532 ]
| /(: :' :)\ [chrysopa at insecta.ufv.br ]
|>/ (`. `'` ) \[ICQ#: 5692561 | LinuxUser#: 205366 ]
| ( `- ) [***********************************]
|>> _/ \_Powered by GNU/Debian Woody/Sarge
More information about the R-help
mailing list