Learn R Programming

SCPME (version 1.0)

plot.shrink: Plot shrink object

Description

Produces a plot for the cross validation errors, if available.

Usage

# S3 method for shrink
plot(x, type = c("line", "heatmap"), footnote = TRUE, ...)

Arguments

x

class object shrink.

type

produce either 'heatmap' or 'line' graph

footnote

option to print footnote of optimal values. Defaults to TRUE.

...

additional arguments.

Examples

Run this code
# NOT RUN {
# generate some data
data = data_gen(n = 100, p = 5, r = 1)

# lasso penalized beta (print estimated omega)
lam.max = max(abs(t(data$X) %*% data$Y))
(shrink = shrink(X = data$X, Y = data$Y, B = cov(data$X, data$Y), lam.max = lam.max))

# print estimated beta
shrink$Z

# create heatmap of CV errors
plot(shrink, type = 'heatmap')

# create line graph of CV errors
plot(shrink)
# }

Run the code above in your browser using DataLab