mrfDepth (version 1.0.1)

projdepth: Projection depth of points relative to a dataset

Description

Computes the projection depth of $p$-dimensional points z relative to a $p$-dimensional dataset x.

Usage

projdepth(x, z = NULL, options = list())

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 projection depth. If z is not specified, it is set equal to x.
options
A list of options to pass to the underlying outlyingness routine. See outlyingness for the full list of options.

Value

A list with components:

Details

Projection depth is based on the Stahel-Donoho outlyingness (SDO) and is computed as $1/(1+SDO)$. It is mostly suited to measure the degree of outlyingness of multivariate points with respect to a data cloud from an elliptical distribution.

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.

See outlyingness for more details on the computation of the SDO. To visualize the depth of bivariate data one can apply the mrainbowplot function. It plots the data colored according to their depth.

The output values of this function are based on the output of the outlyingness function. More details can be found there.

References

Zuo Y. (2003). Projection-based depth functions and associated medians. The Annals of Statistics, 31, 1460--1490.

See Also

outlyingness, projmedian, mrainbowplot, adjOutlyingness, sprojdepth, sprojmedian

Examples

Run this code

# Compute the projection depth of a simple two-dimensional dataset.
# Outliers are plotted in red.

if (requireNamespace("robustbase", quietly = TRUE)) {
    BivData <- log(robustbase::Animals2)
} else {
  BivData <- matrix(rnorm(120), ncol = 2)
  BivData <- rbind(BivData, matrix(c(6,6, 6, -2), ncol = 2))
}

Result <- projdepth(x = BivData)
IndOutliers <- which(!Result$flagX)
plot(BivData)
points(BivData[IndOutliers,], col = "red")

# A multivariate rainbowplot may be obtained using mrainbowplot.
plot.options = list(legend.title = "PD")
mrainbowplot(x = BivData, 
             depths = Result$depthX, plot.options = plot.options)

# Options for the underlying outlyingness routine may be passed 
# using the options argument. 
Result <- projdepth(x = BivData, 
                    options = list(type = "Affine",
                                   ndir = 1000,
                                   stand = "MedMad",
                                   h = nrow(BivData)
                                   )
                   )

Run the code above in your browser using DataLab