plasso | R Documentation |
plasso
implicitly estimates a Lasso model using the glmnet
package
and additionally estimates coefficient paths for a subsequent Post-Lasso model.
plasso(x, y, w = NULL, ...)
x |
Matrix of covariates (number of observations times number of covariates matrix) |
y |
Vector of outcomes |
w |
Vector of weights |
... |
Pass |
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 |
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.