plot.cv.pcLasso {pcLasso} | R Documentation |
Plot the cross-validation curve produced by "cv.pcLasso" object
Description
Plots the cross-validation curve produced by a cv.pcLasso
object, along
with upper and lower standard deviation curves, as a function of the lambda
values used.
Usage
## S3 method for class 'cv.pcLasso'
plot(x, sign.lambda = 1, orignz = TRUE, ...)
Arguments
x |
Fitted " |
sign.lambda |
Either plot against |
orignz |
If |
... |
Other graphical paramters to plot. |
Details
A plot is produced and nothing is returned.
See Also
pcLasso
and cv.pcLasso
.
Examples
set.seed(1)
x <- matrix(rnorm(100 * 20), 100, 20)
y <- rnorm(100)
groups <- vector("list", 4)
for (k in 1:4) {
groups[[k]] <- 5 * (k-1) + 1:5
}
cvfit <- cv.pcLasso(x, y, ratio = 0.8, groups = groups)
plot(cvfit)
# plot flipped: x-axis tracks -log(lambda) instead
plot(cvfit, sign.lambda = -1)
# if groups overlap, orignz can be used to decide which space to count the
# number of non-zero coefficients at the top
groups[[1]] <- 1:8
cvfit <- cv.pcLasso(x, y, ratio = 0.8, groups = groups)
plot(cvfit) # no. of non-zero coefficients in original space
plot(cvfit, orignz = FALSE) # no. of non-zero coefficients in expanded space
[Package pcLasso version 1.2 Index]