View source: R/bm_PlotResponseCurves.R
bm_PlotResponseCurves | R Documentation |
This function represents response curves of species distribution models, from
BIOMOD.models.out
or BIOMOD.ensemble.models.out
objects that can
be obtained from BIOMOD_Modeling
or BIOMOD_EnsembleModeling
functions. Response curves can be represented in either 2 or 3 dimensions (meaning 1 or 2
explanatory variables at a time, see Details).
bm_PlotResponseCurves(
bm.out,
models.chosen = "all",
new.env = get_formal_data(bm.out, "expl.var"),
show.variables = get_formal_data(bm.out, "expl.var.names"),
fixed.var = "mean",
do.bivariate = FALSE,
do.plot = TRUE,
do.progress = TRUE,
...
)
bm.out |
a |
models.chosen |
a |
new.env |
a |
show.variables |
a |
fixed.var |
a |
do.bivariate |
(optional, default |
do.plot |
(optional, default |
do.progress |
(optional, default |
... |
some additional arguments (see Details) |
This function is an adaptation of the Evaluation Strip method proposed by Elith et al. (2005). To build the predicted response curves :
n-1
variables are set constant to a fixed value determined by the
fixed.var
parameter (in the case of categorical variable, the most represented
class is taken)
the remaining variable is made to vary throughout its range given by the new.env
parameter
predicted values are computed with these n-1
fixed variables, and this
studied variable varying
If do.bivariate = TRUE
, 2 variables are varying at the same time.
The response curves obtained show the sensibility of the model to the studied variable.
Note that this method does not account for interactions between variables.
...
can take the following values :
main
: a character
corresponding to the graphic title
A list
containing a data.frame
with variables and predicted values and the
corresponding ggplot
object representing response curves.
Damien Georges, Maya Gueguen
Elith, J., Ferrier, S., Huettmann, FALSE. and Leathwick, J. R. 2005. The evaluation strip: A new and robust method for plotting predicted responses from species distribution models. Ecological Modelling, 186, 280-289.
BIOMOD.models.out
, BIOMOD.ensemble.models.out
,
BIOMOD_Modeling
, BIOMOD_EnsembleModeling
Other Secundary functions:
bm_BinaryTransformation()
,
bm_CrossValidation()
,
bm_FindOptimStat()
,
bm_MakeFormula()
,
bm_ModelingOptions()
,
bm_PlotEvalBoxplot()
,
bm_PlotEvalMean()
,
bm_PlotRangeSize()
,
bm_PlotVarImpBoxplot()
,
bm_PseudoAbsences()
,
bm_RunModelsLoop()
,
bm_SRE()
,
bm_SampleBinaryVector()
,
bm_SampleFactorLevels()
,
bm_Tuning()
,
bm_VariablesImportance()
Other Plot functions:
bm_PlotEvalBoxplot()
,
bm_PlotEvalMean()
,
bm_PlotRangeSize()
,
bm_PlotVarImpBoxplot()
library(terra)
# Load species occurrences (6 species available)
data(DataSpecies)
head(DataSpecies)
# Select the name of the studied species
myRespName <- 'GuloGulo'
# Get corresponding presence/absence data
myResp <- as.numeric(DataSpecies[, myRespName])
# Get corresponding XY coordinates
myRespXY <- DataSpecies[, c('X_WGS84', 'Y_WGS84')]
# Load environmental variables extracted from BIOCLIM (bio_3, bio_4, bio_7, bio_11 & bio_12)
data(bioclim_current)
myExpl <- terra::rast(bioclim_current)
# ---------------------------------------------------------------#
file.out <- paste0(myRespName, "/", myRespName, ".AllModels.models.out")
if (file.exists(file.out)) {
myBiomodModelOut <- get(load(file.out))
} else {
# Format Data with true absences
myBiomodData <- BIOMOD_FormatingData(resp.var = myResp,
expl.var = myExpl,
resp.xy = myRespXY,
resp.name = myRespName)
# Model single models
myBiomodModelOut <- BIOMOD_Modeling(bm.format = myBiomodData,
modeling.id = 'AllModels',
models = c('RF', 'GLM'),
CV.strategy = 'random',
CV.nb.rep = 2,
CV.perc = 0.8,
OPT.strategy = 'bigboss',
metric.eval = c('TSS','ROC'),
var.import = 3,
seed.val = 42)
}
# ---------------------------------------------------------------#
# Represent response curves
mods <- get_built_models(myBiomodModelOut, run = 'RUN1')
bm_PlotResponseCurves(bm.out = myBiomodModelOut,
models.chosen = mods,
fixed.var = 'median')
## fixed.var can also be set to 'min', 'max' or 'mean'
# bm_PlotResponseCurves(bm.out = myBiomodModelOut,
# models.chosen = mods,
# fixed.var = 'min')
# Bivariate case (one model)
# variables can be selected with argument 'show.variables'
# models can be selected with argument 'models.chosen'
mods <- get_built_models(myBiomodModelOut, full.name = 'GuloGulo_allData_RUN2_RF')
bm_PlotResponseCurves(bm.out = myBiomodModelOut,
show.variables = c("bio4","bio12","bio11"),
models.chosen = mods,
fixed.var = 'median',
do.bivariate = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.