L2-depth#

DepthEucl.L2(x: ndarray | None = None, mah_estimate: str = 'moment', mah_parMcd: float = 0.75, evaluate_dataset: bool = False) ndarray[source]

Calculates the L2-depth of points w.r.t. a multivariate data set.

Arguments
x: array-like or None, default=None

Matrix of objects (numerical vector as one object) whose depth is to be calculated; each row contains a d-variate point. Should have the same dimension as data.

mah_estimatestr, {“moment”, “mcd”}, default=”moment”

A character string specifying which estimates to use when calculating the Mahalanobis depth; can be “‘moment’” or 'MCD', determining whether traditional moment or Minimum Covariance Determinant (MCD) estimates for mean and covariance are used.

mah_parMcdfloat, default=0.75

is the value of the argument alpha for the function covMcd; is used when mah.estimate = 'MCD'.

evaluate_datasetbool, default=False

Determines if dataset loaded will be evaluated. Automatically sets x to dataset

References
  • Zuo, Y. and Serfling, R. (2000). General notions of statistical depth function. The Annals of Statistics, 28, 461–482.

  • Mosler, K. and Mozharovskyi, P. (2022). Choosing among notions of multivariate depth statistics. Statistical Science, 37(3), 348-368.

Examples
>>> import numpy as np
>>> from depth.model import DepthEucl
>>> mat1=[[1, 0, 0, 0, 0],[0, 2, 0, 0, 0],[0, 0, 3, 0, 0],[0, 0, 0, 2, 0],[0, 0, 0, 0, 1]]
>>> mat2=[[1, 0, 0, 0, 0],[0, 1, 0, 0, 0],[0, 0, 1, 0, 0],[0, 0, 0, 1, 0],[0, 0, 0, 0, 1]]
>>> data = np.random.multivariate_normal([0,0,0,0,0], mat1, 1000)
>>> model=DepthEucl().load_dataset(data)
>>> x = np.random.multivariate_normal([1,1,1,1,1], mat2, 10)
>>> model.L2(x)
[0.2867197  0.19718391 0.18896649 0.24623271 0.20979579 0.22055673
0.20396566 0.20779032 0.24901829 0.26734192]