Mahalanobis distance | R Documentation |
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>.
dista, colmeans
x <- matrix( rnorm(100 * 50), ncol = 50 )
m <- colmeans(x)
s <- cov(x)
a1 <- mahala(x, m, s)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.