Learn R Programming

sparseSVM (version 1.1-7)

plot.cv.sparseSVM: Plot the cross-validation curve for a "cv.sparseSVM" object

Description

Plot the cross-validation curve for a "cv.sparseSVM" object against the lambda values used, along with standard error bars.

Usage

# S3 method for cv.sparseSVM
plot(x, log.l = TRUE, nvars = TRUE, ...)

Arguments

x

A "cv.sparseSVM" object.

log.l

Should log(lambda) be used instead of lambda for the X-axis? Default is TRUE.

nvars

If TRUE (the default), places an axis on top of the plot denoting the number of variables with nonzero coefficients at each lambda.

...

Other graphical parameters to plot

Author

Congrui Yi and Yaohui Zeng
Maintainer: Congrui Yi <eric.ycr@gmail.com>

Details

Produces a plot of mean cv errors at each lambda along with upper and lower standard error bars.

See Also

sparseSVM, cv.sparseSVM

Examples

Run this code
X = matrix(rnorm(1000*100), 1000, 100)
b = 3
w = 5*rnorm(10)
eps = rnorm(1000)
y = sign(b + drop(X[,1:10] %*% w + eps))

cv.fit <- cv.sparseSVM(X, y, ncores = 2, seed = 1234)
plot(cv.fit)
plot(cv.fit, log.l = FALSE)

Run the code above in your browser using DataLab