CovDist: Compute Pairwise Distance for Symmetric Positive-Definite...

Description Usage Arguments Value References Examples

View source: R/CovDist.R

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

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

Arguments

A

a (p\times p\times 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\times N) symmetric matrix of pairwise distances.

References

\insertRef

arsigny_log-euclidean_2006CovTools

\insertRef

dryden_non-euclidean_2009CovTools

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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)

CovTools documentation built on Aug. 14, 2021, 1:08 a.m.