threshold | R Documentation |
To transform the values of predicted probability of occurrence (habitat suitability) to presence-absences, a threshold is needed. To identify the best threshold, several (15+) optimisation criteria are supported by the package which is calculated for each model in the sdmModels object. To extract the best threshold from each model (given its modelID specified in the id
argument), these functions can be used. It is also possible to specify id = "ensemble"
to identify the best threshold for the ensemble of models.
threshold(x,id,opt,species,...)
getThreshold(x,id,opt,species,...)
x |
an sdmModels object (output of the sdmData function) |
id |
can be either a numeric vector specifying the modelIDs corresponding to SDMs in |
opt |
specifies the optimisation criterion based on which a threshold is identified; default is opt=2 (see |
species |
default=NULL; if the models for multiple species are available in |
... |
if |
Both the threshold
and getThreshold
functions are the same
a numeric value
Babak Naimi naimi.b@gmail.com
https://www.biogeoinformatics.org/
Naimi, B., Araujo, M.B. (2016) sdm: a reproducible and extensible R platform for species distribution modelling, Ecography, 39:368-375, DOI: 10.1111/ecog.01881
## Not run:
# let's first fit a set of models and generate prediction and ensemble maps:
# get the path to the species data
file <- system.file("external/sp1.shp", package="sdm")
sp <- vect(file) # read the species records
path <- system.file("external", package="sdm") # path to the folder contains the data
lst <- list.files(path=path,pattern='asc$',full.names = T) # list of predictor filenames
preds <- rast(lst) # making a SpatRaster object (predictors)
d <- sdmData(formula=Occurrence~., train=sp, predictors=preds)
d
# fit two models:
m <- sdm(Occurrence~.,data=d,methods=c('glmp','brt'),replication='boot',n=1)
m
threshold(m,id=1,opt=1) # get threshold for the first model
threshold(m,id=1:2,opt=1) # get thresholds for the first and second models
threshold(m,id=1:2,opt=2) # get thresholds for the first and second models
threshold(m,id="ensemble",opt=2) # get threshold based on the ensemble of models
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.