Produces a ggplot2 plot of stability (as SEM) of variable importance across models trained and tested across outer CV folds. Optionally overlays directionality for binary response or regression outcomes.
barplot_var_stability(
x,
final = TRUE,
top = NULL,
direction = 0,
dir_labels = NULL,
scheme = c("royalblue", "red"),
breaks = NULL,
percent = TRUE,
level = 1,
sort = TRUE
)A ggplot2 plot
a nestcv.glmnet or nestcv.train fitted object
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.
Limits number of variables plotted. Set to NULL to plot all
variables.
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.
Character vector for controlling the legend when
direction = 1
Vector of 2 colours for directionality when direction = 1
Vector of continuous breaks for legend colour/size
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.
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.
Logical whether to sort by mean variable importance. Passed to
var_stability().
var_stability()