spatial.median {ICSNP} | R Documentation |
iterative algorithm to compute the spatial median.
spatial.median(X, init = NULL, maxiter = 500, eps = 1e-06, print.it = FALSE, na.action = na.fail)
X |
a numeric data frame or data matrix. |
init |
Starting value for the alogrihtm, if 'NULL', the vector of marginal medians is used. |
maxiter |
maximum number of iterations. |
eps |
convergence tolerance. |
print.it |
logical. If TRUE prints the number of iterations, otherwise not. |
na.action |
a function which indicates what should happen when the data contain 'NA's. Default is to fail. |
Follows the algorithm of Vardi and Zhang.
vector of the spatial median.
Klaus Nordhausen, klaus.nordhausen@uta.fi and Seija Sirkiä, ssirkia@maths.jyu.fi
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)