| Title: | Geometric Multivariate Outlier Detection via Random Directional Probing |
|---|---|
| Description: | Provides tools for multivariate outlier detection based on geometric properties of multivariate data using random directional projections. Observation-level outlier scores are computed by jointly probing radial magnitude and angular alignment through repeated projections onto random directions, with optional robust centering and covariance adjustment. In addition to global outlier scoring, the method produces dimension-level contribution measures to support interpretation of detected anomalies. Visualization utilities are included to summarize directional contributions for extreme observations. |
| Authors: | Polychronis Economou [aut, cre] |
| Maintainer: | Polychronis Economou <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-06-08 09:37:31 UTC |
| Source: | https://github.com/cran/outlierspinner |
Computes multivariate outlier scores using random directional probing of standardized observations. The method captures both radial extremeness and angular alignment by projecting observations onto multiple random directions ("spins") and aggregating projection-based deviations.
spinner_outlier_score( X, n_spins = 1000, robust = TRUE, cov_adjust = TRUE, contrib_quantile = 0.9, plot_top_n = NULL, make_contrib_plot = FALSE, seed = NULL )spinner_outlier_score( X, n_spins = 1000, robust = TRUE, cov_adjust = TRUE, contrib_quantile = 0.9, plot_top_n = NULL, make_contrib_plot = FALSE, seed = NULL )
X |
A numeric matrix or data frame of dimension |
n_spins |
Integer specifying the number of random directions for directional probing. Larger values increase stability at higher computational cost. |
robust |
Logical; if |
cov_adjust |
Logical; if |
contrib_quantile |
Numeric in |
plot_top_n |
Optional integer; if provided and
|
make_contrib_plot |
Logical; if |
seed |
Optional integer seed for reproducibility of random spinner directions. |
In addition to a global outlier score, the function provides dimension-level contribution measures that attribute each observation's outlyingness to the original variables, enabling post hoc interpretability.
Robust centering, scaling, and optional covariance adjustment ensure affine invariance and resistance to marginal contamination.
The Spinner score combines two complementary components:
Radial deviation, measured as squared deviations of projections from their marginal centers.
Angular alignment, capturing whether an observation consistently aligns with specific directions in high-dimensional space.
Dimension-level contributions are computed by backprojecting influential spinner directions to the original coordinate system. Only directions with large projection magnitudes are retained, preserving rotational invariance while enabling interpretability.
The method is motivated by ongoing research. A detailed theoretical treatment and empirical evaluation are provided in a manuscript currently under review.
A list with the following components:
Numeric vector of length with Spinner outlier scores.
Numeric vector capturing angular alignment per observation.
Mean absolute projection per observation across all spinner directions.
Matrix of signed projections of observations onto spinner directions.
Matrix of raw dimension-level contributions per observation.
Row-normalized contributions, interpretable as relative attribution weights.
List of influential spinner directions selected for each observation.
A ggplot2 object showing contributions for the most extreme observations, or NULL.
Number of random directions used.
Vector of location estimates used for centering.
Logical indicating whether covariance adjustment was applied.
Economou, P. (2026). Spinner: A Geometric Multivariate Outlier Detection Method Using Random Directional Probing. Manuscript under review.
set.seed(123) X <- matrix(rnorm(40), ncol = 4) res <- spinner_outlier_score( X, n_spins = 100, robust = TRUE, cov_adjust = TRUE, contrib_quantile = 0.9, plot_top_n = 3, make_contrib_plot = TRUE ) head(res$score) if (!is.null(res$contrib_plot)) print(res$contrib_plot)set.seed(123) X <- matrix(rnorm(40), ncol = 4) res <- spinner_outlier_score( X, n_spins = 100, robust = TRUE, cov_adjust = TRUE, contrib_quantile = 0.9, plot_top_n = 3, make_contrib_plot = TRUE ) head(res$score) if (!is.null(res$contrib_plot)) print(res$contrib_plot)