Spatial depth#

MCD_fun(data, alpha, NeedLoc=False)[source]#
spatial(x, data, mah_estimate='moment', mah_parMcd=0.75)[source]#
Description

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

Arguments
x

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

data

Matrix of data where each row contains a d-variate point, w.r.t. which the depth is to be calculated.

mah_estimate

String character specifying which estimates to use when calculating sample covariance matrix. It can be 'none', 'moment' or 'MCD', determining whether traditional moment or Minimum Covariance Determinant (MCD) estimates for mean and covariance are used. By default 'moment' is used. With 'none' the non-affine invariant version of spatial depth is calculated.

mah_parMcd

Argument alpha for the function covMcd is used when mah.estimate='MCD'.

References
  • Serfling, R. (2002). A depth function and a scale curve based on spatial quantiles. In Dodge, Y. (Ed.), Statistical Data Analysis Based on the L1-Norm and Related Methods, Statisctics in Industry and Technology, Birkhäuser, Basel, 25–38.

Examples
>>> import numpy as np
>>> from depth.multivariate import *
>>> 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]]
>>> x = np.random.multivariate_normal([1,1,1,1,1], mat2, 10)
>>> data = np.random.multivariate_normal([0,0,0,0,0], mat1, 1000)
>>> spatial(x, data)
[0.22548919451212823, 0.14038895785356165, 0.2745517635029123, 0.35450156620496354,
0.42373722245348566, 0.34562025044812095, 0.3585616673301636, 0.16916309940691643,
0.573349631625784, 0.32017213635679687]