plot.Rcpp_tlars_cpp {tlars} | R Documentation |
Plots the T-LARS solution path
Description
Plots the T-LARS solution path stored in C++ objects of class tlars_cpp (see tlars_cpp for details) if the object is created with type = "lar" (no plot for type = "lasso").
Usage
## S3 method for class 'Rcpp_tlars_cpp'
plot(
x,
xlab = "# Included dummies",
ylab = "Coefficients",
include_dummies = TRUE,
actions = TRUE,
col_selected = "black",
col_dummies = "red",
lty_selected = "solid",
lty_dummies = "dashed",
legend_pos = "topleft",
...
)
Arguments
x |
Object of the class tlars_cpp. See tlars_cpp for details. |
xlab |
Label of the x-axis. |
ylab |
Label of the y-axis. |
include_dummies |
Logical. If TRUE solution paths of dummies are added to the plot. |
actions |
Logical. If TRUE axis above plot with indices of added variables (Dummies represented by 'D') along the solution path is added. |
col_selected |
Color of lines corresponding to selected variables. |
col_dummies |
Color of lines corresponding to included dummies. |
lty_selected |
Line type of lines corresponding to selected variables. See par for more details. |
lty_dummies |
Line type of lines corresponding to included dummies. See par for more details. |
legend_pos |
Legend position. See xy.coords for more details. |
... |
Ignored. Only added to keep structure of generic plot function. |
Value
Plots the T-LARS solution path stored in C++ objects of class tlars_cpp (no plot for type = "lasso").
See Also
tlars_cpp, plot, par, and xy.coords.
Examples
data("Gauss_data")
X <- Gauss_data$X
y <- drop(Gauss_data$y)
p <- ncol(X)
n <- nrow(X)
num_dummies <- p
dummies <- matrix(stats::rnorm(n * p), nrow = n, ncol = num_dummies)
XD <- cbind(X, dummies)
mod_tlars <- tlars_model(X = XD, y = y, num_dummies = num_dummies)
tlars(model = mod_tlars, T_stop = 3, early_stop = TRUE)
plot(mod_tlars)