This internal biomod2 function allows the user to compute a variable importance value for each variable involved in the given model.
bm_VariablesImportance(
bm.model,
expl.var,
variables = NULL,
method = "full_rand",
nb.rep = 1,
seed.val = NULL,
do.progress = TRUE,
temp.workdir = NULL
)
a biomod2_model
object (or nnet
, rpart
, fda
,
gam
, glm
, lm
, gbm
, mars
, randomForest
,
xgb.Booster
) that can be obtained with the get_formal_model
function
a data.frame
containing the explanatory variables that will be used to
compute the variables importance
(optional, default NULL
)
A vector
containing the names of the explanatory variables that will be considered
a character
corresponding to the randomization method to be used, must be
full_rand
(only method available so far)
an integer
corresponding to the number of permutations to be done for
each variable
(optional, default NULL
)
An integer
value corresponding to the new seed value to be set
(optional, default TRUE
)
A logical
value defining whether the progress bar is to be rendered or not
(optional, default NULL
)
A character
value corresponding to the folder name containing temporal prediction files
when using MAXENT
A 3
columns data.frame
containing variable's importance scores for each
permutation run :
expl.var
: the considered explanatory variable (the one permuted)
rand
: the ID of the permutation run
var.imp
: the variable's importance score
For each variable to be evaluated :
shuffle the original variable
compute model prediction with shuffled variable
calculate Pearson's correlation between reference and shuffled predictions
return score as 1 - cor
The highest the value, the less reference and shuffled predictions are correlated, and the
more influence the variable has on the model. A value of 0
assumes no influence of
the variable on the model.
Note that this calculation does not account for variables' interactions.
The same principle is used in randomForest
.
randomForest
,
bm_RunModelsLoop
, BIOMOD_Modeling
,
BIOMOD_EnsembleModeling
, bm_PlotVarImpBoxplot
,
get_variables_importance
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_RunModelsLoop()
,
bm_SRE()
,
bm_SampleBinaryVector()
,
bm_SampleFactorLevels()
,
bm_Tuning()
## Create simple simulated data
myResp.s <- sample(c(0, 1), 20, replace = TRUE)
myExpl.s <- data.frame(var1 = sample(c(0, 1), 100, replace = TRUE),
var2 = rnorm(100),
var3 = 1:100)
## Compute variables importance
mod <- glm(var1 ~ var2 + var3, data = myExpl.s)
bm_VariablesImportance(bm.model = mod,
expl.var = myExpl.s[, c('var2', 'var3')],
method = "full_rand",
nb.rep = 3)