The Mahalanobis distance is a measure between a sample point and
a distribution.
The Mahalanobis distance from a vector y to a distribution with
mean μ and covariance Σ is
This distance represents how far y is from the
mean in number of standard deviations.
mahal
returns the squared Mahalanobis distance d2 from an observation in Y
to the reference
samples in X
. In the mahal
function,
μ and Σ are the sample mean and covariance
of the reference samples, respectively.