coef.cv.plasso | R Documentation |
cv.plasso
objectExtract coefficients for both Lasso and Post-Lasso from a cv.plasso
object.
## S3 method for class 'cv.plasso'
coef(object, ..., s = c("optimal", "all"), se_rule = 0)
object |
|
... |
Pass generic |
s |
Determines whether coefficients are extracted for all values of lambda ("all") or only for the optimal lambda ("optimal") according to the specified standard error-rule. |
se_rule |
If equal to 0, predictions from cross-validated MSE minimum (default). Negative values go in the direction of smaller
models, positive values go in the direction of larger models (e.g. |
List object containing coefficients for both the Lasso and Post-Lasso models respectively.
lasso |
Sparse |
plasso |
Sparse |
# load toeplitz data
data(toeplitz)
# extract target and features from data
y = as.matrix(toeplitz[,1])
X = toeplitz[,-1]
# fit cv.plasso to the data
p.cv = plasso::cv.plasso(X,y)
# get estimated coefficients along whole lambda sequence
coefs = coef(p.cv, s="all")
head(coefs$plasso)
# get estimated coefficients for optimal lambda value according to 1-standard-error rule
coef(p.cv, s="optimal", se_rule=-1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.