Learn R Programming

mrfDepth (version 1.0.17)

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())

Value

A list with components:

depthX

Vector of length \(n\) giving the projection depth of the observations in x.

depthZ

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

cutoff

Points whose projection depth is smaller than this cutoff can be considered as outliers. Equivalently the outliers are those points whose Stahel-Donoho outlyingness exceed the corresponding cutoff.

flagX

Observations of x whose projection depth is smaller than the cutoff receive a flag FALSE, regular observations receive a flag TRUE.

flagZ

Points of z whose projection depth is smaller than the cutoff receive a flag equal to FALSE, otherwise they receive a flag TRUE.

singularSubsets

When the input parameter type is equal to "Affine", the number of \(p\)-subsets that span a subspace of dimension smaller than \(p-1\). In that case the orthogonal direction can not be uniquely determined. This is an indication that the data are not in general position. When the input parameter type is equal to "Rotation" it is possible that two randomly selected points of the data coincide due to ties in the data. In this case this value signals how many times this happens.

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. When a direction \(v\) is found such that the robust scale of \(xv\) is equal to zero, this equals \(v\).

inSubspace

When a direction \(v\) is found such that the robust scale of \(xv\) is zero, the observations from x which belong to the hyperplane orthogonal to \(v\) receive a value TRUE. The other observations receive a value FALSE.

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.

Author

P. Segaert

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, adjOutl, dirOutl

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