MAHALANOBIS

Compute the Mahalanobis Distance on your empirical data set.

Description

The Mahalanobis function measures the distances of the cross-sectional point estimates from its empirical distribution. This is a multi-dimensional generalization tool in statistics. It is unitless, scale-invariant, and accounts for the correlation relationships within the data set.

For a given dataset,XX, the Mahalanobis distance,DD, is given by

Dt=(Xtμ)Σ1(Xtμ)D_t=(X_t-\mu) \Sigma^{-1}(X_t-\mu)'
Dt=Mahalanobis distance for cross-section tXt=vector of asset returns for period tμ=sample average of historical asset returnsΣ=sample covariance matrix of asset returnsD_t=\text{Mahalanobis distance for cross-section } t\newline X_t=\text{vector of asset returns for period } t\newline \mu=\text{sample average of historical asset returns}\newline \Sigma=\text{sample covariance matrix of asset returns}

Syntax

The following describes the function signature for use in Microsoft Excel's formula bar.

=MAHALANOBIS(X, mu, covariance)

Input(s)

ArgumentDescription

X

Matrix of time series returns (or values).

mu

Optional. Vector of means to measure the distance from. If the argument is not specified, it defaults to the sample average of the X.

covariance

Optional. Covariance matrix, specify a covariance matrix to normalize the distances. If the argument is not specified, it defaults to the sample covariance matrix of X.

Output(s)

Vector of Mahalanobis distance values for the corresponding data, XX. Vector will have the same length as XX.

Example

Last updated