plot.grpnet {grpnet}R Documentation

Plot Coefficients for grpnet Fits

Description

Creates a profile plot of the coefficient paths for a fit group elastic net regularized GLM (grpnet) object.

Usage

## S3 method for class 'grpnet'
plot(x, type = c("coef", "imp", "norm", "znorm"),
     newx, newdata, intercept = FALSE,
     color.by.group = TRUE, col = NULL, ...)

Arguments

x

Object of class "grpnet"

type

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.

newx

Matrix of new x scores for prediction (default S3 method). Ignored unless type = "imp".

newdata

Data frame of new data scores for prediction (S3 "formula" method). Ignored unless type = "imp".

intercept

Should the intercept be included in the plot?

color.by.group

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.

col

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.

Details

Syntax and functionality were modeled after the plot.glmnet function in the glmnet package (Friedman, Hastie, & Tibshirani, 2010).

Value

Produces a profile plot showing the requested type (y-axis) as a function of log(lambda) (x-axis).

Note

If x is a multinomial model, the coefficients for each response class are plotted in a separate plot.

Author(s)

Nathaniel E. Helwig <helwig@umn.edu>

References

Friedman, J., Hastie, T., & Tibshirani, R. (2010). Regularization paths for generalized linear models via coordinate descent. Journal of Statistical Software, 33(1), 1-22. doi:10.18637/jss.v033.i01

See Also

grpnet for fitting grpnet regularization paths

plot.cv.grpnet for plotting cv.grpnet objects

Examples

# see 'grpnet' for plotting examples
?grpnet

[Package grpnet version 0.3 Index]