create.fixed: Fixed-X knockoffs

View source: R/create_fixed.R

create.fixedR Documentation

Fixed-X knockoffs

Description

Creates fixed-X knockoff variables.

Usage

create.fixed(
  X,
  method = c("sdp", "equi"),
  sigma = NULL,
  y = NULL,
  randomize = F
)

Arguments

X

normalized n-by-p matrix of original variables.(n ≥q p).

method

either "equi" or "sdp" (default: "sdp"). This determines the method that will be used to minimize the correlation between the original variables and the knockoffs.

sigma

the noise level, used to augment the data with extra rows if necessary (default: NULL).

y

vector of length n, containing the observed responses. This is needed to estimate the noise level if the parameter sigma is not provided, in case p ≤q n < 2p (default: NULL).

randomize

whether the knockoffs are constructed deterministically or randomized (default: F).

Details

Fixed-X knockoffs assume a homoscedastic linear regression model for Y|X. Moreover, they only guarantee FDR control when used in combination with statistics satisfying the "sufficiency" property. In particular, the default statistics based on the cross-validated lasso does not satisfy this property and should not be used with fixed-X knockoffs.

Value

An object of class "knockoff.variables". This is a list containing at least the following components:

X

n-by-p matrix of original variables (possibly augmented or transformed).

Xk

n-by-p matrix of knockoff variables.

y

vector of observed responses (possibly augmented).

References

Barber and Candes, Controlling the false discovery rate via knockoffs. Ann. Statist. 43 (2015), no. 5, 2055–2085.

See Also

Other create: create.gaussian(), create.second_order()

Examples

set.seed(2022)
p=50; n=100; k=15
X = matrix(rnorm(n*p),n)
nonzero = sample(p, k)
beta = 5.5 * (1:p %in% nonzero)
y = X %*% beta + rnorm(n)

# Basic usage with default arguments
result = knockoff.filter(X, y, knockoffs=create.fixed)
print(result$selected)

# Advanced usage with custom arguments
knockoffs = function(X) create.fixed(X, method='equi')
result = knockoff.filter(X, y, knockoffs=knockoffs)
print(result$selected) 


knockoff documentation built on Aug. 15, 2022, 9:06 a.m.