CovDist {CovTools} | R Documentation |
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 |
method |
the type of distance measures to be used; |
power |
a non-zero number for PowerEuclidean distance. |
Value
an (N\times N)
symmetric matrix of pairwise distances.
References
Arsigny V, Fillard P, Pennec X, Ayache N (2006). “Log-Euclidean metrics for fast and simple calculus on diffusion tensors.” Magnetic Resonance in Medicine, 56(2), 411–421. ISSN 0740-3194, 1522-2594.
Dryden IL, Koloydenko A, Zhou D (2009). “Non-Euclidean statistics for covariance matrices, with applications to diffusion tensor imaging.” The Annals of Applied Statistics, 3(3), 1102–1123. ISSN 1932-6157.
Examples
## 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)
## visualize
opar <- par(no.readonly=TRUE)
plot(ss[,1],ss[,2],main="2d projection")
par(opar)