lasso {ARGOS} | R Documentation |
Lasso
Description
This function performs lasso regression using the cv.glmnet function, then refits the model using ordinary least squares.
Usage
lasso(data, index, ols_ps = TRUE)
Arguments
data |
A data frame or matrix containing the predictors and response. The response must be in the first column. |
index |
A numeric vector of indices indicating the rows of 'data' to use for the lasso regression. |
ols_ps |
A logical scalar. If TRUE (default), the function returns the coefficients from the OLS fit. If FALSE, it returns the coefficients from the lasso fit. |
Value
A numeric vector of coefficients. If 'ols_ps' is TRUE, these are the coefficients from the OLS fit. If 'ols_ps' is FALSE, these are the coefficients from the lasso fit. If an error occurs during the lasso or OLS fit, the function returns a vector of NAs.
[Package ARGOS version 0.1.1 Index]