View source: R/projection_depth.R
| projection_depth | R Documentation |
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 with parallel computation.
projection_depth(
x,
data,
tol = 0.01,
batch_size = 100L,
min_batches = 5L,
patience = 3L,
seed = 42L
)
x |
Numeric matrix of query points (m x d), or a numeric vector of length d for a single 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 to declare convergence. Default 3. |
seed |
Integer random seed for reproducibility. Default 42. |
Projection depth is defined via the Stahel-Donoho outlyingness — the supremum over all directions of the robust univariate Z-score of the projected point, using median and MAD as location and scale. This makes it fully robust with a high breakdown point, and affine invariant.
The deepest point under projection depth is a genuine robust estimator of multivariate location.
Numeric vector of depth values in (0, 1], one per query point.
Zuo, Y. & Serfling, R. (2000). General notions of statistical depth function. Annals of Statistics, 28(2), 461–482.
set.seed(42)
data <- matrix(rnorm(500), nrow = 100, ncol = 5)
x <- matrix(rnorm(25), nrow = 5, ncol = 5)
projection_depth(x, data)
dd <- compute_depth(data, depth_fn = projection_depth)
median(dd)
outliers(dd)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.