This function generates sequential knockoff copies of the input data frame X. Sequential knockoffs simulate new variables for each column of X using the seq_simulator, which by default is glmnet.recovery. This default method fits elastic-net models to sequentially generate knockoffs.

create.seq(X, n_ko = 1, seq_simulator = glmnet.recovery, verbose = FALSE, ...)

Arguments

X

A data frame or tibble with numeric and factor columns only. The number of columns, ncol(X), must be greater than 2.

n_ko

Integer. The number of knockoff matrices to generate. Default is 1.

seq_simulator

Function that simulates sequential knockoffs. Default is glmnet.recovery, which simulates responses from an estimated elastic-net model.

verbose

Logical. Whether to display progress information during the knockoff generation. Default is FALSE.

...

Additional parameters passed to seq_simulator. For the default elastic-net method, these are passed to cv.glmnet.

Value

A list of data frames or tibbles, each containing the sequential knockoff copies of X, with the same type and dimensions as the original X.

Details

create.seq performs sequential knockoff simulations using elastic-net regression as the default method. It loops over the columns of X and generates knockoffs for each column, using the other columns as predictors.

Examples

set.seed(1)
X <- generate_X(n = 100, p = 6, p_b = 2, cov_type = "cov_equi", rho = 0.5)
Xk <- create.seq(X)