mahalanobis function

Mahalanobis Distance

Mahalanobis Distance

Computes the squared Mahalanobis distance of all rows in x. methods

## S4 method for signature 'CompositionMatrix' mahalanobis(x, center, cov, ..., robust = TRUE, method = c("mve", "mcd")) ## S4 method for signature 'ILR' mahalanobis(x, center, cov, ..., robust = TRUE, method = c("mve", "mcd"))

Arguments

  • x: A CompositionMatrix or an ILR object.
  • center: A numeric vector giving the mean vector of the distribution. If missing, will be estimated from x.
  • cov: A numeric matrix giving the covariance of the distribution. If missing, will be estimated from x.
  • ...: Extra parameters to be passed to MASS::cov.rob(). Only used if robust is TRUE.
  • robust: A logical scalar: should robust location and scatter estimation be used?
  • method: A character string specifying the method to be used. It must be one of "mve" (minimum volume ellipsoid) or "mcd" (minimum covariance determinant). Only used if robust is TRUE.

Returns

A numeric vector.

Examples

## Data from Aitchison 1986 data("hongite") ## Coerce to compositional data coda <- as_composition(hongite) ## Mahalanobis distance mahalanobis(coda)

See Also

stats::mahalanobis()

Other statistics: aggregate(), condense(), covariance(), dist, margin(), mean(), pip(), quantile(), scale(), variance(), variance_total(), variation()

Author(s)

N. Frerebeau