dprojdepth: Directional projection depth of points relative to a dataset

View source: R/dprojdepth.R

dprojdepthR Documentation

Directional projection depth of points relative to a dataset

Description

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

Usage

dprojdepth(x, z = NULL, options = 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 directional projection depth. If z is not specified, it is set equal to x.

options

A list of options to pass to the underlying dirOutl routine.

See dirOutl for the full list of options.

Details

Directional projection depth is based on the directional outlyingness and is computed as 1/(1+DO). As directional outlyingness extends the Stahel-Donoho outlyingness towards skewed distributions, the directional projection depth is suited for both elliptical distributions and skewed multivariate data.

It is first checked whether the data is found to lie in a subspace of dimension lower 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 dirOutl for more details on the computation of the DO. 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 dirOutl function. More details can be found there.

Value

A list with components:

depthX

Vector of length n giving the directional projection depth of the observations in x.

depthZ

Vector of length m giving the directional projection depth of the points in z.

cutoff

Points whose directional projection depth is smaller than this cutoff can be considered as outliers.

flagX

Observations of x whose directional outlyingness exceeds the cutoff receive a flag FALSE, regular observations receive a flag TRUE.

flagZ

Points of z whose directional outlyingness exceeds 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 such a case the orthogonal direction can not be uniquely determined. This is an indication that the data are not in general position.

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 directional scale of xv is equal to zero, this equals v.

inSubspace

When a direction v is found such that DO(xv) is ill-defined, the observations from x which belong to the hyperplane orthogonal to v receive a value TRUE. The other observations receive a value FALSE.

Author(s)

J. Raymaekers

References

Rousseeuw, P.J., Raymaekers, J., Hubert, M. (2018). A measure of directional outlyingness with applications to image Data and video. Journal of Computational and Graphical Statistics, 27, 345–359.

See Also

dirOutl, dprojmedian, mrainbowplot, adjOutl, outlyingness

Examples

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

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

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

# Options for the underlying outlyingness routine may be passed 
# using the options argument. 
Result <- dprojdepth(x = bloodfat, 
                     options = list(type = "Affine", ndir=100))


mrfDepth documentation built on Oct. 6, 2023, 5:07 p.m.