lasso.cv | R Documentation |
Performs (n-fold) cross-validation of the lasso (via
cv.glmnet
) and determines the prediction
optimal set of parameters.
lasso.cv(x, y,
nfolds = 10,
grouped = nrow(x) > 3*nfolds,
...)
x |
numeric design matrix (without intercept) of dimension |
y |
response vector of length |
nfolds |
the number of folds to be used in the cross-validation |
grouped |
corresponds to the |
... |
further arguments to be passed to
|
The function basically only calls cv.glmnet
, see source
code.
Vector of selected predictors.
Lukas Meier
hdi
which uses lasso.cv()
by default;
cv.glmnet
.
An alternative for hdi()
: lasso.firstq
.
x <- matrix(rnorm(100 * 1000), nrow = 100, ncol = 1000)
y <- x[,1] * 2 + x[,2] * 2.5 + rnorm(100)
sel <- lasso.cv(x, y)
sel
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.