Learn R Programming

BeSS (version 2.0.2)

plot.bess: Produces a coefficient profile plot of the coefficient or loss function paths

Description

Produces a coefficient profile plot of the coefficient or loss function paths

Usage

# S3 method for bess
plot(
  x,
  type = c("loss", "tune", "coefficients", "both"),
  breaks = TRUE,
  K = NULL,
  sign.lambda = 0,
  ...
)

Arguments

x

A "bess" object.

type

One of "loss", "tune", "coefficients", "both". This option is only valid for "bess" object obtained from "bss". If type = "loss" (type = "tune"), a path of loss function (corresponding information criterion or cross-validation loss) is provided. If type = "coefficients", it provides a coefficient profile plot of the coefficient. If type = "both", it combines the path of corresponding information criterion or cross-validation loss with the coefficient profile plot.

breaks

If TRUE, a vertical line is drawn at a specified break point in the coefficient paths.

K

Which break point should the vertical line be drawn at. Default is the optimal model size.

sign.lambda

A logical value indicating whether to show lambda on log scale. Default is 0. Valid for "bess" object obtained from "bsrr".

Other graphical parameters to plot

References

Wen, C., Zhang, A., Quan, S. and Wang, X. (2020). BeSS: An R Package for Best Subset Selection in Linear, Logistic and Cox Proportional Hazards Models, Journal of Statistical Software, Vol. 94(4). doi:10.18637/jss.v094.i04.

See Also

bess.

Examples

Run this code
# NOT RUN {
# Generate simulated data
n <- 200
p <- 20
k <- 5
rho <- 0.4
seed <- 10
Tbeta <- rep(0, p)
Tbeta[1:k*floor(p/k):floor(p/k)] <- rep(1, k)
Data <- gen.data(n, p, k, rho, family = "gaussian", beta = Tbeta, seed = seed)
lm.bss <- bess(Data$x, Data$y, method = "sequential")
lambda.list <- exp(seq(log(5), log(0.1), length.out = 10))
lm.bsrr <- bess(Data$x, Data$y, type = "bsrr", method = "pgsection")

# generate plots
plot(lm.bss, type = "both", breaks = TRUE)
plot(lm.bsrr)


# }

Run the code above in your browser using DataLab