library(sdm)
Species Distribution Modeling
An analysis of species distribution using ensemble methods in R.
About
In this short article, I demonstrate how to build ensemble model of rf, maxent, and brt in R using sdm package version 1.2.46 (Naimi and Araújo 2016).
Loading the libraries
Species occurrence records
Here we will use the occurrence records inbuilt in the package to boost reproducibility.
<- vect(system.file('external/species.shp', package = 'sdm'))
species
<- rast(list.files(system.file("external", package = 'sdm'), pattern = '.asc', full.names = TRUE)) preds
Building the sdmData object.
<- sdmData(Occurrence ~., train = species, predictors = preds) d
Building the sdmModels object.
<- sdm(Occurrence ~., data = d, methods = c('rf', 'maxent', 'brt'), replications = 'cv', cv.folds = 4, n = 3) m
<- ensemble(x = m,
ens newdata = preds,
filename = ".tif",
setting = list(method = "weighted", stat = "TSS", opt = 2),
overwrite = TRUE)
plot(ens)
Cool, this is the plot of all the models “combined”.
References
Naimi, Babak, and Miguel B. Araújo. 2016. “Sdm: A Reproducible and Extensible r Platform for Species Distribution Modelling.” Ecography. https://doi.org/10.1111/ecog.01881.