dot-projection_depth_cpp: Projection Depth

.projection_depth_cppR Documentation

Projection Depth

Description

Computes the projection depth of one or more query points with respect to a reference distribution estimated from data, using an adaptive random projection approximation.

Usage

.projection_depth_cpp(
  x,
  data,
  tol = 0.01,
  batch_size = 100L,
  min_batches = 5L,
  patience = 3L,
  seed = 42L
)

Arguments

x

Numeric matrix of query points (m x d), or a numeric vector of length d for a single query point.

data

Numeric matrix of reference data (n x d).

tol

Convergence tolerance for the adaptive stopping rule. Default 0.01.

batch_size

Number of random projections per batch. Default 100.

min_batches

Minimum batches before checking convergence. Default 5.

patience

Consecutive stable batches required to declare convergence. Default 3.

seed

Integer random seed for reproducibility. Default 42.

Details

Projection depth is defined via the Stahel-Donoho outlyingness measure:

O(x, F) = \sup_{u \neq 0} \frac{|u^\top x - \mathrm{med}(u^\top F)|} {\mathrm{MAD}(u^\top F)}

PD(x, F) = \frac{1}{1 + O(x, F)}

where med and MAD are the median and median absolute deviation of the projected distribution. The supremum is approximated by the maximum over random unit vector projections.

Value

Numeric vector of depth values in (0, 1], one per query point.

References

Zuo, Y. & Serfling, R. (2000). General notions of statistical depth function. Annals of Statistics, 28(2), 461–482.

Stahel, W. A. (1981). Robuste Schätzungen: infinitesimale Optimalität und Schätzungen von Kovarianzmatrizen. PhD thesis, ETH Zürich.


depthR documentation built on June 26, 2026, 5:07 p.m.