Learn R Programming

mrfDepth (version 1.0.17)

sdepth: Simplicial depth of points relative to a dataset

Description

Computes the simplicial depth of \(p\)-dimensional points z relative to a \(p\)-dimensional dataset x. Only dimension \(p<=2\) is supported.

Usage

sdepth(x, z = NULL)

Value

A list with components:

depthZ

Vector of length \(m\) giving the simplicial depth of the points in z.

dimension

When the data x are lying in a lower dimensional subspace, the dimension of this subspace.

hyperplane

When the data x are lying in a lower dimensional subspace, a direction orthogonal to this subspace.

Arguments

x

An \(n\) by \(p\) data matrix with observations in the rows and variables in the columns.

z

An optional \(m\) by \(p\) matrix containing rowwise the points \(z_i\) for which to compute the simplicial depth. If z is not specified, it is set equal to x.

Author

P. Segaert, based on Fortran code by P.J. Rousseeuw, I. Ruts and A. Struyf.

Details

The simplicial depth has been introduced by Liu (1990). The simplicial depth of a point \(z_i\) is defined as the number of simplices with vertices in x that contain \(z_i\). Exact computation of the simplicial depth for bivariate data is performed by means of the algorithm described in Rousseeuw and Ruts (1996). To visualize the depth of bivariate data one can apply the mrainbowplot function. It plots the data with coloring according to their depth.

It is first checked whether the data lie in a subspace of dimension smaller than \(p\). If so, a warning is given, as well as the dimension of the subspace and a direction which is orthogonal to it.

References

Liu R. (1990). On a notion of data depth based on random simplices. The Annals of Statistics, 18, 405--414.

Rousseeuw P.J., Ruts I. (1996). AS 307: Bivariate location depth. Applied Statistics, 45, 516--526.

See Also

mrainbowplot

Examples

Run this code
data(bloodfat)
Result <- sdepth(x = bloodfat)
mrainbowplot(bloodfat, depth = Result$depthZ)

Run the code above in your browser using DataLab