mat.sq.dist: Squared distance matrix

Description Usage Arguments Value See Also Examples

Description

Computes the squared distance matrix of a set of covariance matrices

Usage

1
mat.sq.dist(Sm, dist. = "Riemannian", method = 0, pa = 0)

Arguments

Sm

a (p x p x m) array of covariance matrices, where p is the number of variables and m the number of groups.

dist.

"Riemannian" or "Euclidean"

method

an integer for the method of matrix inversion

pa

an integer for the parameter of matrix inversion

Value

The matrix of squared Riemannian or Euclidean distances

See Also

See minv for the method and the parameter used for the matrix inversion

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Data matrix of 2D landmark coordinates
data("Tropheus.IK.coord")
coords <- which(names(Tropheus.IK.coord) == "X1"):which(names(Tropheus.IK.coord) == "Y19")
proc.coord <- as.matrix(Tropheus.IK.coord[coords])

# Data reduction
phen.pca <- prcomp(proc.coord, rank. = 5, tol = sqrt(.Machine$double.eps))
pc.scores <- phen.pca$x

# Covariance matrix of each population
S.phen.pop <- cov.group(pc.scores, groups = Tropheus.IK.coord$POP.ID)

# Squared Riemannian distance matrix of the covariance matrices of all populations
eigen.phen.r <- mat.sq.dist(S.phen.pop, dist. = "Riemannian")

# Squared Euclidean distance matrix of the covariance matrices of all populations
eigen.phen.e <- mat.sq.dist(S.phen.pop, dist. = "Euclidean")

vcvComp documentation built on Dec. 17, 2020, 9:07 a.m.