Skip to content

Advertisement

Mahalanobis distance calculator

Paste two to four variables and enter the target coordinates. Get D, D² and an indicative p-value.

Distance D: —

Fill in the fields above — the result is computed on this page.

Squared distance D²
—
Indicative p-value
—
Observations
—
Variables
—

Data and target point

For two variables the plot shows observations and the target point.

Target point components

Variable Target Mean Difference
Fill in the fields above — the result is computed on this page.
What these numbers mean
  • D = 0 means the point equals the mean vector.
  • A large D indicates an unusual feature combination.
  • The result depends on the covariance matrix estimate.

You need more observations than variables and an invertible covariance matrix. The p-value is model-based, not a universal anomaly threshold.

How to use this page
  1. Paste equal-length series for 2–4 variables.
  2. Enter the target point coordinates.
  3. Assess D together with the plot and data assumptions.

What this page does not do: You need more observations than variables and an invertible covariance matrix. The p-value is model-based, not a universal anomaly threshold.

Further reading

Mahalanobis distance uses not only the difference from the mean but also variable variances and correlations. A deviation along a common data direction therefore weighs less than an equally large deviation in an unusual direction.

D² may be compared approximately with a chi-square distribution whose degrees of freedom equal the number of variables when multivariate normality is reasonable.

Frequently asked questions

How does it differ from Euclidean distance?

Mahalanobis scales directions by variance and accounts for correlation, so units and dependence do not distort the result.

Why is there no result?

Usually the series differ in length or variables are linearly dependent, making the covariance matrix non-invertible.

See also

← All calculators

Advertisement
Offline app and draw notifications

My saved selections

Selections saved only in this browser. Numbers are shown exactly as saved; this is not a lottery ticket.

Open the My saved selections hub
Restore with preview

Restore in the hub: review the file and confirm first. Both old backups and the complete selections + journal backup are supported. Nothing is uploaded.