This function allows to calibrate and evaluate a range of species distribution models techniques run over a given species. Calibrations are made on the whole sample or a random subpart. The predictive power of the different models is estimated using a range of evaluation metrics.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
BIOMOD_Modeling( data, models = c("GLM", "GBM", "GAM", "CTA", "ANN", "SRE", "FDA", "MARS", "RF", "MAXENT.Phillips", "MAXENT.Phillips.2"), models.options = NULL, NbRunEval = 1, DataSplit = 100, Yweights = NULL, Prevalence = NULL, VarImport = 0, models.eval.meth = c("KAPPA", "TSS", "ROC"), SaveObj = TRUE, rescal.all.models = FALSE, do.full.models = TRUE, modeling.id = as.character(format(Sys.time(), "%s")), ... )
character, models to be computed names. To be chosen among 'GLM', 'GBM', 'GAM', 'CTA', 'ANN', 'SRE', 'FDA', 'MARS', 'RF', 'MAXENT.Phillips', 'MAXENT.Phillips.2'
integer, number of Evaluation run.
numeric, % of data used to calibrate the models, the remaining part will be used for testing
numeric, vector of weights (one per observation)
Number of permutation to estimate variable importance
vector of names of evaluation metric among 'KAPPA', 'TSS', 'ROC', 'FAR', 'SR', 'ACCURACY', 'BIAS', 'POD', 'CSI' and 'ETS'
keep all results and outputs on hard drive or not (NOTE: strongly recommended)
if true, all model prediction will be scaled with a binomial GLM
if true, models calibrated and evaluated with the whole dataset are done
character, the ID (=name) of modeling procedure. A random number by default.
further arguments :
.. If you have decide to add pseudo absences to your
original dataset (see
NbRunEval + 1 models will be
2. models .. The set of models to be calibrated on the data. 10 modeling techniques are currently available:
.. - GLM : Generalized Linear Model
.. - GAM : Generalized Additive Model (
BIOMOD_ModelingOptions for details on
.. - GBM : Generalized Boosting Model or usually called Boosted
Regression Trees (
.. - CTA: Classification Tree Analysis (
.. - ANN: Artificial Neural Network (
.. - SRE: Surface Range Envelop or usually called BIOCLIM
.. - FDA: Flexible Discriminant Analysis (
.. - MARS: Multiple Adaptive Regression Splines
.. - RF: Random Forest (
.. - MAXENT.Phillips: Maximum Entropy ( https://biodiversityinformatics.amnh.org/open_source/maxent/)
.. - MAXENT.Phillips.2: Maximum Entropy
3. NbRunEval & DataSplit
.. As already explained in the
help file, the common trend is to split the original dataset into
two subsets, one to calibrate the models, and another one to evaluate
them. Here we provide the possibility to repeat this process
(calibration and evaluation) N times (
The proportion of data kept for calibration is determined by the
DataSplit argument (100% -
DataSplit will be used to
evaluate the model). This sort of cross-validation allows to have a
quite robust test of the models when independent data are not
available. Each technique will also be calibrated on the complete
original data. All the models produced by BIOMOD and their related
informations are saved on the hard drive.
4. Yweights & Prevalence
.. Allows to give more or less weight to some particular
observations. If these arguments is kept to NULL
Yweights = NULL,
Prevalence = NULL), each
observation (presence or absence) has the same weight (independent
of the number of presences and absences). If
Prevalence = 0.5
absences will be weighted equally to the presences (i.e. the
weighted sum of presence equals the weighted sum of absences). If
prevalence is set below or above 0.5 absences or presences are given
more weight, respectively.
.. In the particular case that pseudo-absence data have been
PA.nb.rep > 0), weights
are by default (
Prevalence = NULL) calculated such that
prevalence is 0.5, meaning that the presences will have the same
importance as the absences in the calibration process of the models.
Yweights will be composed of integers to
prevent different modeling issues.
.. Note that the
Prevalence argument will always be ignored if
Yweights are defined.
5. models.eval.meth .. The available evaluations methods are :
ROC : Relative Operating Characteristic
KAPPA : Cohen's Kappa (Heidke skill score)
TSS : True kill statistic (Hanssen and Kuipers
discriminant, Peirce's skill score)
FAR : False alarm ratio
SR : Success ratio
ACCURANCY : Accuracy (fraction correct)
BIAS : Bias score (frequency bias)
POD : Probability of detection (hit rate)
CSI : Critical success index (threat score)
ETS : Equitable threat score (Gilbert skill score)
Some of them are scaled to have all an optimum at 1. You can choose one of more (vector) evaluation metric. By Default, only 'KAPPA', 'TSS' and 'ROC' evaluation are done. Please refer to the CAWRC website (https://www.cawcr.gov.au/projects/verification/) to get detailed description of each metric.
If this argument is set to False, it may prevent the evaluation of
the ‘ensemble modeled’ models in further steps. We strongly
recommend to always keep this argument
TRUE even it asks for
free space onto the hard drive.
7. rescal.all.models This parameter is quite experimental and we advise not to use it. It should lead to reduction in projection scale amplitude Some categorical models have to be scaled in every case ( ‘FDA’, ‘ANN’). But It may be interesting to scale all model computed to ensure that they will produced comparable predictions (0-1000 ladder). That's particularly useful when you do some ensemble forecasting to remove the scale prediction effect (the more extended projections are, the more they influence ensemble forecasting results).
8. do.full.models Building models with all information available may be useful in some particular cases (i.e. rare species with few presences points). The main drawback of this method is that, if you don't give separated data for models evaluation, your models will be evaluated with the same data that the ones used for calibration. That will lead to over-optimistic evaluation scores. Be careful with this '_Full' models interpretation.
A BIOMOD.models.out object
Additional objects are stored out of R in two different directories
for memory storage purposes. They are created by the function
directly on the root of your working directory set in R ("models"
directory). This one contains each calibrated model for each
repetition and pseudo-absence run. A hidden folder
.DATA_BIOMOD contains some files (predictions, original
dataset copy, pseudo absences chosen...) used by other functions like
The models are currently stored as objects to be read exclusively in
R. To load them back (the same stands for all objects stored on the
hard disk) use the
load function (see examples section below).
Wilfried Thuiller, Damien Georges, Robin Engler
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
##' species occurrences DataSpecies <- read.csv( system.file( "external/species/mammals_table.csv", package="biomod2" ) ) head(DataSpecies) ##' the name of studied species myRespName <- 'GuloGulo' ##' the presence/absences data for our species myResp <- as.numeric(DataSpecies[, myRespName]) ##' the XY coordinates of species data myRespXY <- DataSpecies[, c("X_WGS84", "Y_WGS84")] ##' Environmental variables extracted from BIOCLIM (bio_3, ##' bio_4, bio_7, bio_11 & bio_12) myExpl <- raster::stack( system.file("external/bioclim/current/bio3.grd", package = "biomod2"), system.file("external/bioclim/current/bio4.grd", package = "biomod2"), system.file("external/bioclim/current/bio7.grd", package = "biomod2"), system.file("external/bioclim/current/bio11.grd", package = "biomod2"), system.file("external/bioclim/current/bio12.grd", package = "biomod2") ) ##' 1. Formatting Data myBiomodData <- BIOMOD_FormatingData( resp.var = myResp, expl.var = myExpl, resp.xy = myRespXY, resp.name = myRespName ) ##' 2. Defining Models Options using default options. myBiomodOption <- BIOMOD_ModelingOptions() ##' 3. Doing Modelisation myBiomodModelOut <- BIOMOD_Modeling( myBiomodData, models = c('SRE','RF'), models.options = myBiomodOption, NbRunEval = 2, DataSplit = 80, VarImport = 0, models.eval.meth = c('TSS','ROC'), do.full.models = FALSE, modeling.id = "test" ) ##' print a summary of modeling stuff myBiomodModelOut
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.