MFKnockoffs.stat.forward_selection: Forward selection statistics for MFKnockoffs

Description Usage Arguments Details Value See Also Examples

Description

Computes the statistic

W_j = \max(Z_j, Z_{j+p}) \cdot \mathrm{sgn}(Z_j - Z_{j+p}),

where Z_1,…,Z_{2p} give the reverse order in which the 2p variables (the originals and the knockoffs) enter the forward selection model. See the Details for information about forward selection.

Usage

1

Arguments

X

original design matrix (size n-by-p)

X_k

knockoff matrix (size n-by-p)

y

response vector (length n). It should be numeric

omp

whether to use orthogonal matching pursuit. Default is FALSE

Details

In forward selection, the variables are chosen iteratively to maximize the inner product with the residual from the previous step. The initial residual is always y. In standard forward selection (MFKnockoffs.stat.forward_selection), the next residual is the remainder after regressing on the selected variable; when orthogonal matching pursuit is used (MFKnockoffs.stat.forward_selection_omp), the next residual is the remainder after regressing on all the previously selected variables.

Value

A vector of statistics W (length p)

See Also

Other statistics for knockoffs: MFKnockoffs.stat.glmnet_coef_difference, MFKnockoffs.stat.glmnet_lambda_difference, MFKnockoffs.stat.lasso_coef_difference_bin, MFKnockoffs.stat.lasso_coef_difference, MFKnockoffs.stat.lasso_lambda_difference_bin, MFKnockoffs.stat.lasso_lambda_difference, MFKnockoffs.stat.random_forest, MFKnockoffs.stat.sqrt_lasso, MFKnockoffs.stat.stability_selection

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
p=100; n=200; k=15
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)

# Basic usage with default arguments
knockoffs = function(X) MFKnockoffs.create.gaussian(X, mu, Sigma)
result = MFKnockoffs.filter(X, y, knockoffs=knockoffs,
                           statistic=MFKnockoffs.stat.forward_selection)
print(result$selected)

# Advanced usage with custom arguments
foo = MFKnockoffs.stat.forward_selection
k_stat = function(X, X_k, y) foo(X, X_k, y, omp=TRUE)
result = MFKnockoffs.filter(X, y, knockoffs=knockoffs, statistic=k_stat)
print(result$selected)

MFKnockoffs documentation built on May 2, 2019, 6:33 a.m.