multi.knockoffs: Construction multiple knockoff matrices

Description Usage Arguments Details Value References Examples

View source: R/multiknockfilter.R

Description

This function generates a specified number of knockoff matrices given the data and a knockoff sampling function.

Usage

1
multi.knockoffs(X, K, knockoffs = create.second_order)

Arguments

X

n x p matrix or data frame of original variables.

K

number of knockoff matrices.

knockoffs

function for the knockoff construction. It must take the n x p matrix as input and it must return a n x p knockoff matrix. Either choose a knockoff sampler of the knockoff package or define it manually. Default: create.second_order (see below).

Details

This function requires the installation of the knockoff package prior to its execution.

The default knockoff sampler create.second_order is the second-order Gaussian knockoff construction from the knockoff package.

Value

A list that contains the K knockoff matrices.

References

Candes, Fan, Janson, and Lv (2018). Panning for gold. model-X knockoffs for high dimensional controlled variable selection. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 80(3), 551-577.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
n <- 400; p <- 200
mu <- rep(0,p); rho <- 0.25
Sigma <- toeplitz(rho^(0:(p-1)))
X <- MASS::mvrnorm(n, mu, Sigma)

# Basic usage with default arguments
Xk <- multi.knockoffs(X, K = 5)
Xk

# Advanced usage with customized knockoff construction (equi-correlated)
equi.knock <- function(X) create.second_order(X, method = "equi")
Xk <- multi.knockoffs(X, K = 5, knockoffs = equi.knock)

cKarypidis/multiknockoffs documentation built on Dec. 19, 2021, 12:53 p.m.