coef.plasso {plasso}R Documentation

Extract coefficients from a plasso object

Description

Extract coefficients for both Lasso and Post-Lasso from a plasso object.

Usage

## S3 method for class 'plasso'
coef(object, ..., s = NULL)

Arguments

object

plasso object

...

Pass generic coef options

s

If Null, coefficients are returned for all lambda values. If a value is provided, the closest lambda value of the plasso object is used.

Value

List object containing coefficients that are associated with either all values along the lambda input sequence or for one specifically given lambda value for both the Lasso and Post-Lasso models respectively.

lasso

Sparse dgCMatrix-class object with Lasso coefficients

plasso

Sparse dgCMatrix-class object with Post-Lasso coefficients

Examples


# load toeplitz data
data(toeplitz)
# extract target and features from data
y = as.matrix(toeplitz[,1])
X = toeplitz[,-1]
# fit plasso to the data
p = plasso::plasso(X,y)
# get estimated coefficients along whole lambda sequence 
coefs = coef(p)
head(coefs$plasso)
# get estimated coefficients for specific lambda approximation
coef(p, s=0.05)


[Package plasso version 0.1.2 Index]