plot.cva.glmnet: Plot lambda across range of alphas

View source: R/plots.R

plot.cva.glmnetR Documentation

Plot lambda across range of alphas

Description

Different types of plot showing cross-validated tuning of alpha and lambda from elastic net regression via glmnet. If xaxis is set to "lambda", log lambda is on the x axis while the tuning metric (log loss, deviance, accuracy, AUC etc) is on the y axis. Multiple alpha values are shown by different colours. If xaxis is set to "alpha", alpha is on the x axis with the tuning metric on y, with error bars showing metric SD. if xaxis is set to "nvar" the number of non-zero coefficients is shown on x and how this relates to model deviance/ accuracy on y.

Usage

## S3 method for class 'cva.glmnet'
plot(
  x,
  xaxis = c("lambda", "alpha", "nvar"),
  errorBar = (xaxis == "alpha"),
  errorWidth = 0.015,
  min.pch = NULL,
  scheme = NULL,
  palette = "zissou",
  showLegend = "bottomright",
  ...
)

Arguments

x

Object of class 'cva.glmnet'

xaxis

String specifying what is plotted on the x axis, either log lambda, alpha or the number of non-zero coefficients.

errorBar

Logical whether to control error bars for the standard deviation of model deviance when xaxis = 'lambda'. Because of overlapping lines, only the deviance of the top and bottom points at a given lambda are shown.

errorWidth

Width of error bars.

min.pch

Plotting 'character' for the minimum point of each curve. Not shown if set to NULL. See points

scheme

Colour scheme. Overrides the palette argument.

palette

Palette name (one of hcl.pals()) which is passed to hcl.colors

showLegend

Either a keyword to position the legend or NULL to hide the legend.

...

Other arguments passed to plot. Use type = 'p' to plot a scatter plot instead of a line plot.

Value

No return value

Author(s)

Myles Lewis

See Also

nestcv.glmnet


nestedcv documentation built on Oct. 26, 2023, 5:08 p.m.