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