Mahalanobis distance {Rfast} | R Documentation |
Mahalanobis distance
Description
Mahalanobis distance.
Usage
mahala(x, mu, sigma, ischol = FALSE)
Arguments
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\". |
Value
A vector with the Mahalanobis distances.
Author(s)
Matteo Fasiolo <matteo.fasiolo@gmail.com>,
C++ and R implementation and documentation: Matteo Fasiolo <matteo.fasiolo@gmail.com>.
See Also
Examples
x <- matrix( rnorm(100 * 50), ncol = 50 )
m <- colmeans(x)
s <- cov(x)
a1 <- mahala(x, m, s)
[Package Rfast version 2.1.0 Index]