extractPath: extractPath

View source: R/extractPath.r

extractPathR Documentation

extractPath

Description

Extracts the coefficient path of the elastic net

Usage

extractPath(model, ...)

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

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

Arguments

model

A glmnet model

...

Further arguments

intercept

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

Details

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

Value

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

Author(s)

Jared P. Lander

Examples


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)


coefplot documentation built on March 18, 2022, 7:58 p.m.