mmedian: Median of multidimensional data

Description Usage Arguments Details Value

View source: R/mmedian.R

Description

Median of multidimensional data

Usage

1
mmedian(x, metric = "euclidean", q = 3, simple1d = TRUE, ...)

Arguments

x

a matrix, data frame or vector of data points (a vector will be understood as 1D data, equivalent to a 1-column matrix). Rows with NA values will be dropped.

metric

a choice of 'euclidean','maximum','manhattan','canberra','minkowski', or 'binary'. Any unambiguous substring can be given, case insensitive.

q

the power in the minkowski metric. If q=2, equivalent to 'euclidean'.

simple1d

boolean, if TRUE, will resort to the standard median function in case the data is 1D. This means that only euclidean metric will be used. However, most metrics are identical to euclidean in 1D anyway, so it is usually no big loss.

...

other arguments passed to Rcgmin::Rcgmin.

Details

The median is calculated as the minimizer m of the sum of distances ||x_i-m||, where x_i are the data points. In an N-dimensional space, each x_i is an N-dimensional vector, and so is m. The distances are calculated according to the metric chosen (Euclidean by default). Minimization is done with Rcgmin (note that exotic metrics you might cause convergence issues). In 1D case, unless simple1d is FALSE, the standard median function is used instead of this method.

Value

a vector of median components.


rushkin/outlier documentation built on Dec. 18, 2020, 6:48 a.m.