depth: Depth calculation

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/depth.R

Description

Computes the depth of a point with respect to a multivariate data set.

Usage

1
2
depth(u, x, method = "Tukey", approx = FALSE, 
   eps = 1e-8, ndir = 1000)

Arguments

u

Numerical vector 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 used. method can be "Tukey" (the default), "Liu" or "Oja".

approx

Logical. If dimension is 3, should an approximate Tukey depth be computed? Useful when sample size is large.

eps

Error tolerance to control the calculation.

ndir

Number of random directions used when Tukey depth is approximated.

Details

method "Tukey" refers to the Tukey or halfspace depth. In dimension 2, exact calculation is based on Fortran code from Rousseeuw and Ruts (1996). In dimensions higher than 2, calculation utilises Fortran code from Struyf and Rousseeuw (1998). This yields exact calculation when dimension is 3 and approx = FALSE, and approximate calculation when dimension is higher than 3.

The Liu (or simplicial) depth is computed in dimension 2 only. Calculation is exact and based on Fortran code from Rousseeuw and Ruts (1996).

The Oja depth is derived from a location measure considered by Oja. If p is the dimension and n the size of the data set, it is defined to be 0.5(1+Average(Volume(S(u,x[i_1,],…,x[i_p,])))^(-1), where S(args) denotes the simplex generated by args, and sum and average are taken over all p-plets x[i_1,],…,x[i_p,] such that 1 <= i_1 <…. < i_p <= n. Calculation is exact.

Value

Returns the depth of multivariate point u with respect to data set x.

Author(s)

Jean-Claude Masse and Jean-Francois Plante, based on Fortran code by Rousseeuw, Ruts and Struyf from University of Antwerp.

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.

Rousseuw, P.J. and Ruts, I. (1996), AS 307 : Bivariate location depth, Appl. Stat.-J. Roy. S. C, 45, 516–526.

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

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

See Also

perspdepth and isodepth for depth graphics.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## calculation of Tukey depth
data(starsCYG, package = "robustbase")
depth(apply(starsCYG,2,mean), starsCYG)

## Tukey depth applied to a large bivariate data set.
set.seed(356)
x <- matrix(rnorm(9999), nc = 3)
depth(rep(0,3), x)

## approximate calculation much easier
depth(rep(0,3), x, approx = TRUE)

depth documentation built on Nov. 21, 2019, 5:06 p.m.