pr.coord {vcvComp} | R Documentation |
Principal coordinates ordination
Description
Performs a principal coordinates analysis of a distance matrix
Usage
pr.coord(V)
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:
|
Examples
# 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))
[Package vcvComp version 1.0.2 Index]