mrfDepth (version 1.0.1)

projmedian: Location estimates based on projection depth.

Description

Computes a projection depth base location estimate of a $p$-dimensional dataset x.

Usage

projmedian(x, projection.depths = NULL, options = NULL)

Arguments

x
An $n$ by $p$ data matrix with observations in the rows and variables in the columns.
projection.depths
Vector containing the projection depths of the points in x.
options
A list of options to pass to the projdepth routine. See projdepth for more details.

Value

A list with components:

Details

The algorithm depends on the function projdepth to calculate the projection depths of the dataset x. If the projection depths of the points $x_i$ have already been calculated they can be passed as an optional argument to save computation time. If not, projections depths will be calculated 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.

References

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

See Also

outlyingness, projdepth, adjOutlyingness, sprojdepth, sprojmedian

Examples

Run this code

# Compute a location estimate of a simple 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)
points(result$max, col = "red", pch = 15)
points(result$gravity, col = "blue", pch = 16)
points(result$Huber, col = "orange", pch = 17)

# Options for the underlying projdepth routine may be passed 
# using the options argument. 
result <- projmedian(x = BivData,
                     options = list(type = "Affine",
                                    ndir = 10,
                                    stand = "MedMad",
                                    h = nrow(BivData)
                                    )
                    )
plot(BivData)
points(result$max, col = "red", pch = 15)
points(result$gravity, col = "blue", pch = 16)
points(result$Huber, col = "orange", pch = 17)

# One may also calculate the depths of the points in the data
# separately. This avoids having to recompute the depths when these
# are previously calculated. 
depth.result <- projdepth(x = BivData)
result <- projmedian(x = BivData, 
                     projection.depths = depth.result$depthX)

Run the code above in your browser using DataLab