depth.spatial: Calculate Spatial Depth

View source: R/depth.spatial.r

depth.spatialR Documentation

Calculate Spatial Depth


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


depth.spatial(x, data, mah.estimate = "moment", mah.parMcd = 0.75)



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.


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


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


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


Calculates spatial depth. Spatial depth (also L1-depth) is a distance-based depth exploiting the idea of spatial quantiles of Chaudhuri (1996) and Koltchinskii (1997), formulated by Vardi & Zhang (2000) and Serfling (2002).


Numerical vector of depths, one for each row in x; or one depth value if x is a numerical vector.


Chaudhuri, P. (1996). On a geometric notion of quantiles for multivariate data. Journal of the Americal Statistical Association 91 862–872.

Koltchinskii, V.I. (1997). M-estimation, convexity and quantiles. The Annals of Statistics 25 435–477.

Serfling, R. (2006). Depth functions in nonparametric multivariate inference. In: Liu, R., Serfling, R., Souvaine, D. (eds.), Data Depth: Robust Multivariate Analysis, Computational Geometry and Applications, American Mathematical Society, 1–16.

Vardi, Y. and Zhang, C.H. (2000). The multivariate L1-median and associated data depth. Proceedings of the National Academy of Sciences, U.S.A. 97 1423–1426.

See Also

depth.halfspace for calculation of the Tukey depth.

depth.Mahalanobis for calculation of Mahalanobis depth.

depth.projection for calculation of projection depth.

depth.simplicial for calculation of simplicial depth.

depth.simplicialVolume for calculation of simplicial volume depth.

depth.zonoid for calculation of zonoid depth.

depth.potential for calculation of data potential.


# 5-dimensional normal distribution
data <- mvrnorm(1000, rep(0, 5), 
                matrix(c(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),
                nrow = 5))
x <- mvrnorm(10, rep(1, 5), 
             matrix(c(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),
             nrow = 5))
depths <- depth.spatial(x, data)
cat("Depths: ", depths, "\n")

ddalpha documentation built on March 23, 2022, 9:07 a.m.