sjevelazco/flexsdm

msdm_posteriori

geamaro opened this issue · 0 comments

When I run the code

presence.background.points.model <- rbind(presence.points.model, background.points.model)

maxent.posteriori.model <- msdm_posteriori(
records = presence.background.points.model,
x = "x",
y = "y",
pr_ab = "pr_ab",
cont_suit = maxent.predict.BR$max$max,
method = c("obr"),
thr = "max_sens_spec",
buffer = NULL,
)

I get the message

Error in quantile.default(a, 0:1000/1000) :
missing values and NaN's not allowed if 'na.rm' is FALSE

When I change the code to use a previously calculated threshold, it works fine.

maxent.posteriori.model <- msdm_posteriori(
records = presence.background.points.model,
x = "x",
y = "y",
pr_ab = "pr_ab",
cont_suit = maxent.predict.BR$max$max,
method = c("obr"),
thr = threshold.val,
buffer = NULL,
)

As if it was necessary to remove the NAs from the SpatRaster that with continuous suitability predictions before use it.