Creates a profile plot of the reguarlization paths for a fit group elastic net regularized GLM (grpnet) object.
# S3 method for grpnet
plot(x, type = c("coef", "imp", "norm", "znorm"),
newx, newdata, intercept = FALSE,
color.by.group = TRUE, col = NULL, ...)
Produces a profile plot showing the requested type (y-axis) as a function of log(lambda)
(x-axis).
Object of class "grpnet"
What to plot on the Y-axis: "coef" for coefficient values, "imp" for importance of each group's contribution, "norm" for L2 norm of coefficients for each group, or "znorm" for L2 norm of standardized coefficients for each group.
Matrix of new x
scores for prediction (default S3 method). Ignored unless type = "imp"
.
Data frame of new data
scores for prediction (S3 "formula" method). Ignored unless type = "imp"
.
Should the intercept be included in the plot?
If TRUE
(default), the coefficient paths are colored according to their group membership using the colors in col
. If FALSE
, all coefficient paths are plotted the same color.
If color.by.group = TRUE
, this should be a vector of length \(K\) giving a color label for each group. If color.by.group = FASLE
, this should be a character specifying a single (common) color. Default of col = NULL
is the same as col = 1:K
or col = "black"
.
Additional arguments passed to the plot
function.
Nathaniel E. Helwig <helwig@umn.edu>
Syntax and functionality were modeled after the plot.glmnet
function in the glmnet package (Friedman, Hastie, & Tibshirani, 2010).
Friedman, J., Hastie, T., & Tibshirani, R. (2010). Regularization paths for generalized linear models via coordinate descent. Journal of Statistical Software, 33(1), 1-22. tools:::Rd_expr_doi("10.18637/jss.v033.i01")
Helwig, N. E. (2024). Versatile descent algorithms for group regularization and variable selection in generalized linear models. Journal of Computational and Graphical Statistics. tools:::Rd_expr_doi("10.1080/10618600.2024.2362232")
grpnet
for fitting grpnet regularization paths
plot.cv.grpnet
for plotting cv.grpnet
objects
# see 'grpnet' for plotting examples
?grpnet
Run the code above in your browser using DataLab