if (FALSE) {
# 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
}
Run the code above in your browser using DataLab