stat.sqrt_lasso.Rd
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 \(\lambda\) at which the jth variable and its knockoff, respectively, enter the SQRT lasso model.
stat.sqrt_lasso(X, X_k, y, ...)
A vector of statistics \(W\) of length p.
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 RPtests::sqrt_lasso()
.
Other statistics:
stat.SHAP()
,
stat.forward_selection()
,
stat.glmnet_coefdiff()
,
stat.glmnet_lambdadiff()
,
stat.random_forest()
,
stat.stability_selection()
,
stat.xgboost()
set.seed(2024)
n=80; p=100; k=10; Ac = 1:k; Ic = (k+1):p
X = generate_X(n=n,p=p)
y <- generate_y(X, p_nn=k, a=3)
Xk = create.shrink_Gaussian(X = X, n_ko = 10)
res1 = knockoff.filter(X, y, Xk, statistic = stat.sqrt_lasso,
offset = 1, fdr = 0.1)
res1
#> Call:
#> knockoff.filter(X = X, y = y, Xk = Xk, statistic = stat.sqrt_lasso,
#> fdr = 0.1, offset = 1)
#>
#> Selected variables:
#> [1] 1 2 10
#>
#> Frequency of selected variables from 30 knockoff copys:
#> [1] 10 10 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> [26] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> [51] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> [76] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
perf_eval(res1$shat,Ac,Ic)
#> [1] 0.3 0.0