srlars: Fast and Scalable Cellwise-Robust Ensemble (FSCRE)

View source: R/srlars.R

srlarsR Documentation

Fast and Scalable Cellwise-Robust Ensemble (FSCRE)

Description

srlars performs the FSCRE algorithm for robust variable selection and regression.

Usage

srlars(
  x,
  y,
  n_models = 5,
  max_share = 1,
  tolerance = 1e-08,
  n_min = NULL,
  max_predictors = NULL,
  x_preprocess = c("ddc", "none"),
  y_preprocess = c("wrap", "robust_z", "none"),
  cor_estimator = c("wrap", "pearson"),
  cv_preprocess = c("global", "foldwise"),
  cv_fit = c("huber", "ls"),
  cv_loss = c("huber", "trimmed", "mse"),
  cv_folds = 5,
  compute_coef = TRUE
)

Arguments

x

Design matrix (n x p).

y

Response vector (n x 1).

n_models

Number of models in the ensemble (K). Default is 5.

max_share

Integer. Maximum number of sub-models (1 to n_models) in which a given variable may appear. Default is 1, i.e. fully disjoint sub-models (the original behavior). When 1 < max_share < n_models, each sub-model's first selected variable is forced to be distinct across sub-models (preventing several sub-models from redundantly duplicating the same strongest cold-start predictor); sharing is only permitted for variables added after a sub-model's first pick, up to max_share total uses. When max_share = n_models, this seed restriction is lifted entirely and sub-models are free to become identical.

tolerance

Relative improvement tolerance for stopping (tau). Default is 1e-8.

n_min

Integer or NULL. Minimum number of variables each sub-model is guaranteed to receive (subject to availability), even if a candidate does not clear the usual positive-benefit or tolerance improvement requirements. Default is NULL, i.e. no floor is enforced (the original behavior: a sub-model can stop growing as soon as no candidate across the whole ensemble shows sufficient CV improvement). Must satisfy n_min <= min(n - 1, p). The floor never bypasses max_share/diversity restrictions on which variables are available to a sub-model – only the CV-benefit acceptance requirement is relaxed for sub-models below the floor.

max_predictors

Maximum total number of variables to select across all models. Default is n * n_models.

x_preprocess

Character. "ddc" (default) for cellwise cleaning, or "none".

y_preprocess

Character. "wrap" (default) for univariate robustification, "robust_z", or "none".

cor_estimator

Character. "wrap" (default) for robust PSD correlation, or "pearson".

cv_preprocess

Character. "global" (default) or "foldwise" (to prevent data leakage).

cv_fit

Character. "huber" (default) or "ls" for the inner arbiter fitting method.

cv_loss

Character. "huber" (default), "trimmed", or "mse" for arbiter scoring.

cv_folds

Integer. Number of cross-validation folds. Default is 5.

compute_coef

Logical. If TRUE, fits the final robust MM-models. Default is TRUE.

Value

An object of class srlars containing the selected variables and coefficients.

Author(s)

Anthony-Alexander Christidis, anthony.christidis@stat.ubc.ca

See Also

coef.srlars, predict.srlars

Examples

# Required libraries
library(mvnfast)
library(cellWise)
library(robustbase)

# Simulation parameters
n <- 50
p <- 100
rho.within <- 0.8
rho.between <- 0.2
p.active <- 20
group.size <- 5
snr <- 3
contamination.prop <- 0.1

# Setting the seed
set.seed(0)

# Block correlation structure
sigma.mat <- matrix(0, p, p)
sigma.mat[1:p.active, 1:p.active] <- rho.between
for(group in 0:(p.active/group.size - 1))
  sigma.mat[(group*group.size+1):(group*group.size+group.size),
  (group*group.size+1):(group*group.size+group.size)] <- rho.within
diag(sigma.mat) <- 1

# Simulation of beta vector
true.beta <- c(runif(p.active, 0, 5)*(-1)^rbinom(p.active, 1, 0.7), rep(0, p - p.active))

# Setting the SD of the variance
sigma <- as.numeric(sqrt(t(true.beta) %*% sigma.mat %*% true.beta)/sqrt(snr))

# Simulation of uncontaminated data
x <- mvnfast::rmvn(n, mu = rep(0, p), sigma = sigma.mat)
colnames(x) <- paste0("V", 1:p)
y <- x %*% true.beta + rnorm(n, 0, sigma)

# Cellwise contamination
contamination_indices <- sample(1:(n * p), round(n * p * contamination.prop))
x_train <- x
x_train[contamination_indices] <- runif(length(contamination_indices), -10, 10)

# FSCRE Ensemble model
ensemble_fit <- srlars(x_train, y,
                       n_models = 5,
                       tolerance = 1e-4,
                       x_preprocess = "ddc",
                       y_preprocess = "wrap",
                       cor_estimator = "wrap",
                       cv_preprocess = "global",
                       cv_fit = "huber",
                       cv_loss = "huber",
                       compute_coef = TRUE)

# Check selected variables
print(ensemble_fit$active.sets)


srlars documentation built on Sept. 23, 2026, 5:10 p.m.