dfCompile.glmnet: Create visualization matrix for a glmnet object

Description Usage Arguments Details Value See Also Examples

View source: R/glmnet.R

Description

For the graphic one could consider this just a smart "melting" ( reshape2's melt) of the beta matrix in the glmnet object.

Usage

1

Arguments

x

glmnet object from glmnet library

Details

data frame returned has the following columns:

.log.lambda

log(lambda) for the lambda values examined

variable

name of variable in the model

beta.value

for the specific variable when log(lambda) was .log.lambda

.norm

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

.dev

deviance ratio, the fraction of (null) deviance explained by the model. 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.

.number.non.zero

number of beta for that .log.lambda value that were non-zero

Value

data frame, see details.

See Also

broom's tidy and use with the same object.

Examples

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

dfCompile.glmnet(glmnet.object) %>% head

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