plot_var_stability: Plot variable stability

View source: R/varImp.R

plot_var_stabilityR Documentation

Plot variable stability

Description

Produces a ggplot2 plot of stability (as SEM) of variable importance across models trained and tested across outer CV folds. Overlays frequency with which variables are selected across the outer folds and optionally overlays directionality for binary response outcome.

Usage

plot_var_stability(
  x,
  final = TRUE,
  top = NULL,
  direction = 0,
  dir_labels = NULL,
  breaks = NULL,
  percent = TRUE,
  level = 1,
  sort = TRUE
)

Arguments

x

a nestcv.glmnet or nestcv.train fitted object

final

Logical whether to restrict variables to only those which ended up in the final fitted model or to include all variables selected across all outer folds.

top

Limits number of variables plotted. Set to NULL to plot all variables.

direction

Integer controlling plotting of directionality for binary or regression models. 0 means no directionality is shown, 1 means directionality is overlaid as a colour, 2 means directionality is reflected in the sign of variable importance. Not available for multiclass caret models.

dir_labels

Character vector for controlling the legend when direction = 1

breaks

Vector of continuous breaks for legend colour/size

percent

Logical for nestcv.glmnet objects only, whether to scale coefficients to percentage of the largest coefficient in each model. If set to FALSE, model coefficients are shown and direction is ignored.

level

For multinomial nestcv.glmnet models only, either an integer specifying which level of outcome is being examined, or the level can be specified as a character value.

sort

Logical whether to sort by mean variable importance. Passed to var_stability().

Value

A ggplot2 plot

See Also

var_stability()


nestedcv documentation built on Oct. 26, 2023, 5:08 p.m.