create_knockoffs: Create knockoffs

Description Usage Arguments Details Value Source Examples

View source: R/create_knockoffs.R

Description

Creates knockoff variables for fixed design matrix.

Usage

1
create_knockoffs(X, y, method = c("sdp", "equi"), randomize = FALSE)

Arguments

X

n-by-p design matrix, with n > p.

y

response vector of length n. This is used in the setting in which n < 2p, to estimate sigma hat and generate additional rows in X and y.

method

either "equi" or "sdp" (default: "sdp"). These are two different methods to generate the p-dimensional s vector, which is used to constuct the knockoff variables.

randomize

If true, U tilde is a random matrix. If false, U tilde is the second half of the matrix Q, where Q is part of the QR decomposition of an nx2p matrix [U\ 0], where X = UDV^T. default is false.

Details

This creates p knockoff variables for a fixed design matrix of size n by p. These knockoffs can be used to provably control the false discovery rate (FDR) for the linear model with iid Gaussian errors.

Value

A list containing:

X

n-by-p design matrix, rescaled so that ||X_j||^2_2 = 1, and augmented if n < 2p.

X_knock

n-by-p matrix of knockoff variables.

y

vector of observed responses (augmented if n < 2p).

Source

Barber and Candes, Controlling the false discovery rate via knockoffs. Ann. Statist. 43 (2015), no. 5, 2055–2085. https://projecteuclid.org/euclid.aos/1438606853

Examples

1
2
3
4
5
6
p <- 50; n <- 100; k <- 5
X <- matrix(stats::rnorm(n*p), nrow = n)
true_covar <- sample(p, k)
beta <- 5 * (1:p %in% true_covar)
y <- X %*% beta + stats::rnorm(n, mean = 0, sd = 1)
knock <- create_knockoffs(X, y, method = 'sdp')

svteichman/prelim.knockoffs documentation built on May 28, 2020, 5:14 p.m.