Skip to contents

Plots the cross-validation curve, and upper and lower standard deviation curves, as a function of the lambda values used.

Usage

# S3 method for class 'cv.sparsegl'
plot(x, log_axis = c("xy", "x", "y", "none"), sign.lambda = 1, ...)

Arguments

x

Fitted "cv.sparsegl" object, produced with cv.sparsegl().

log_axis

Apply log scaling to the requested axes.

sign.lambda

Either plot against log(lambda) (default) or the reverse if sign.lambda < 0.

...

Not used.

Details

A ggplot2::ggplot() plot is produced. Additional user modifications may be added as desired.

See also

Examples

n <- 100
p <- 20
X <- matrix(rnorm(n * p), nrow = n)
eps <- rnorm(n)
beta_star <- c(rep(5, 5), c(5, -5, 2, 0, 0), rep(-5, 5), rep(0, (p - 15)))
y <- X %*% beta_star + eps
groups <- rep(1:(p / 5), each = 5)
cv_fit <- cv.sparsegl(X, y, groups)
plot(cv_fit)