ggplot.glmnet: ggplot coefficients from a 'glmnet' object

Description Usage Arguments See Also Examples

View source: R/ggplot_glmnet.R

Description

ggplot2 version of function plot.glmnet() available in package 'glmnet'

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'glmnet'
ggplot(
  object,
  xvar = c("norm", "lambda", "dev"),
  lty = 1,
  col = 1,
  label = FALSE,
  ...
)

Arguments

object

fitted 'glmnet' model

xvar

a character vector specifying the x-axis: "norm" plots against the L1-norm of the coefficients, "lambda" against the log-lambda sequence, and "dev" against the percent deviance explained.

lty

linetype specification (recycling if necessary)

col

color specification (recycling if necessary)

label

If TRUE, label the curves with variable sequence numbers.

...

additional arguments

See Also

plot.glmnet

Examples

1
2
3
4
5
6
x = matrix(rnorm(100*20),100,20)
y = rnorm(100)
fit = glmnet(x,y)
ggplot(fit)
ggplot(fit, xvar = "lambda", col = palette(), label = TRUE)
ggplot(fit1, xvar = "dev", col = palette()[1:4], lty = 1:3)

luca-scr/smef documentation built on Feb. 22, 2022, 8:32 p.m.