fdPlotGlmnet: Interactive coefficient profile plot for glmnet objects.

Description Usage Arguments Examples

Description

Interactive coefficient profile plot for glmnet objects.

Usage

1
fdPlotGlmnet(x, xvar = c("norm", "lambda", "dev"), title = NULL, ...)

Arguments

x

a glmnet model object

xvar

What is on 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.

title

plot title.

...

extra arguments passed to every series being plotted

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
library(glmnet)
library(flightdeck)
data(QuickStartExample)
fit <- glmnet(x, y)

if (interactive()){
  #' Interctive profiles plot
  fdPlotGlmnet(fit)
  
  # Use lambda as xvar
  fdPlotGlmnet(fit, xvar = 'lambda')
  
  # Don't show legend
  fdPlotGlmnet(fit, showlegend = FALSE)
  
  # Putting everything in a tabset panel
  fdTabsetPanel(selected = 'L1 Norm',
    fdTabPanel('L1 Norm', fdPlotGlmnet(fit, xvar = 'norm')),
    fdTabPanel('Lambda', fdPlotGlmnet(fit, xvar = 'lambda')),
    fdTabPanel('Deviance', fdPlotGlmnet(fit, xvar = 'dev'))
  ) %>%
    fdColumn(width = 12) %>%
    fdPreview(wrap = 'row')
}

alteryx/flightdeck documentation built on May 12, 2019, 1:39 a.m.