depth function

Depth calculation

Depth calculation

Calculate depth functions.

depth(u, X, method = "Projection", threads = -1, ...)

Arguments

  • u: Numerical vector or matrix whose depth is to be calculated. Dimension has to be the same as that of the observations.
  • X: The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one multivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations).
  • method: Character string which determines the depth function. method can be "Projection" (the default), "Mahalanobis", "Euclidean" or "Tukey". For details see depth.
  • threads: number of threads used in parallel computations. Default value -1 means that all possible cores will be used.
  • ...: parameters specific to method --- see depthEuclid

Details

The Mahalanobis depth

DMAH(y,Xn)=11+(yxˉ)TS1(yxˉ), {D}_{MAH}(y, {X} ^ {n}) = \frac{ 1 }{ 1 + {{(y - \bar{x})} ^ {T}}{{S} ^ {-1}}(y - \bar{x}) },

where SS denotes the sample covariance matrix Xn{X} ^ {n}.

A symmetric projection depth D(x,X)D\left( x, X\right) of a point xRdx \in {{{R}} ^ {d}}, d1d \ge 1 is defined as

D(x,X)PRO=[1+supu=1uTxMed(uTX)MAD(uTX)]1, D\left( x, X\right)_{PRO} = {{\left[ 1 + su{{p}_{\left\| u \right\| = 1}}\frac{ \left| {{u} ^ {T}}x - Med\left( {{u} ^ {T}}X\right)\right| }{ MAD\left( {{u} ^ {T}}X\right) }\right]} ^ {-1}},

where Med denotes the univariate median, MAD(Z)MAD\left( Z \right) = Med(ZMed(Z))Med\left(\left| Z - Med\left( Z \right)\right|\right). Its sample version denoted by D(x,Xn)D\left( x, {X} ^ {n} \right) or D(x,Xn)D\left( x, {X} ^ {n} \right) is obtained by replacing FF by its empirical counterpart Fn{{F}_{n}} calculated from the sample Xn{X} ^ {n} .

Next interesting depth is the weighted Lp{L} ^ {p} depth. The weighted Lp{L} ^ {p} depth D(x,F)D({x}, F) of a point xRd{x} \in {R} ^ {d}, d1d \ge 1 generated by dd dimensional random vector X{X} with distribution FF, is defined as D(x,F)=11+Ew(xXp),D({x}, F) = \frac{1 }{ 1 + Ew({{\left\| x - X \right\| }_{p}}) }, where ww is a suitable weight function on [0,)[0, \infty), and p{{\left\| \cdot \right\| }_{p}} stands for the Lp{L} ^ {p} norm (when p = 2 we have usual Euclidean norm). We assume that ww is non-decreasing and continuous on [0,)[0, \infty) with w()=w(\infty-) = \infty, and for a,bRda, b \in {{{R}} ^ {d}} satisfying w(a+b)w(a)+w(b)w(\left\| a + b \right\|) \le w(\left\| a \right\|) + w(\left\| b \right\|). Examples of the weight functions are: w(x)=a+bxw(x) = a + bx, a,b>0a, b > 0 or w(x)=xαw(x) = {x} ^ {\alpha}. The empirical version of the weighted Lp{L} ^ {p} depth is obtained by replacing distribution FF of X{X} in Ew(xXp)=w(xtp)dF(t)Ew({{\left\| {x} - {X} \right\| }_{p}}) = \int {w({{\left\| x - t \right\| }_{p}})}dF(t) by its empirical counterpart calculated from the sample Xn{{{X}} ^ {n}}...

The Projection and Tukey's depths are calculated using an approximate algorithm. Calculations of Mahalanobis, Euclidean and LpL ^ p depths are exact. Returns the depth of multivariate point u with respect to data set X.

Examples

library(robustbase) # Calculation of Projection depth data(starsCYG, package = "robustbase") depth(t(colMeans(starsCYG)), starsCYG) # Also for matrices depth(starsCYG, starsCYG) # Projection depth applied to a large bivariate data set x <- matrix(rnorm(9999), nc = 3) depth(x, x)

References

Liu, R.Y., Parelius, J.M. and Singh, K. (1999), Multivariate analysis by data depth: Descriptive statistics, graphics and inference (with discussion), Ann. Statist., 27, 783--858.

Mosler K (2013). Depth statistics. In C Becker, R Fried, K S (eds.), Robustness and Complex Data Structures, Festschrift in Honour of Ursula Gather, pp. 17--34. Springer.

Rousseeuw, P.J. and Struyf, A. (1998), Computing location depth and regression depth in higher dimensions, Stat. Comput., 8, 193--203.

Zuo, Y. and Serfling, R. (2000), General Notions of Statistical Depth Functions, Ann. Statist., 28, no. 2, 461--482.

See Also

depthContour and depthPersp for depth graphics.

Author(s)

Daniel Kosiorowski, Mateusz Bocian, Anna Wegrzynkiewicz and Zygmunt Zawadzki from Cracow University of Economics.

  • Maintainer: Zygmunt Zawadzki
  • License: GPL-2
  • Last published: 2022-02-03

Downloads (last 30 days):