plot.glmnetcr: Plots the Regularization Path Computed

Description Usage Arguments Note Author(s) See Also Examples

View source: R/plot.glmnetcr.R

Description

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

Usage

1
2
3
4
## S3 method for class 'glmnetcr'
plot(x, xvar = c("norm", "lambda", "step"),
type = c("coefficients", "aic", "bic"), omit.zero = TRUE, breaks = TRUE, mar = NULL,
eps = .Machine$double.eps, main = NULL, ...)

Arguments

x

a glmnetcr 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 λ; 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".

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 was adapted from the glmpath package by Park and Hastie for a glmnetcr object.

Author(s)

Kellie J. Archer archer.43@osu.edu

See Also

See also glmnetcr, predict.glmnetcr

Examples

1
2
3
4
5
6
7
8
library(glmnetcr)
data(diabetes)
x<-diabetes[,2:dim(diabetes)[2]]
y<-diabetes$y
summary(y)
fit<-glmnetcr(x,y)
plot(fit)
plot(fit,xvar="step",type="bic")

glmnetcr documentation built on July 8, 2020, 6:21 p.m.