Learn R Programming

CovTools (version 0.2.1)

CovDist: Compute pairwise distance for symmetric positive definite matrices.

Description

For a given 3-dimensional array where symmetric positive definite (SPD) matrices are stacked slice by slice, it computes pairwise distance using various popular measures. Some of measures are metric as they suffice 3 conditions in mathematical context; nonnegative definiteness, symmetry, and triangle inequalities. Other non-metric measures represent dissimilarities between two SPD objects.

Usage

CovDist(A, method = c("AIRM", "Bhattacharyya", "Cholesky", "Euclidean",
  "Hellinger", "JBLD", "KLDM", "LERM", "Procrustes.SS", "Procrustes.Full",
  "PowerEuclidean", "RootEuclidean"), power = 1)

Arguments

A

a (p-by-p-by-N) 3d array of N SPD matrices.

method

the type of distance measures to be used; "AIRM" for Affine Invariant Riemannian Metric, "Bhattacharyya" for Bhattacharyya distance based on normal model, "Cholesky" for Cholesky difference in Frobenius norm, "Euclidean" for naive Frobenius norm as distance, "Hellinger" for Hellinger distance based on normal model, "JBLD" for Jensen-Bregman Log Determinant Distance, "KLDM" for symmetrized Kullback-Leibler Distance Measure, "LERM" for Log Euclidean Riemannian Metric, "Procrustes.SS" for Procrustes Size and Shape measure, "Procrustes.Full" for Procrustes analysis with scale, "PowerEuclidean" for weighted eigenvalues by some exponent, and "RootEuclidean" for matrix square root.

power

a non-zero number for PowerEuclidean distance.

Value

an (N-by-N) symmetric matrix of pairwise distances.

References

Arsigny, V., Fillard, P., Pennec, X., and Ayache, N. (2006) Log-Euclidean Metrics for Fast and Simple Calculus on Diffusion Tensors. Magnetic Resonance in Medicine, 56:411-421.

Dryden, I.L., Koloydenko, A., and Zhou, D. (2009) Non-Euclidean statistics for covariance matrices, with applications to diffusion tensor imaging. The Annals of Applied Statistics, Vol.3(3):1102-1123.

Examples

Run this code
# NOT RUN {
## generate 100 SPD matrices of size (5-by-5)
samples = samplecovs(100,5)

## get pairwise distance for "AIRM"
distAIRM = CovDist(samples, method="AIRM")

## dimension reduction using MDS
ss = cmdscale(distAIRM)
plot(ss[,1],ss[,2],main="2d projection")


# }

Run the code above in your browser using DataLab