plasso {plasso} | R Documentation |
Lasso and Post-Lasso
Description
plasso
implicitly estimates a Lasso model using the glmnet
package
and additionally estimates coefficient paths for a subsequent Post-Lasso model.
Usage
plasso(x, y, w = NULL, ...)
Arguments
x |
Matrix of covariates (number of observations times number of covariates matrix) |
y |
Vector of outcomes |
w |
Vector of weights |
... |
Pass |
Value
List including base glmnet
(i.e. Lasso) object and Post-Lasso coefficients.
call |
the call that produced this |
lasso_full |
base |
beta_plasso |
matrix of coefficients for Post-Lasso model stored in sparse column format |
x |
Input matrix of covariates |
y |
Matrix of outcomes |
w |
Matrix of weights |
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)
# plot coefficient paths for Post-Lasso model
plot(p, lasso=FALSE, xvar="lambda")
# plot coefficient paths for Lasso model
plot(p, lasso=TRUE, xvar="lambda")
# get coefficients for specific lambda approximation
coef(p, s=0.05)
# predict fitted values along whole lambda sequence
pred = predict(p)
head(pred$plasso)
[Package plasso version 0.1.2 Index]