TRexSelector: T-Rex Selector

TRexSelectorR Documentation

T-Rex Selector

Description

FDR-controlled variable selection algorithm.

Active bindings

.ptr

Get internal pointer.

.ptr_X

internal proxy for data size

selected_var

Logical vector indicating which variables were selected.

selected_indices

Integer vector of selected 1-based indices.

v_thresh

The chosen voting threshold.

T_stop

Stopping time: the number of included dummies at which the T-loop stopped, so the random experiments ran until T_stop dummies were included. For T_stop > 1 it is not the stopping time of the selection: the selection is taken from the stopping times 1 to T_stop - 1, mostly from T_stop - 1 and sometimes from an earlier one (see select()).

L

Calibrated dummy multiplier L (the selector uses L * p dummies).

voting_grid

Voting levels 0.5, 0.5 + 1/K, ..., 1 - eps that the selection searches.

fdp_hat_mat

Estimated false discovery proportion per T step (rows) and voting level (columns).

phi_mat

Relative occurrences of the original variables over the K random experiments after each T step (rows).

r_mat

Number of selected variables per stopping time (rows) and voting level (columns). It has T_stop - 1 rows, the stopping time T_stop is not part of it, and one row for T_stop = 1.

phi_prime

Calibrated relative occurrences used by the FDP estimate (length p), at most 1 and possibly negative.

x_means

Column means of X that the selector subtracted (zeros under scaling_mode = "NONE").

x_l2_norms

Scale divisors of the columns of X: the L2 norms of the centered columns under scaling_mode = "L2", the sample standard deviations under "ZSCORE", ones under "NONE".

y_mean

Mean of y that the selector subtracted (0 under scaling_mode = "NONE").

tFDR

The target FDR level.

K

The number of random experiments.

max_num_dummies

The cap of the dummy multiplier, max_dummy_multiplier of trex_control(): the L-loop adds dummies up to this many times the number of variables. The field holds a multiplier, not a number of dummies.

max_T_stop

Whether the bound on the stopping time is on, use_max_T_stop of trex_control(): the T-loop then ends at ceiling(n / 2) at the latest. The field holds a logical, not a stopping time.

stagnation_check

Whether the T-loop stops on stagnation, tloop_stagnation_stop of trex_control() after the default by the solver family is resolved.

num_selected

The number of selected variables.

num_dummies

The number of dummies used by the last select() (the L-loop's calibration).

Methods

Public methods


TRexSelector$new()

Create a new TRexSelector object.

Usage
TRexSelector$new(
  X,
  y,
  tFDR = 0.1,
  seed = -1,
  verbose = TRUE,
  control = trex_control()
)
Arguments
X

Feature matrix in memory, or an mmap_matrix, the handle of a memory-mapped file. A numeric matrix of type double and a memory-mapped file are bound without a copy. Any other matrix or a data frame is converted first, which is a copy. The selector standardizes a memory-mapped design in place and restores it, which needs "readwrite" mode. Under scaling_mode = "NONE" it writes nothing and "readonly" mode suffices.

y

Response vector. The selector works on a copy of it.

tFDR

Target FDR level in [0, 1] (default: 0.1).

seed

Random seed (default: -1). A seed of 0 or more makes the run deterministic and reproducible: the same seed draws the same dummies. A negative seed draws them from the hardware entropy source, and the run is not reproducible bit by bit. A Monte Carlo study gives every trial a seed of its own, or uses -1.

verbose

Whether to print progress (default: TRUE).

control

A control list from trex_control() (default: trex_control()).


TRexSelector$restore()

Give X back before select(): undo the in-place normalization applied at construction and release the buffer claim (idempotent; a no-op after select(), which restores X itself). A restored selector cannot run: select() then errors, construct a new one. Without it, an unselected selector gives X back only when it is garbage-collected.

Usage
TRexSelector$restore()
Returns

Invisibly returns self.


TRexSelector$select()

Run the TRexSelector algorithm. A selector runs once: select() gives X back when it ends, so a second call is an error instead of a run on a design that is no longer standardized. Construct a new selector to run again. The fields keep the results of the run. A select() that ends with an error gives X back at once (original scale) and retires the selector as well.

The T-loop raises the stopping time until the FDP estimate at the highest voting level exceeds tFDR, or until its bound or the stagnation stop ends it, and T_stop is where it stopped. The selection is the cell with the largest number of selected variables among the stopping times 1 to T_stop - 1 (the stopping time 1 for T_stop = 1) and the voting levels whose FDP estimate does not exceed tFDR. Among equal counts the highest voting level wins, then the latest stopping time. The stopping time of the selection is therefore below T_stop, mostly by one and sometimes by more.

Usage
TRexSelector$select()
Returns

invisible(self)


TRexSelector$clone()

The objects of this class are cloneable with this method.

Usage
TRexSelector$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

References

J. Machkour, M. Muma, and D. P. Palomar, "The Terminating-Random Experiments Selector: Fast High-Dimensional Variable Selection with False Discovery Rate Control," Signal Process., vol. 231, Art. no. 109894, 2025, doi: 10.1016/j.sigpro.2025.109894.

See Also

Other T-Rex selectors and controls: Gauss_data, TRexBiobankScreeningSelector, TRexDASelector, TRexGVSSelector, TRexSPCASelector, TRexScreeningSelector, TRexTikhonovSelector, trex_biobank_control(), trex_build_group_centering_k(), trex_control(), trex_da_control(), trex_default_lambda2_grid(), trex_dummy_distribution(), trex_fdp(), trex_fdp_dense(), trex_gamma_to_k(), trex_get_num_threads(), trex_gvs_control(), trex_gvs_lambda2_power_rule(), trex_normalize_design(), trex_precision(), trex_recall(), trex_screen_control(), trex_spca_control(), trex_tikhonov_control(), trex_tikhonov_lambda2_power_rule(), trex_tpp(), trex_tpp_dense()

Examples


data(Gauss_data)
X <- Gauss_data$X
y <- Gauss_data$y
sel <- TRexSelector$new(X, y, tFDR = 0.1, verbose = FALSE)
sel$select()
sel$selected_indices


TRexSelector documentation built on Nov. 20, 2026, 5:09 p.m.