depth.projection: Calculate Projection Depth

View source: R/depth.projection.r

depth.projectionR Documentation

Calculate Projection Depth


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


  depth.projection(x, data, method = "random", num.directions = 1000, seed = 0)



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.


to be used in calculations.

"random" Here the depth is determined as the minimum univariate depth of the data projected on lines in several directions. The directions are distributed uniformly on the (d-1)-sphere; the same direction set is used for all points.

"linearize" The Nelder-Mead method for function minimization, taken from Olsson, Journal of Quality Technology, 1974, 6, 56.


Number of random directions to be generated for method = "random". With the growth of n the complexity grows linearly for the same number of directions.


the random seed. The default value seed=0 makes no changes.


Calculates projection depth. Projection depth, similar to Mahalanobis depth, is based on a measure of outlyingness, used by Stahel (1981) and Donoho (1982), and has been first formulated by Liu (1992). The worst case outlyingness is obtained by maximizing an outlyingness measure over all univariate projections. In practice most often median, and median absolute deviation from the median (MAD), are used as they are robust measures.


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


R-codes for the "linearize" method were written by Subhajit Dutta.


Donoho, D.L. (1982). Breakdown properties of multivariate location estimators. Ph.D. qualifying paper. Department of Statistics, Harvard University.

Liu, R.Y. (1992). Data depth and multivariate rank tests. In: Dodge, Y. (ed.), L1-Statistics and Related Methods, North-Holland (Amsterdam), 279–294.

Liu, X. and Zuo, Y. (2014). Computing projection depth and its associated estimators. Statistics and Computing 24 51–63.

Stahel, W.A. (1981). Robust estimation: infinitesimal optimality and covariance matrix estimators. Ph.D. thesis (in German). Eidgenossische Technische Hochschule Zurich.

Zuo, Y.J. and Lai, S.Y. (2011). Exact computation of bivariate projection depth and the Stahel-Donoho estimator. Computational Statistics and Data Analysis 55 1173–1179.

See Also

depth.halfspace for calculation of the Tukey depth.

depth.Mahalanobis for calculation of Mahalanobis depth.

depth.simplicial for calculation of simplicial depth.

depth.simplicialVolume for calculation of simplicial volume depth.

depth.spatial for calculation of spatial depth.

depth.zonoid for calculation of zonoid depth.

depth.potential for calculation of data potential.


  # 5-dimensional normal distribution
  data <- mvrnorm(100, 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.projection(x, data, method = "random", num.directions = 1000)
  cat("Depths random: ", depths, "\n")
  depths <- depth.projection(x, data, method = "linearize")
  cat("Depths linearize: ", depths, "\n")

ddalpha documentation built on May 29, 2024, 1:12 a.m.