Skip to contents

Variable importance from one model run is a weak basis for ecological interpretation: it changes between algorithms, which measure it differently, between cross-validation folds and replicates, and between regions or scenarios. importance_stability() takes importance from any software as a long table and reports, for every variable:

Usage

importance_stability(
  importance,
  variable = "variable",
  value = "importance",
  algorithm = NULL,
  run = NULL,
  group = NULL
)

Arguments

importance

Long table: one row per variable and run.

variable, value

Columns with the variable and its importance (larger = more important).

algorithm, run, group

Optional columns: the algorithm, the run (replicate, fold, background set) and a grouping such as region or scenario. A run is identified by algorithm, group and run together.

Value

An object of class importance_stability: variables (one row per variable: mean_share, mean_rank, sd_rank, top_share), agreement (Kendall's W overall and per algorithm, with the number of runs), algorithms (rank correlations of the mean ranks between algorithms, or NULL), groups (top variable per group, or NULL), ranks (the rank of every variable in every run) and settings.

Details

  • its mean share of importance (importance normalised to sum to 1 in each run, so that measures on different scales can be combined);

  • its mean rank and the standard deviation of its rank over runs;

  • the share of runs in which it is the most important variable;

and, for the whole set, the agreement of the rankings over runs: Kendall's W (Kendall & Babington Smith 1939; 1 = every run ranks the variables alike, 0 = no agreement), overall and per algorithm, and the rank correlation of the mean ranks between algorithms. With group (regions, scenarios, periods) it says whether the most important variable differs between groups: a sign of genuine differences in the species' response, or of a model that will transfer poorly.

Status and limits. Kendall's W is established; this summary of importance is preENM's. It consumes importance computed elsewhere and fits nothing. Importance is shared among correlated predictors, so an unstable ranking of two correlated variables says little. Permutation importance, response-curve sensitivity and model-specific measures differ; compare like with like (value from one kind of measure). The grades of W (at least 0.7 strong, 0.4 moderate agreement) are preENM defaults, not from the literature. What to vary. Algorithms, runs and groups.

References

Kendall, M.G., Babington Smith, B. (1939) The problem of m rankings. The Annals of Mathematical Statistics 10, 275-287. doi:10.1214/aoms/1177732186

Examples

set.seed(1)
imp <- expand.grid(variable = c("temp", "prec", "soil", "slope"),
                   run = 1:5, algorithm = c("GLM", "RF"),
                   stringsAsFactors = FALSE)
imp$importance <- c(temp = 40, prec = 30, soil = 10, slope = 5)[
  imp$variable] + stats::rnorm(nrow(imp), 0, 6)
st <- importance_stability(imp)
st
#> Stability of variable importance: 4 variables, 10 runs, 2 algorithms
#> 
#> IN SHORT
#> - The ranking of the variables agrees strongly over runs (Kendall's W =
#>   0.89).
#> - temp is the most important on average (46% of importance) and first in
#>   100% of runs.
#> - Algorithms agree on the order of the variables (lowest rank correlation
#>   1.00); they measure importance differently, so read the order with the
#>   consensus of several.
#> 
#>  variable mean_share mean_rank sd_rank top_share
#>      temp       0.46       1.0    0.00         1
#>      prec       0.33       2.1    0.32         0
#>      soil       0.14       3.1    0.57         0
#>     slope       0.07       3.8    0.42         0
#> 
#> mean_share = mean share of importance (normalised to 1 in each run);
#> top_share = share of runs in which the variable ranks first. Kendall's W at
#> least 0.7 strong, 0.4 moderate: preENM defaults, not from the literature.
#> 
#> A preENM sensitivity analysis: how much the result depends on the
#> algorithm, run and region behind variable importance. The others are listed
#> in ?sensitivity_analyses.
plot_importance_stability(st)