multiple_knockoff_Gaussian: Generating multiple knockoff variables

Description Usage Arguments Value Examples

View source: R/generate_X.R

Description

This function samples multivariate Gaussian model-X knockoff variables multiple times for each original variable

Usage

1
2
3
4
5
6
7
8
multiple_knockoff_Gaussian(
  X,
  mu,
  Sigma,
  omega,
  type = c("entropy", "sdp", "equi"),
  diag_s = NULL
)

Arguments

X

A n-by-p matrix of original variables

mu

A p vector of mean parameter of the Gaussian distribution of the original variables

Sigma

A p-by-p covariance matrix of the original variables

omega

A p vector indicating the weights for each variable. For now, we require each entry to be an integer greater than or equal to 2.

type

Could be "entropy" (default), "sdp" or "equal", indicating the method that will be used to construct the knockoff variables.

diag_s

A p vector of pre-computed (user-specified) covariance between the original and the knockoff variables. This will be computed according to method, if not supplied.

Value

a n-by-p * max{omega - 1} matrix containing the constructed knockoff variables. Although we construct the same number of knockoffs for all variables (which is the maximum cost), in subsequent steps, we only use the number of knockoffs based on the feature costs.

Examples

1
2
3
4
5
6
7
8
9
library(cheapknockoff)
set.seed(123)
n <- 100
p <- 30
x <- matrix(data = rnorm(n * p), nrow = n, ncol = p)
y <- x[, 1] - 2 * x[, 2] + rnorm(n)
omega <- c(2, 9, sample(seq(2, 9), size = 28, replace = TRUE))
# construct multiple knockoffs
X_k <- multiple_knockoff_Gaussian(X = x, mu = rep(0, p), Sigma = diag(1, p), omega = omega)

hugogogo/cheapknockoff documentation built on Sept. 15, 2021, 1:06 p.m.