pr.coord: Principal coordinates ordination

Description Usage Arguments Value Examples

Description

Performs a principal coordinates analysis of a distance matrix

Usage

1

Arguments

V

a square distance matrix

Value

A list containing the following named components:

k

the number of groups (value)

vectors

the eigenvectors of the centered inner product matrix (matrix)

values

the eigenvalues of the centered inner product matrix (vector)

PCoords

the principal coordinates = scaled eigenvectors (matrix)

Variance

a dataframe containing the following named variables:

eigenvalues

eigenvalues of the centered inner product matrix

variance

variance of each principal coordinate

exVar

proportion of the total variation accounted by each principal coordinate

cumVar

cumulative proportion of the total variation accounted by principal coordinate

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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 distance matrix of the covariance matrices of all populations
eigen.phen.pop <- mat.sq.dist(S.phen.pop, dist. = "Riemannian")  # Riemannian distances

# Ordination of the squared distance matrix
prcoa.pop <- pr.coord(eigen.phen.pop)

# Visualization
plot(prcoa.pop$PCoords[, 1], prcoa.pop$PCoords[, 2])
abline(h = 0) ; abline(v = 0)
text(prcoa.pop$PCoords[, 1], prcoa.pop$PCoords[, 1], labels = rownames(prcoa.pop$PCoords))

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