L1median {robustX} | R 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 |
m.init |
starting value for |
weights |
optional numeric vector of non-negative weights;
currently only implemented for method |
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
|
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; |
zero.tol |
for method |
... |
optional arguments to |
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. doi:10.1007/978-3-319-22404-6_12
See Also
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 ?