projmedian | R Documentation |
Computes a projection depth based location estimate of a p
-dimensional
dataset x
.
projmedian(x, projection.depths = NULL, options = NULL)
x |
An |
projection.depths |
Vector containing the projection depth of the observations in |
options |
A list of options to pass to the |
The algorithm depends on the function projdepth
to compute the
projection depth of the observations in x
. If these depth values have already been computed, they can be passed as an optional
argument to save computing time. If not, the projection depth values will be
computed and the user can pass a list with options to the
projdepth
function.
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.
A list with components:
max |
The point of |
Huber |
A weighted center of gravity of all observations.
The weights are defined by the Huber
function with parameter
|
P. Segaert
Maronna, R.A., Yohai, V.J. (1995). The behavior of the Stahel-Donoho robust multivariate estimator. Journal of the American Statistical Association, 90, 330–341.
outlyingness
, projdepth
, adjOutl
, dirOutl
# Compute a location estimate of a two-dimensional dataset.
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 <- projmedian(x = BivData)
plot(BivData, pch = 16)
points(result$max, col = "red", pch = 18, cex = 1.5)
points(result$Huber, col = "blue", pch = 3, cex = 1.5)
# Options for the underlying projdepth routine may be passed
# using the options argument.
result <- projmedian(x = BivData,
options = list(type = "Rotation",
ndir = 100,
stand = "unimcd",
h = 0.75*nrow(BivData)))
plot(BivData, pch = 16)
points(result$max, col = "red", pch = 18, cex = 1.5)
points(result$Huber, col = "blue", pch = 3, cex = 1.5)
# One may also compute the depth values of the observations in the data
# separately. This avoids having to recompute them when computing the median.
depth.result <- projdepth(x = BivData)
result <- projmedian(x = BivData,
projection.depths = depth.result$depthX)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.