Learn R Programming

glmnetcr (version 1.0.2)

plot.glmnet.cr: Plots the Regularization Path Computed from glmnet.cr

Description

This function takes a glmnet.cr 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

## S3 method for class 'glmnet.cr':
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 glmnet.cr 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
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

See Also

See also glmnet.cr, predict.glmnet.cr

Examples

Run this code
library(glmnetcr)
data(diabetes)
x<-diabetes[,2:dim(diabetes)[2]]
y<-diabetes$y
summary(y)
fit<-glmnet.cr(x,y)
plot(fit)
plot(fit,xvar="step",type="bic")

Run the code above in your browser using DataLab