coefplot (version 1.2.7)

extractPath: extractPath

Description

Extracts the coefficient path of the elastic net

Usage

extractPath(model, ...)

# S3 method for glmnet extractPath(model, intercept = FALSE, ...)

# S3 method for cv.glmnet extractPath(model, ...)

Arguments

model

A glmnet model

Further arguments

intercept

If FALSE (the default), no intercept will be provided

Value

A link[tibble]{tibble} holding the coefficients for various lambdas

Details

This is a replacement plot for visualizing the coefficient path resulting from the elastic net.

Examples

Run this code
# NOT RUN {
library(glmnet)
data(diamonds, package='ggplot2')
diaX <- useful::build.x(price ~ carat + cut + x - 1, data=diamonds, contrasts = TRUE)
diaY <- useful::build.y(price ~ carat + cut + x - 1, data=diamonds)
modG1 <- glmnet(x=diaX, y=diaY)
extractPath(modG1)

modG2 <- cv.glmnet(x=diaX, y=diaY, nfolds=5)
extractPath(modG2)

# }

Run the code above in your browser using DataLab