Skip to contents

Helper function that returns a consistent output for any DGP function.

Usage

return_DGP_output(X, y, support, data_split, train_prop, return_values)

Arguments

X

Data matrix or data frame.

y

Response vector.

support

Vector of feature indices in the true support of the DGP.

data_split

Logical; if TRUE, splits data into training and test sets according to train_prop.

train_prop

Proportion of data in training set if data_split = TRUE.

return_values

Character vector indicating what objects to return in list. Elements in vector must be one of "X", "y", "support".

Value

A list of the named objects that were requested in return_values. See brief descriptions below.

X

A data.frame.

y

A response vector of length nrow(X).

support

A vector of feature indices indicating all features used in the true support of the DGP.

Note that if data_split = TRUE and "X", "y" are in return_values, then the returned list also contains slots for "Xtest" and "ytest".

Examples

# Return training/test splits using iris data and completely dense support 
dgp_out <- return_DGP_output(X = iris %>% dplyr::select(-Species),
                             y = iris$Species,
                             support = 1:4,
                             data_split = TRUE,
                             train_prop = 0.5,
                             return_values = c("X", "y", "support"))