sdepth: Simplicial depth of points relative to a dataset

View source: R/sdepth.R

sdepthR Documentation

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)

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.

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.

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.

Author(s)

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

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

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

mrfDepth documentation built on May 29, 2024, 5:04 a.m.