Computes the simplicial depth of \(p\)-dimensional points z
relative to a \(p\)-dimensional dataset x
. Only dimension \(p<=2\) is supported.
sdepth(x, z = NULL)
A list with components:
Vector of length \(m\) giving the simplicial depth of the points in z
.
When the data x
are lying in a lower dimensional subspace, the dimension of this subspace.
When the data x
are lying in a lower dimensional subspace, a direction orthogonal to this subspace.
An \(n\) by \(p\) data matrix with observations in the rows and variables in the columns.
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
.
P. Segaert, based on Fortran code by P.J. Rousseeuw, I. Ruts and A. Struyf.
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.
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.
mrainbowplot
data(bloodfat)
Result <- sdepth(x = bloodfat)
mrainbowplot(bloodfat, depth = Result$depthZ)
Run the code above in your browser using DataLab