Computes the projection depth of z
relative to a x
.
projdepth(x, z = NULL, options = list())
A list with components:
Vector of length x
.
Vector of length z
.
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.
Observations of x
whose projection depth is smaller than
the cutoff receive a flag FALSE
, regular observations receive a flag TRUE
.
Points of z
whose projection depth is smaller than the cutoff
receive a flag equal to FALSE
, otherwise they receive a flag TRUE
.
When the input parameter type is equal to "Affine"
, the number of "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.
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. When a direction
When a direction x
which belong to the hyperplane orthogonal to
An
An optional z
is not specified,
it is set equal to x
.
A list of options to pass to the underlying outlyingness
routine.
See outlyingness
for the full list of options.
P. Segaert
Projection depth is based on the Stahel-Donoho outlyingness (SDO) and is computed as
It is first checked whether the data lie in a subspace of dimension smaller than
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.
Zuo Y. (2003). Projection-based depth functions and associated medians. The Annals of Statistics, 31, 1460--1490.
outlyingness
, projmedian
, mrainbowplot
, adjOutl
, dirOutl
# 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