lasso.firstq | R Documentation |
Determines the q predictors that enter the lasso path first.
lasso.firstq(x, y, q, ...)
x |
numeric design matrix (without intercept) of dimension |
y |
response vector of length |
q |
number of predictors that should be selected, a positive integer. |
... |
optional additional arguments to be passed to |
The lasso.firstq
function calls
glmnet
in a special way and simply postprocesses its
nonzero predictor list, see its source code.
Vector of selected predictors.
Lukas Meier
hdi
;
the default choice for hdi()
, lasso.cv
.
glmnet
x <- matrix(rnorm(100 * 1000), nrow = 100, ncol = 1000)
y <- x[,1] * 2 + x[,2] * 2.5 + rnorm(100)
sel <- lasso.firstq(x, y, q = 5)
sel # 5 integers from {1,2, ..., 1000}, including '1' and '2', typically
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.