Performs randomization tests of features identified by the Lasso
feature.test(x, y, B = 100, type.measure = "deviance", s = "lambda.min", keeplambda = FALSE, olsestimates = TRUE, penalty.factor = rep(1, nvars), alpha = 1, control = list(trace = FALSE, maxcores = 24), ...)
x | input matrix, of dimension nobs x nvars; each row is an observation vector. |
---|---|
y | quantitative response variable of length nobs |
B | The number of randomizations used in the computations |
type.measure | loss to use for cross-validation. See |
s | Value of the penalty parameter 'lambda' at which predictions are
required. Default is the entire sequence used to create the model. See
|
keeplambda | If set to |
olsestimates | Logical. Should the test statistic be based on OLS
estimates from the model based on the variables selected by the lasso.
Defaults to |
penalty.factor | a vector of weights used for adaptive lasso. See
|
alpha | The elasticnet mixing parameter. See |
control | A list of options that control the algorithm. Currently
|
… | Other arguments passed to |
Returns a list of 7 variables:
The p-value for the test of the full set of variables selected by the lasso (based on the OLS estimates)
A vector of the indices of the non-zero
variables selected by glmnet
sorted from (numerically) highest to
lowest based on their ols test statistic.
The p-value for the maximum of the OLS test statistics
A vector of
the indices of the non-zero variables selected by glmnet
sorted from
(numerically) highest to lowest based on their absolute lasso coefficients.
The p-value for the maximum of the lasso test statistics
The value of lambda used in the computations
The number of permutations used
Brink-Jensen, K and Ekstrom, CT 2014. Inference for feature selection using the Lasso with high-dimensional data. http://arxiv.org/abs/1403.4296
glmnet
# Simulate some data x <- matrix(rnorm(30*100), nrow=30) y <- rnorm(30, mean=1*x[,1]) # Make inference for features# NOT RUN { feature.test(x, y) # }