ecospat.binary.model: Generate Binary Models

ecospat.binary.modelR Documentation

Generate Binary Models


Generate a binary map from a continuous model prediction.


ecospat.binary.model (Pred, Threshold)



a SpatRaster object predicted suitabilities from a SDM prediction.


A threshold to convert continous maps into binary maps (e.g. the output of the function ecospat.mpa() or use the optimal.thresholds from PresenceAbsence R package.


This function generates a binary model prediction (presence/absence) from an original model applying a threshold. The threshold could be arbitrary, or be based on the maximum acceptable error of false negatives (i.e. percentage of the presence predicted as absences, omission error).


The binary model prediction (presence/absence).


Ruben G. Mateo with contributions of Frank Breiner and Flavien Collart


Fielding, A.H. and J.F. Bell. 1997. A review of methods for the assessment of prediction errors in conservation presence/absence models. Environmental Conservation, 24: 38-49.

Engler, R., A Guisan and L. Rechsteiner. 2004. An improved approach for predicting the distribution of rare and endangered species from occurrence and pseudo-absence data. Journal of Applied Ecology, 41, 263-274.

Liu, C., Berry, P. M., Dawson, T. P. and R. G. Pearson. 2005. Selecting thresholds of occurrence in the prediction of species distributions. Ecography, 28, 385-393.

Jimenez-Valverde, A. and J.M.Lobo. 2007. Threshold criteria for conversion of probability of species presence to either-or presence-absence. Acta oecologica, 31, 361-369.

Liu, C., White, M. and G. Newell. 2013. Selecting thresholds for the prediction of species occurrence with presence-only data. J. Biogeogr., 40, 778-789.

Freeman, E.A. and G.G. Moisen. 2008. A comparison of the performance of threshold criteria for binary classification in terms of predicted prevalence and kappa. Ecological Modelling, 217, 48-58.

See Also

ecospat.mpa, optimal.thresholds


# coordinates of the plots
xy <- ecospat.testData[,2:3]

# environmental data
predictors <- terra::rast(system.file("extdata","ecospat.testEnv.tif",package="ecospat"))

env <- terra::extract(predictors,xy,ID=FALSE)  
spData <-$Veronica_alpina,env)
mod <- glm(occ~ddeg0+I(ddeg0^2)+srad68+I(srad68^2),data=spData,family = binomial())

# predict to entire dataset
pred <- terra::predict(predictors,mod,type="response") 
### make binary maps
# use MPA to convert suitability to binary map

mpa.cutoff <- ecospat.mpa(pred,xy[spData$occ==1,],perc = 0.9) # 90% presences encompassed
pred.bin.mpa <- ecospat.binary.model(pred,mpa.cutoff)


ecospat documentation built on May 29, 2024, 8:18 a.m.