L1median: Compute the Multivariate L1-Median aka 'Spatial Median'

View source: R/L1medians.R

L1medianR Documentation

Compute the Multivariate L1-Median aka 'Spatial Median'

Description

Compute the multivariate L_1-median m, also called “Spatial Median”, i.e., the minimizer of

\sum_{i=1}^n \| x_i - m \|,

where \|u\| = \sqrt{\sum_{j=1}^p u_j^2}.

As a convex problem, there's always a global minimizer, computable not by a closed formula but rather an iterative search. As the (partial) first derivatives of the objective function is undefined at the data points, the minimization is not entirely trivial.

Usage

L1median(X, m.init = colMedians(X), weights = NULL,
	method = c("nlm", "HoCrJo", "VardiZhang", optimMethods, nlminbMethods),
	pscale = apply(abs(centr(X, m.init)), 2, mean, trim = 0.40),
	tol = 1e-08, maxit = 200, trace = FALSE,
	zero.tol = 1e-15, ...)

Arguments

X

numeric matrix of dimension n \times p, say.

m.init

starting value for m; typically and by default the coordinatewise median.

weights

optional numeric vector of non-negative weights; currently only implemented for method "VardiZhang".

method

character string specifying the computational method, i.e., the algorithm to be used (can be abbreviated).

pscale

numeric p-vector of positive numbers, the coordinate-wise scale (typical size of \delta{m_j}), where m is the problem's solution.

tol

positive number specifying the (relative) convergence tolerance.

maxit

positive integer specifying the maximal number of iterations (before the iterations are stopped prematurely if necessary).

trace

an integer specifying the tracing level of the iterations; 0 does no tracing

zero.tol

for method "VardiZhang", a small positive number specifying the tolerance for determining that the iteration is ‘exactly’ at a data point (which is a singularity).

...

optional arguments to nlm() or the control (list) arguments of optim(), or nlminb(), respectively.

Details

Currently, we have to refer to the “References” below.

Value

currently the result depends strongly on the method used.

FIXME. This will change considerably.

Author(s)

Martin Maechler. Method "HoCrJo" is mostly based on Kristel Joossens' R function, implementing Hossjer and Croux (1995).

References

Hossjer and Croux, C. (1995). Generalizing Univariate Signed Rank Statistics for Testing and Estimating a Multivariate Location Parameter. Non-parametric Statistics 4, 293–308.

Vardi, Y. and Zhang, C.-H. (2000). The multivariate L_1-median and associated data depth. Proc. National Academy of Science 97(4), 1423–1426.

Fritz, H. and Filzmoser, P. and Croux, C. (2012) A comparison of algorithms for the multivariate L1-median. Computational Statistics 27, 393–410.

Kent, J. T., Er, F. and Constable, P. D. L. (2015) Algorithms for the spatial median;, in K. Nordhausen and S. Taskinen (eds), Modern Nonparametric, Robust and Multivariate Methods: Festschrift in Honour of Hannu Oja, Springer International Publishing, chapter 12, pp. 205–224. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/978-3-319-22404-6_12")}

See Also

median, covMcd

CRAN package pcaPP added more L1 median methods, re-implementing our R versions in C++, see Fritz et al.(2012) and e.g., l1median_NLM().

Examples

data(stackloss)
L1median(stackloss)
L1median(stackloss, method = "HoCrJo")


## Explore all methods:
m <- eval(formals(L1median)$method); allMeths <- m[m != "Brent"]
L1m <- sapply(allMeths, function(meth) L1median(stackloss, method = meth))
## --> with a warning for L-BFGS-B
str(L1m)
pm <- sapply(L1m, function(.) if(is.numeric(.)) . else .$par)
t(pm) # SANN differs a bit; same objective ?

robustX documentation built on July 9, 2023, 6:25 p.m.