View source: R/stats_sqrt_lasso.R
stat.sqrt_lasso | R Documentation |
Computes the signed maximum statistic
W_j = \max(Z_j, \tilde{Z}_j) \cdot \mathrm{sgn}(Z_j - \tilde{Z}_j),
where Z_j and \tilde{Z}_j are the maximum values of λ at which the jth variable and its knockoff, respectively, enter the SQRT lasso model.
stat.sqrt_lasso(X, X_k, y, ...)
X |
n-by-p matrix of original variables. |
X_k |
n-by-p matrix of knockoff variables. |
y |
vector of length n, containing the response variables of numeric type. |
... |
additional arguments specific to |
With default parameters, this function uses the package RPtests
to run the SQRT lasso. By specifying the appropriate optional parameters,
one can use different Lasso variants including Dantzig Selector, LAD Lasso,
SQRT Lasso and Lq Lasso for estimating high dimensional sparse linear models.
For a complete list of the available additional arguments, see sqrt_lasso
.
A vector of statistics W of length p.
Other statistics:
stat.forward_selection()
,
stat.glmnet_coefdiff()
,
stat.glmnet_lambdadiff()
,
stat.lasso_coefdiff_bin()
,
stat.lasso_coefdiff()
,
stat.lasso_lambdadiff_bin()
,
stat.lasso_lambdadiff()
,
stat.random_forest()
,
stat.stability_selection()
set.seed(2022) p=50; n=50; k=10 mu = rep(0,p); Sigma = diag(p) X = matrix(rnorm(n*p),n) nonzero = sample(p, k) beta = 3.5 * (1:p %in% nonzero) y = X %*% beta + rnorm(n) knockoffs = function(X) create.gaussian(X, mu, Sigma) # Basic usage with default arguments result = knockoff.filter(X, y, knockoffs=knockoffs, statistic=stat.sqrt_lasso) print(result$selected) # Advanced usage with custom arguments foo = stat.sqrt_lasso k_stat = function(X, X_k, y) foo(X, X_k, y, q=0.5) result = knockoff.filter(X, y, knockoffs=knockoffs, statistic=k_stat) print(result$selected)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.