lasso.firstq: Determine the first q Predictors in the Lasso Path

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Determines the q predictors that enter the lasso path first.

Usage

1
lasso.firstq(x, y, q, ...)

Arguments

x

numeric design matrix (without intercept) of dimension n * p.

y

response vector of length n.

q

number of predictors that should be selected, a positive integer.

...

optional additional arguments to be passed to glmnet.

Details

The lasso.firstq function calls glmnet in a special way and simply postprocesses its nonzero predictor list, see its source code.

Value

Vector of selected predictors.

Author(s)

Lukas Meier

See Also

hdi; the default choice for hdi(), lasso.cv. glmnet

Examples

1
2
3
4
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


Search within the hdi package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.