powered by
iterative algorithm to compute the spatial median.
spatial.median(X, init = NULL, maxiter = 500, eps = 1e-06, print.it = FALSE, na.action = na.fail)
vector of the spatial median.
a numeric data frame or data matrix.
Starting value for the alogrihtm, if 'NULL', the vector of marginal medians is used.
maximum number of iterations.
convergence tolerance.
logical. If TRUE prints the number of iterations, otherwise not.
a function which indicates what should happen when the data contain 'NA's. Default is to fail.
Klaus Nordhausen and Seija Sirkia
Follows the algorithm of Vardi and Zhang.
Vardi, Y. and Zhang, C.-H. (1999), The multivariate L1-median and associated data depth, PNAS, 97, 1423--1426.
set.seed(654321) cov.matrix <- matrix(c(3,2,1,2,4,-0.5,1,-0.5,2), ncol=3) X <- rmvnorm(100, c(0,0,0), cov.matrix) spatial.median(X) rm(.Random.seed)
Run the code above in your browser using DataLab