Learn R Programming

plasso (version 0.1.3)

plot.cv.plasso: Plot of cross-validation curves

Description

Plot of cross-validation curves.

Usage

# S3 method for cv.plasso
plot(
  x,
  ...,
  legend_pos = c("bottomright", "bottom", "bottomleft", "left", "topleft", "top",
    "topright", "right", "center"),
  legend_size = 0.5,
  lasso = FALSE
)

Value

Plots the cross-validation curves for both Lasso and Post-Lasso models (incl. upper and lower standard deviation curves) for a fitted cv.plasso object.

Arguments

x

cv.plasso object

...

Pass generic plot options

legend_pos

Legend position. Only considered for joint plot (lass=FALSE).

legend_size

Font size of legend

lasso

If set as True, only the cross-validation curve for the Lasso model is plotted. Default is False.

Examples

Run this code
# load toeplitz data
data(toeplitz)
# extract target and features from data
y = as.matrix(toeplitz[,1])
X = toeplitz[,-1]
# fit cv.plasso to the data
p.cv = plasso::cv.plasso(X,y)
# plot cross-validated MSE curves and number of active coefficients
plot(p.cv, legend_pos="bottomleft")

Run the code above in your browser using DataLab