| Title: | Ball-Codifference Sure Independence Screening |
|---|---|
| Description: | Computes Ball-codifference scores and performs sure independence screening for high-dimensional predictors. The score combines random-ball empirical probabilities with a bounded local codifference weight based on trigonometric characteristic-function contrasts. The functions are intended for marginal screening when moment-based dependence summaries may be unstable or undefined, such as in heavy-tailed data. The implemented methodology is described in Rezapour and Maroufy (2026) "Ball-Codifference Screening for Heavy-Tailed Predictors" <doi:10.48550/arXiv.2607.20821>. |
| Authors: | Mohsen Rezapour [aut, cre] |
| Maintainer: | Mohsen Rezapour <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.3.2 |
| Built: | 2026-10-06 10:25:28 UTC |
| Source: | https://github.com/cran/BCodifSIS |
Computes Ball-codifference scores and performs sure independence screening for high-dimensional predictors. The package provides compiled C routines and R wrappers for ranking predictors by a local codifference-weighted random-ball score.
The main screening function is bcodif_sis(). Lower-level functions are
available for computing scores for one predictor pair or for all columns of a
predictor matrix.
Rezapour, M. and Maroufy, V. (2026). "Ball-Codifference Screening for Heavy-Tailed Predictors". doi:10.48550/arXiv.2607.20821.
bcodif_sis(), bcodif_scores(), bcodif_score_pair()
Computes the Ball-codifference score for one predictor-response pair. The
function bcodif_score() is an alias for bcodif_score_pair().
bcodif_score_pair(x, y, normalize = FALSE, absolute_kappa = FALSE, ridge = 1e-12) bcodif_score(x, y, normalize = FALSE, absolute_kappa = FALSE, ridge = 1e-12)bcodif_score_pair(x, y, normalize = FALSE, absolute_kappa = FALSE, ridge = 1e-12) bcodif_score(x, y, normalize = FALSE, absolute_kappa = FALSE, ridge = 1e-12)
x |
Numeric predictor vector. |
y |
Numeric response vector. |
normalize |
Logical. If |
absolute_kappa |
Logical. If |
ridge |
Nonnegative ridge used only when |
One numeric score.
bcodif_scores(), bcodif_score_slow()
grid <- seq_len(40) x <- sin(grid / 4) + cos(grid / 7) y <- x + 0.5 * sin(grid / 3) bcodif_score_pair(x, y)grid <- seq_len(40) x <- sin(grid / 4) + cos(grid / 7) y <- x + 0.5 * sin(grid / 3) bcodif_score_pair(x, y)
Computes the same unnormalized empirical Ball-codifference score as the compiled routine, but using simple R loops. This function is mainly intended for testing and small examples.
bcodif_score_slow(x, y, absolute_kappa = FALSE)bcodif_score_slow(x, y, absolute_kappa = FALSE)
x |
Numeric predictor vector. |
y |
Numeric response vector. |
absolute_kappa |
Logical. If |
One numeric score.
bcodif_score_pair(), quick_check()
grid <- seq_len(15) x <- sin(grid / 4) + cos(grid / 7) y <- x + sin(grid / 3) fast <- bcodif_score(x, y) slow <- bcodif_score_slow(x, y) all.equal(fast, slow, tolerance = 1e-10)grid <- seq_len(15) x <- sin(grid / 4) + cos(grid / 7) y <- x + sin(grid / 3) fast <- bcodif_score(x, y) slow <- bcodif_score_slow(x, y) all.equal(fast, slow, tolerance = 1e-10)
Computes the empirical Ball-codifference score between each column of X
and the response y. The compiled implementation uses a sorted sweep and
Fenwick-tree updates to avoid a direct cubic loop over all observations for each
ball center.
bcodif_scores(X, y, normalize = FALSE, absolute_kappa = FALSE, ridge = 1e-12)bcodif_scores(X, y, normalize = FALSE, absolute_kappa = FALSE, ridge = 1e-12)
X |
Numeric predictor matrix. Rows are observations and columns are predictors. |
y |
Numeric response vector with length |
normalize |
Logical. If |
absolute_kappa |
Logical. If |
ridge |
Nonnegative ridge used only when |
A numeric vector of scores, one per predictor column. Column names are preserved when available.
bcodif_sis(), bcodif_score_pair()
grid <- seq_len(50) X <- vapply(seq_len(5), function(j) { sin(grid / (j + 1)) + cos(grid * j / 9) }, numeric(50)) y <- X[, 1] + sin(grid / 3) bcodif_scores(X, y)grid <- seq_len(50) X <- vapply(seq_len(5), function(j) { sin(grid / (j + 1)) + cos(grid * j / 9) }, numeric(50)) y <- X[, 1] + sin(grid / 3) bcodif_scores(X, y)
Ranks predictors by their marginal Ball-codifference score and returns the top
d variables. The alias bcodifsis() is provided for users who prefer
a compact function name.
bcodif_sis(X, y, d = NULL, normalize = FALSE, absolute_kappa = FALSE, ridge = 1e-12) bcodifsis(x, y, d = NULL, normalize = FALSE, absolute_kappa = FALSE, ridge = 1e-12) ## S3 method for class 'bcodif_sis' print(x, ...)bcodif_sis(X, y, d = NULL, normalize = FALSE, absolute_kappa = FALSE, ridge = 1e-12) bcodifsis(x, y, d = NULL, normalize = FALSE, absolute_kappa = FALSE, ridge = 1e-12) ## S3 method for class 'bcodif_sis' print(x, ...)
X |
Numeric predictor matrix. Rows are observations and columns are predictors. |
x |
For |
y |
Numeric response vector with length |
d |
Number of variables to retain. The default is |
normalize |
Logical. If |
absolute_kappa |
Logical. If |
ridge |
Nonnegative ridge used only when |
... |
Additional arguments for the print method, currently unused. |
An object of class bcodif_sis, which is a list with components:
ix |
Integer indices of the selected variables. |
scores |
Numeric score for every predictor. |
ranking |
Integer ranking from largest score to smallest score. |
complete.info |
Data frame with variable index, name, statistic, rank, and selection flag. |
d |
Number of retained variables. |
method |
Name of the screening method used. |
normalize |
Whether normalized scores were used. |
absolute_kappa |
Whether the absolute local codifference weight was used. |
call |
Matched function call. |
bcodif_scores(), quick_check()
grid <- seq_len(80) X <- vapply(seq_len(10), function(j) { sin(grid / (j + 1)) + cos(grid * j / 9) }, numeric(80)) y <- X[, 2] + 0.5 * sin(grid / 3) fit <- bcodif_sis(X, y, d = 3) fit$ix head(fit$complete.info)grid <- seq_len(80) X <- vapply(seq_len(10), function(j) { sin(grid / (j + 1)) + cos(grid * j / 9) }, numeric(80)) y <- X[, 2] + 0.5 * sin(grid / 3) fit <- bcodif_sis(X, y, d = 3) fit$ix head(fit$complete.info)
Runs a small self-test. The test compares the compiled score to the slow pure-R score and then fits a small screening example.
quick_check()quick_check()
A list with the compiled score, slow score, their absolute difference, and a
fitted bcodif_sis object.
bcodif_sis(), bcodif_score_slow()
quick_check()quick_check()