Mahalanobis Distance

Usage

mahalanobis(x, center, cov, inverted=FALSE)

Arguments

x Vector or matrix of data.
center Mean vector of the distribution or second data vector.
cov Covariance matrix of the distribution or the QR decomposition of the distribution.
inverted If TRUE, cov is supposed to contain the inverse of the covariance matrix.

Description

Returns the Mahalanobis distance of all rows in x and the vector center, which is (for vector x) defined as

d = (x - center)' cov^{-1} (x - center)

Author(s)

Friedrich Leisch

See Also

qr,cov

Examples

x <- matrix(rnorm(30),ncol=3)
mahalanobis(x)


[Package Contents]