Learn R Programming

biomod2 (version 4.2-5)

bm_VariablesImportance: Variables' importance calculation

Description

This internal biomod2 function allows the user to compute a variable importance value for each variable involved in the given model.

Usage

bm_VariablesImportance(
  bm.model,
  expl.var,
  variables = NULL,
  method = "full_rand",
  nb.rep = 1,
  seed.val = NULL,
  do.progress = TRUE,
  temp.workdir = NULL
)

Value

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

Arguments

bm.model

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

expl.var

a data.frame containing the explanatory variables that will be used to compute the variables importance

variables

(optional, default NULL)
A vector containing the names of the explanatory variables that will be considered

method

a character corresponding to the randomisation method to be used, must be full_rand (only method available so far)

nb.rep

an integer corresponding to the number of permutations to be done for each variable

seed.val

(optional, default NULL)
An integer value corresponding to the new seed value to be set

do.progress

(optional, default TRUE)
A logical value defining whether the progress bar is to be rendered or not

temp.workdir

(optional, default NULL)
A character value corresponding to the folder name containing temporal prediction files when using MAXENT

Author

Damien Georges

Details

For each variable to be evaluated :

  1. shuffle the original variable

  2. compute model prediction with shuffled variable

  3. calculate Pearson's correlation between reference and shuffled predictions

  4. 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.

See Also

randomForest, bm_RunModelsLoop, BIOMOD_Modeling, BIOMOD_EnsembleModeling, bm_PlotVarImpBoxplot, get_variables_importance

Other Secundary 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()

Examples

Run this code
## 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)


Run the code above in your browser using DataLab