Closed damianooldoni closed 4 years ago
It means the model didn't converge to meaningfull model parameters. Most probably due to poor data. Right now the algorithm will return 'unclear'. It's better to return 'NA'. I'll adapt the spGAMxxx functions
To do this, I suggest to use tryCatch then. As up to now the try() doesn't catch any warning. See example:
x <- function(i){
if (i < 10) warning("A warning")
i
}
tt <- tryCatch(x(5),error=function(e) e, warning=function(w) w)
tt2 <- tryCatch(x(15),error=function(e) e, warning=function(w) w)
More about this example in StackOverflow link.
Doing it with a try() is also possible (see solution in same link), but we will not have a difference in output between warning and error, and the solution is quite ugly, I find.
@ToonVanDaele : I am implementing it in this way, maybe you can find it useful:
result <- tryCatch(expr = {
model <- gam(formula = fm,
family = nb(),
data = df,
method = "REML")
}, error=function(e) e, warning=function(w) w)
#.... some other code...
if (class(result)[1] %in% c("simpleWarning", "simpleError")) {
} else {
}
On my laptop I need tryCatch to avoid using GAM output if warning arises. Still, close this issue if you solved it.
changed try to tryCatch. Works fine now. Thanks.
I get this warning while applying GAM to "lumped" data of
taxonKey
1713034 using methodGAM_lcount_cobs
:Is this something should we worry about it?