mahalanobis: Mahalanobis distance

View source: R/RcppExports.R

mahalanobisR Documentation

Mahalanobis distance

Description

Compute the squared Mahalanobis distance (fast implementation).

Usage

mahalanobis(x, mu, sigma, ischol = FALSE)

Arguments

x

Numeric. A vector (of length p) or matrix (with p columns).

mu

Numeric. A vector of length p.

sigma

Numeric. A p \times p non-negative definite matrix.

ischol

Logical. Set to TRUE if sigma is provided as a Cholesky decomposition.

Value

The squared Mahalanobis distance for all rows in x and the mean vector mu with respect to covariance matrix sigma, defined as (x - μ)' Σ^{-1}(x - μ).

Author(s)

Emily Goren, emily.goren@gmail.com

References

Mahalanobis, Prasanta Chandra. "On the Generalised Distance in Statistics." Proceedings of the National Institute of Sciences of India 2 (1936): 49-55.


emilygoren/MixtClust documentation built on March 19, 2022, 2 p.m.