For N points, in M dimensions, get pairwise squared Mahalanobis distances between points. Return a square matrix of distances.

mahalDistP(m, covar = NULL, ...)

Arguments

m

A matrix with observations in rows.

covar

The covariance matrix for m.

...

Not used.

Value

An object of class "dist" (see dist) containing pairwise squared Mahalanobis distances for all points in m.

Details

For each pair of N points in M dimensions, get pairwise squared Mahalanobis distances between points. Returns an object, d, of class "dist" (see dist) containing pairwise squared Mahalanobis distances for all points in m. The method attribute of d is set to "mahalanobis". Obviously, d can get big for large N.

The full symmetric distance matrix for d can be recovered by calling as.matrix(d).

This function is a convenience wrapper around mahalanobis, which see.

See also

Author

Dave Braze davebraze@gmail.com

Examples

m <- matrix(rnorm(200, m=.8, s=.05), nrow=50) md <- mahalDistP(m) cluster <- hclust(md) plot(cluster)