Project variables in their original scale into an existing ordination. Used internally.

proj_eigen(x, vectors, center)

Arguments

x

A matrix with the original variables used for the ordination as columns, and observations as rows.

vectors

A matrix of eigenvector coefficients used to build the ordination.

center

A vector with the mean values of the original variables used in the ordination.

Value

A 2-margins matrix with the scores on the supplied vector(s).

See also

Examples

#' #load data and packages
library(geomorph)
data("tails")

#perform principal component analysis on tails data
pca <- prcomp(two.d.array(tails$shapes))

#get project shapes in the pca ordination
shapes_mat <- two.d.array(tails$shapes)
newscores <- proj_eigen(x = shapes_mat,
                        vectors = pca$rotation,
                        center = pca$center)

#plot and compare
plot(pca$x, pch = 16, col = "gray")
points(newscores, col = "black")

#compute and project species' mean shapes
meanshapes_arr <- expected_shapes(tails$shapes, x = tails$data$species)
meanshapes_mat <- two.d.array(meanshapes_arr)
meanscores <- proj_eigen(x = meanshapes_mat,
                        vectors = pca$rotation,
                        center = pca$center)
points(meanscores, pch = 21, bg = "red", cex = 1.5)