dot-simplicial_depth_cpp: Liu Simplicial Depth

.simplicial_depth_cppR Documentation

Liu Simplicial Depth

Description

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

Usage

.simplicial_depth_cpp(
  x,
  data,
  tol = 0.05,
  batch_size = 200L,
  min_batches = 3L,
  max_batches = 20L,
  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). Must have at least d+1 rows.

tol

Relative standard error tolerance for the stopping rule. Default 0.05 (5%).

batch_size

Number of random simplices per batch. Default 200.

min_batches

Minimum number of batches before checking convergence. Default 3.

max_batches

Maximum number of batches regardless of convergence. Acts as a hard cap on computation time. Default 20.

seed

Integer random seed for reproducibility. Default 42.

Details

Simplicial depth of a point x with respect to distribution F is defined as the probability that a random simplex formed by d+1 independent draws from F contains x:

SD(x, F) = P(x \in S[X_1, \ldots, X_{d+1}])

where S[X_1, \ldots, X_{d+1}] denotes the closed simplex with vertices X_1, \ldots, X_{d+1}.

This is estimated by sampling random simplices from the empirical distribution and checking containment via barycentric coordinates. The adaptive stopping rule uses the Bernoulli standard error to determine when the estimate has converged.

Value

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

References

Liu, R. Y. (1990). On a notion of data depth based on random simplices. Annals of Statistics, 18(1), 405–414.


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