Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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), ...)

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.

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++.

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.

Note

See the vignette "Compiling pcaPP for Matlab" which comes with this package to compile and use some of these functions in Matlab.

Author(s)

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

See Also

Examples

# 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)

pcaPP

Robust PCA by Projection Pursuit

v1.9-74
GPL (>= 3)
Authors
Peter Filzmoser, Heinrich Fritz, Klaudius Kalcher
Initial release
2021-04-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.