plot.cv.glmnetr {glmnetr}R Documentation

Plot cross-validation deviances, or model coefficients.

Description

By default, with coefs=FALSE, plots the average deviances as function of lam (lambda) and gam (gamma), and also indicates the gam and lam which minimize deviance based upon a cv.glmnetr() output object. Optionally, with coefs=TRUE, plots the relaxed lasso coefficients.

Usage

## S3 method for class 'cv.glmnetr'
plot(
  x,
  gam = NULL,
  lambda.lo = NULL,
  plup = 0,
  title = NULL,
  coefs = FALSE,
  comment = TRUE,
  ...
)

Arguments

x

a cv.glmnetr() output object.

gam

a specific level of gamma for plotting. By default gamma.min will be used.

lambda.lo

a lower limit of lambda when plotting.

plup

an indicator to plot the upper 95 percent two-sided confidence limits.

title

a title for the plot.

coefs

default of FALSE plots deviances, option of TRUE plots coefficients.

comment

default of TRUE to write to console information on lam and gam selected for output. FALSE will suppress this write to console.

...

Additional arguments passed to the plot function.

Value

This program returns a plot to the graphics window, and may provide some numerical information to the R Console. If gam is not specified, then then the gamma.min from the deviance minimizing (lambda.min, gamma.min) pair will be used, and the corresponding lambda.min will be indicated by a vertical line, and the lambda minimizing deviance under the restricted set of models where gamma=0 will be indicated by a second vertical line.

See Also

plot.glmnetr , plot.nested.glmnetr , cv.glmnetr

Examples

# set seed for random numbers, optionally, to get reproducible results
set.seed(82545037)
sim.data=glmnetr.simdata(nrows=100, ncols=100, beta=NULL)
xs=sim.data$xs 
y_=sim.data$y_ 
event=sim.data$event
# for this example we use a small number for folds_n to shorten run time 
cv_glmnetr_fit = cv.glmnetr(xs, NULL, y_, NULL, family="gaussian", folds_n=3, limit=2) 
plot(cv_glmnetr_fit)
plot(cv_glmnetr_fit, coefs=1)


[Package glmnetr version 0.5-2 Index]