ggDiagnose.glmnet: Diagnostic plot for glmnet object (ggplot based)

Description Usage Arguments Details Value See Also Examples

View source: R/glmnet.R

Description

#' This function creates a ggplot graphic version of plot.glmnet for glmnet objects.

Usage

1
2
ggDiagnose.glmnet(x, xvar = c("norm", "lambda", "dev"), label = FALSE,
  show.plot = TRUE, return = FALSE, ...)

Arguments

x

glmnet object from glmnet library

xvar

string for x axis variable (see details)

label

logic to label each beta value's line with an integer value

show.plot

logic to display the plot

return

logic to return list the graphic and the data frame to make the majority of the graphic

...

extra attributes (currently not used)

Details

For xvar you have the option of selecting

"norm"

The L_1 norm of the beta values for each specific lambda. That is, ∑_{i=1}^p beta_i(λ)

"lambda"

The lambda value examined

"dev"

The deviance ratio, the fraction of (null) deviance explained by the model at each specific lambda examined. The deviance is defined to be 2*(loglike_sat - loglike), where loglike_sat is the log-likelihood for the saturated model (a model with a free parameter per observation). Hence .dev=1-dev/nulldev.

This will be the value of the variable on the x axis.

Value

depending on show.plot and return it will return the visualization of the graphic and/or a list of both the data frame used the make the majority of the graphic and the graphic object itself.

See Also

see dfCompile.glmnet for data creation.

Examples

1
2
3
4
5
6
7
8
library(tidyverse)
library(glmnet)
glmnet.object <- glmnet(y = iris$Sepal.Length,
                        x = model.matrix(Sepal.Length~., data = iris))

plot(glmnet.object)

ggDiagnose.glmnet(glmnet.object)

benjaminleroy/ggDiagnose documentation built on May 4, 2019, 3:07 a.m.