Learn R Programming

pcaPP (version 2.0-5)

l1median_NLM: Multivariate L1 Median

Description

Computes the multivariate L1 median (also called spatial median) of a data matrix X.

Usage

l1median_NM (X, maxit = 200, tol = 10^-8, trace = 0,
             m.init = .colMedians (X), ...)
l1median_CG (X, maxit = 200, tol = 10^-8, trace = 0,
             m.init = .colMedians (X), ...)
l1median_BFGS (X, maxit = 200, tol = 10^-8, trace = 0,
               m.init = .colMedians (X), REPORT = 10, ...)
l1median_NLM (X, maxit = 200, tol = 10^-8, trace = 0,
              m.init = .colMedians (X), ...)
l1median_HoCr (X, maxit = 200, tol = 10^-8, zero.tol = 1e-15, trace = 0,
               m.init = .colMedians (X), ...)
l1median_VaZh (X, maxit = 200, tol = 10^-8, zero.tol = 1e-15, trace = 0,
	       m.init = .colMedians (X), ...)

Value

par

A vector of length p containing the L1-median.

value

The value of the objective function ||X - l1median|| which is minimized for finding the L1-median.

code

The return code of the optimization algorithm. See optim and nlm for further information.

iterations

The number of iterations performed.

iterations_gr

When using a gradient function this value holds the number of times the gradient had to be computed.

time

The algorithms runtime in milliseconds.

Arguments

X

a matrix of dimension n x p.

maxit

The maximum number of iterations to be performed.

tol

The convergence tolerance.

trace

The tracing level. Set trace > 0 to retrieve additional information on the single iterations.

m.init

A vector of length p containing the initial value of the L1-median.

REPORT

A parameter internally passed to optim.

zero.tol

The zero-tolerance level used in l1median_VaZh and l1median_HoCr for determining the equality of two observations (i.e. an observation and a current center estimate).

...

Further parameters passed from other functions.

Author

Heinrich Fritz, Peter Filzmoser <P.Filzmoser@tuwien.ac.at>

Details

The L1-median is computed using the built-in functions optim and nlm. These functions are a transcript of the L1median method of package robustX, porting as much code as possible into C++.

See Also

Examples

Run this code

  # multivariate data with outliers
  library(mvtnorm)
  x <- rbind(rmvnorm(200, rep(0, 4), diag(c(1, 1, 2, 2))), 
             rmvnorm( 50, rep(3, 4), diag(rep(2, 4))))

  l1median_NM (x)$par
  l1median_CG (x)$par
  l1median_BFGS (x)$par
  l1median_NLM (x)$par
  l1median_HoCr (x)$par
  l1median_VaZh (x)$par

  # compare with coordinate-wise median:
  apply(x,2,median)

Run the code above in your browser using DataLab