mahaldis: Mahalanobis Distance

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/mahaldis.R

Description

mahaldis measures the pairwise Mahalanobis (1936) distances between individual objects.

Usage

1

Arguments

x

matrix containing the variables. NAs are not tolerated.

Details

mahaldis computes the Mahalanobis (1936) distances between individual objects. The Mahalanobis distance takes into account correlations among variables and does not depend on the scales of the variables.

mahaldis builds on the fact that type-II principal component analysis (PCA) preserves the Mahalanobis distance among objects (Legendre and Legendre 2012). Therefore, mahaldis first performs a type-II PCA on standardized variables, and then computes the Euclidean distances among (repositioned) objects whose positions are given in the matrix G. This is equivalent to the Mahalanobis distances in the space of the original variables (Legendre and Legendre 2012).

Value

an object of class dist.

Author(s)

Pierre Legendre pierre.legendre@umontreal.ca

http://www.bio.umontreal.ca/legendre/indexEn.html

Ported to FD by Etienne Laliberté.

References

Legendre, P. and L. Legendre (2012) Numerical Ecology. 3nd English edition. Amsterdam: Elsevier.

See Also

mahalanobis computes the Mahalanobis distances among groups of objects, not individual objects.

Examples

1
2
3
4
5
6
mat <- matrix(rnorm(100), 50, 20)

ex1 <- mahaldis(mat)

# check attributes
attributes(ex1)

FD documentation built on May 19, 2017, 10:20 a.m.

Search within the FD package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.