View source: R/bm_ModelAnalysis.R
| bm_ModelAnalysis | R Documentation |
This function return several graphs to help analyse the single models.
bm_ModelAnalysis(
bm.mod,
models.chosen = "all",
color.by = "full.name",
do.plot = TRUE
)
bm.mod |
a |
models.chosen |
a |
color.by |
a |
do.plot |
(optional, default |
5 plots can be obtained with this function :
to detect outliers. The x-axis only helps to find the outlier number.
to check if residuals follow a normal distribution. Points should follow the black line.
to check if residuals follow a normal distribution. Histogram should represent a gaussian distribution.
to detect an heteroscedasticity of the residuals. It corresponds to the Tukey-Anscombe plot.
to detect overfitting. Representing Rsquared and
Rsquared_aj values, there should not be a big gap between calibration and
validation values.
Please not the all plots are made for all models, independently to the different models assumptions. It is up to the user to interpret the graphics.
A list containing :
a data.frame with variables, predicted values and model residuals
a data.frame with the R score values
5 ggplot objects (from A to E) representing the different analyses.
Hélène Blancheteau
Other Secondary functions:
bm_BinaryTransformation(),
bm_CrossValidation(),
bm_FindOptimStat(),
bm_MakeFormula(),
bm_ModelingOptions(),
bm_PlotEvalBoxplot(),
bm_PlotEvalMean(),
bm_PlotRangeSize(),
bm_PlotResponseCurves(),
bm_PlotVarImpBoxplot(),
bm_PseudoAbsences(),
bm_RangeSize(),
bm_RunModelsLoop(),
bm_SRE(),
bm_SampleBinaryVector(),
bm_SampleFactorLevels(),
bm_Tuning(),
bm_VariablesImportance()
Other Plot functions:
bm_PlotEvalBoxplot(),
bm_PlotEvalMean(),
bm_PlotRangeSize(),
bm_PlotResponseCurves(),
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.name = myRespName,
resp.var = myResp,
resp.xy = myRespXY,
expl.var = myExpl)
# 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','AUCroc'),
var.import = 3,
seed.val = 42)
}
# ---------------------------------------------------------------#
# Explore single models
myBiomodAnalysis <- bm_ModelAnalysis(bm.mod = myBiomodModelOut, color.by = "run")
plot(myBiomodAnalysis$plot.outliers)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.