selOracle: Variable Selection with Oracle

View source: R/selOracle.R

selOracleR Documentation

Variable Selection with Oracle

Description

This function selects a given number of variables, always including those in a pre-specified set.

Usage

selOracle(X, Y, target, toSel)

Arguments

X

numeric design matrix (excluding the intercept), where columns correspond to variables, and rows to observations.

Y

numeric response vector.

target

maximum number of variables to be selected.

toSel

numeric vector containing the indices of the variables to be always selected.

Details

An error message is returned if target is smaller than the length of toSel.

Value

selOracle returns a numeric vector containing the indices of the selected variables. Variables in toSel are always included.

Author(s)

Anna Vesely.

Examples

# generate linear regression data with 20 variables and 10 observations
res <- simData(m1=2, m=20, n=10, rho=0.5, type="toeplitz", SNR=5, seed=42)
X <- res$X # design matrix
Y <- res$Y # response vector
active <- res$active # indices of active variables

# choose target as twice the number of active variables
target <- 2*length(active)

# selection of at most target variables, including the active ones
selOracle(X, Y, target, active)

annavesely/splitFlip documentation built on July 27, 2024, 4:23 a.m.