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 1986data("hongite")## Coerce to compositional datacoda <- as_composition(hongite)## Mahalanobis distancemahalanobis(coda)