mahalFS computes Mahalanobis distances (in squared units) for each row of matrix Y




d =mahalFS(Y, MU, SIGMA) Example of computation of MD.


expand all

  • Example of computation of MD.
  • Y=randn(10,2);
    SIGMA=[0.3 0.4; 0.4 1];
    % Compute MD using as centroid the medians and shape matrix SIGMA

    Input Arguments

    expand all

    Y — Input data. Matrix.

    n x v data matrix; n observations and v variables. Rows of Y represent observations, and columns represent variables.

    Missing values (NaN's) and infinite values (Inf's) are allowed, since observations (rows) with missing or infinite values will automatically be excluded from the computations.

    Data Types: single|double

    MU — Centroid. Vector.

    1 x v vector containing centroid to use

    Data Types: single| double

    SIGMA — Covariance matrix. Matrix.

    v x v matrix containing covariance matrix which must be used

    Data Types: single| double

    Output Arguments

    expand all

    d —Mahalanobis distances. Vector

    n x 1 vector which contains the squared Mahalanobid distances.

    \[ d(i) = (y_i-\mu)^T \times \Sigma^{-1} \times (y_i-\mu), \qquad i=1, 2, \ldots, n \]


    See Also

    This page has been automatically generated by our routine publishFS