mahalanobis(x, center, cov, inverted=F)
NA
s) are allowed.
center
must equal the number of columns in
x
.
Missing values are not accepted.
x
.
This may alternatively be a QR decomposition of the covariance matrix,
or the inverse of the covariance matrix (see
inverted
).
Missing values are not accepted.
TRUE
, then
cov
is taken to be the inverse of the
covariance matrix.
x
.
The result contains missing values for rows of
x
that contain missing values.
The
i
th element of the result is equal to
(x[i,]-center)%*%solve(cov)%*%(x[i,]-center)
.
The Mahalanobis distance is discussed in many multivariate books such as:
Mardia, K. V., Kent, J. T. and Bibby, J. M. (1979).
Multivariate Analysis.
Academic Press, London.
freeny.cov <- cov.mve(freeny.x) freeny.mah <- mahalanobis(freeny.x, freeny.cov$center, freeny.cov$cov)