plot.glmpathcr: Plots the Regularization Path Computed from glmpathcr

plot.glmpathcrR Documentation

Plots the Regularization Path Computed from glmpathcr

Description

This function takes a glmpathcr object and visualizes the regularization path. The horizontal axis can be norm, lambda or step. The vertical axis can be coefficients, aic or bid.

Usage

## S3 method for class 'glmpathcr'
plot(x, xvar = c("norm", "lambda", "step"), 
type = c("coefficients", "aic", "bic"), xlimit = NULL, predictor = FALSE, 
omit.zero = TRUE, breaks = FALSE, mar = NULL, eps = .Machine$double.eps, 
main = NULL, ...)

Arguments

x

a glmpathcr object

xvar

horizontal axis. xvar=norm plots against the L1 norm of the coefficients (to which L1 norm penalty was applied); xvar=lambda plots against \lambda; and xvar=step plots against the number of steps taken. Default is norm.

type

type of the plot, or the vertical axis. Default is coefficients.

xlimit

When the user wants to visualize a (beginning) sub-part of the plot, limit sets an upper limit to the L1 norm or the number of steps, or a lower limit to \lambda.

predictor

If TRUE and type=coefficients, the predictor step estimates are connected with dotted lines. If FALSE, only the corrector step estimates are connected with solid lines

omit.zero

If TRUE and type=coefficients, the predictors that were never in the active set are omitted.

breaks

If TRUE, vertical lines are drawn at the points where the active set changes and numbered with the degrees of freedom.

mar

margin relative to the current font size

eps

an effective zero

main

title of the plot

...

other options for the plot

Note

This function is essentially the same as plot.glmpath from the glmpath package by Park and Hastie but was designed to operate on a returned glmpathcr object.

Author(s)

Mee Young Park and Trevor Hastie; Kellie J. Archer archer.43@osu.edu used here for new glmpathcr class

References

Mee Young Park and Trevor Hastie (2007) L1 regularization path algorithm for generalized linear models. J. R. Statist. Soc. B, 69, 659-677.

See Also

See also glmpathcr, predict.glmpathcr

Examples

data(diabetes)
x <- diabetes[, 2:dim(diabetes)[2]]
y <- diabetes$y
fit <- glmpathcr(x, y)
plot(fit, xvar="norm")

glmpathcr documentation built on July 9, 2023, 6:57 p.m.