Mahalanobis distance
Mahalanobis distance.
mahala(x, mu, sigma, ischol = FALSE)
x |
A matrix with the data, where rows denotes observations (vectors) and the columns contain the variables. |
mu |
The mean vector. |
sigma |
The covariance or any square symmetric matrix. |
ischol |
A boolean variable set to true if the Cholesky decomposition of the covariance matrix is supplied in the argument \"sigma\". |
A vector with the Mahalanobis distances.
Matteo Fasiolo <matteo.fasiolo@gmail.com>,
C++ and R implementation and documentation: Matteo Fasiolo <matteo.fasiolo@gmail.com>.
x <- matrix( rnorm(100 * 50), ncol = 50 ) m <- colmeans(x) s <- cov(x) a1 <- mahala(x, m, s)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.