plot.cv.pcLasso: Plot the cross-validation curve produced by "cv.pcLasso"...

Description Usage Arguments Details See Also Examples

View source: R/plot.cv.pcLasso.R

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

1
2
## S3 method for class '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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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

pcLasso documentation built on Sept. 4, 2020, 1:08 a.m.