ibis.iSDM
ibis.iSDM copied to clipboard
Error with threshold on engine_glm and method using "modEvA"
Hello!
I get an error when using the threshold function for some species (but others run fine) with no discernable reason for this difference between species. This only applies when the threshold method is any of the options from modEva.
Below is my code, and a traceback call to identify the location of the error.
mod2_glm <- distribution(background) |>
add_predictors(env = predictors_suit,
transform = 'none',
derivates = 'quad',
harmonize_na = T) |>
add_biodiversity_poipa(pa_data,
name = 'PA model',
field_occurrence = 'PA',
docheck = F) |>
engine_glm() |>
train(runname = 'PA model')
mod2_glm <- ibis.iSDM::threshold(mod2_glm, method = 'TSS')
9: h(simpleError(msg, call))
8: .handleSimpleError(function (cond)
.Internal(C_tryCatchHelper(addr, 1L, cond)), "comparison (<) is possible only for atomic and list types",
base::quote(raster_thresh < tr[1]))
7: `[<-`(`*tmp*`, raster_thresh < tr[1], value = 0)
6: .local(obj, method, value, point, field_occurrence, format, return_threshold,
...)
5: threshold(obj, method = method, value = value, point = point,
field_occurrence = field_occurrence, format = format, return_threshold = return_threshold,
...)
4: threshold(obj, method = method, value = value, point = point,
field_occurrence = field_occurrence, format = format, return_threshold = return_threshold,
...)
3: .stackthreshold(obj = ras, method = method, value = value, point = point,
field_occurrence = field_occurrence, format = format, return_threshold = return_threshold)
2: ibis.iSDM::threshold(mod2_glm, method = "TSS")
1: ibis.iSDM::threshold(mod2_glm, method = "TSS")
I can send the data to create a reprex via email if that is helpful?
Thanks as ever for your support in updating and developing the package.
Cheers, Conor
Hey, thanks for reporting, the sounds as if the PA data is either not found or is ill-formatted (only presences/absences, not enough points or column PA formatted as factor or similar or somewhere there is a NA value in between).
Either way this could be catched in a message I guess.
Before sending any test data could you please update the packages and install the current dev branch?
Note threshold supports also withheld point data (parameter point) as well.
Hi, I tested a few things today and could not reproduce the error you report. If it still occurs after the suggestions above, please send me a small(!) reprex. Thanks, Martin
Closed but feel free to comment if the error (re)appears