Statistics Toolbox | ![]() ![]() |
Syntax
Description
computes the Mahalanobis distance of each point (row) of the matrix mahal(Y,X)
Y
from the sample in the matrix X
.
The number of columns of Y
must equal the number of columns in X
, but the number of rows may differ. The number of rows in X
must exceed the number of columns.
The Mahalanobis distance is a multivariate measure of the separation of a data set from a point in space. It is the criterion minimized in linear discriminant analysis.
Example
The Mahalanobis distance of a matrix r
when applied to itself is a way to find outliers.
r = mvnrnd([0 0],[1 0.9;0.9 1],100); r = [r;10 10]; d = mahal(r,r); last6 = d(96:101) last6 = 1.1036 2.2353 2.0219 0.3876 1.5571 52.7381
The last element is clearly an outlier.
See Also
classify
![]() | mad | manova1 | ![]() |