pcLasso (version 1.1)

plot.cv.pcLasso: 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 cv.pcLasso
plot(x, sign.lambda = 1, orignz = TRUE, ...)

Arguments

x

Fitted "cv.pcLasso" object.

sign.lambda

Either plot against log(lambda) (default) or -log(lambda) (if sign.lambda = -1).

orignz

If TRUE (default), prints the number of non-zero coefficients in the original feature space. If not, prints the number of non-zero coefficients in the expanded feature space. No effect if groups are not overlapping.

...

Other graphical paramters to plot.

Details

A plot is produced and nothing is returned.

See Also

pcLasso and cv.pcLasso.

Examples

Run this code
# NOT RUN {
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

# }

Run the code above in your browser using DataLab