ggglmnet: Plot nice lasso results from glmnet

Description Usage Arguments Author(s) See Also Examples

View source: R/ggglmnet.R

Description

Input a glmnet object and output a formatted ggplot result of the coefficients.

Usage

1
ggglmnet(fit, beta, intercept)

Arguments

fit

object of class 'glmnet'

beta

class dgCMatrix from extracting coefficients from model fit

intercept

string indicating name of intercept in model results

Author(s)

Margaret L. Hannum

See Also

ggcompetingrisks

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
 ## Not run: 
 ## Gaussian
 x = matrix(rnorm(100 * 20), 100, 20)
 y = rnorm(100)
 fit1 = glmnet(x, y)
 ggglmnet(fit1, coef(fit1), intercept = "(Intercept)")

 ## multinomial
 g4 = sample(1:4, 100, replace = TRUE)
 fit3 = glmnet(x, g4, family = "multinomial")
 # plot coefficients for first level of multinomial endpoint
 ggglmnet(fit3, coef(fit3)$`1`, intercept = "")
 
## End(Not run)

margarethannum/funnum documentation built on June 3, 2020, 8:32 p.m.