Learn R Programming

ICSNP (version 1.1-2)

spatial.median: Spatial Median

Description

iterative algorithm to compute the spatial median.

Usage

spatial.median(X, init = NULL, maxiter = 500, eps = 1e-06, 
               print.it = FALSE, na.action = na.fail)

Value

vector of the spatial median.

Arguments

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.

Author

Klaus Nordhausen and Seija Sirkia

Details

Follows the algorithm of Vardi and Zhang.

References

Vardi, Y. and Zhang, C.-H. (1999), The multivariate L1-median and associated data depth, PNAS, 97, 1423--1426.

Examples

Run this code
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