mahalDistP: Get pairwise squared Mahalanobis distances.

View source: R/mahalDist.R

mahalDistPR Documentation

Get pairwise squared Mahalanobis distances.

Description

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

Usage

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

Arguments

m

A matrix with observations in rows.

covar

The covariance matrix for m.

...

Not used.

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.

Value

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

Author(s)

Dave Braze davebraze@gmail.com

See Also

mahalanobis

cov

solve

dist

Examples

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


davebraze/FDButils documentation built on Feb. 24, 2023, 12:14 a.m.