Learn R Programming

SDModels (version 1.0.4)

plot.paths: Visualize the paths of an SDTree or SDForest

Description

This function visualizes the variable importance of an SDTree or SDForest for different complexity parameters. Both the regularization path and the stability selection path can be visualized.

Usage

# S3 method for paths
plot(x, plotly = FALSE, selection = NULL, sqrt_scale = FALSE, ...)

Value

A ggplot object with the variable importance for different regularization. If the path object includes a cp_min value, a black dashed line is added to indicate the out-of-bag optimal variable selection.

Arguments

x

A paths object

plotly

If TRUE the plot is returned interactive using plotly. Might be slow for large data.

selection

A vector of indices of the covariates to be plotted. Can be used to plot only a subset of the covariates in case of many covariates.

sqrt_scale

If TRUE the y-axis is on a square root scale.

...

Further arguments passed to or from other methods.

Author

Markus Ulmer

See Also

regPath stabilitySelection

Examples

Run this code
set.seed(1)
n <- 10
X <- matrix(rnorm(n * 5), nrow = n)
y <- sign(X[, 1]) * 3 + sign(X[, 2]) + rnorm(n)
model <- SDTree(x = X, y = y, Q_type = 'no_deconfounding', cp = 0.5)
paths <- regPath(model)
plot(paths)
# \donttest{
plot(paths, plotly = TRUE)
# }

Run the code above in your browser using DataLab