Learn R Programming

hqreg (version 1.2)

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

Description

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

Usage

## S3 method for class 'cv.hqreg':
plot(x, log.x = TRUE, nvars = TRUE, ...)

Arguments

x
A "cv.hqreg" object.
log.x
Should X-axis be on the log scale? 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

Details

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

See Also

hqreg, cv.hqreg

Examples

Run this code
X = matrix(rnorm(1000*100), 1000, 100)
beta = rnorm(10)
eps = 4*rnorm(1000)
y = drop(X[,1:10] %*% beta + eps)
cv = cv.hqreg(X, y, seed = 123)
plot(cv, log.x = TRUE)

Run the code above in your browser using DataLab