PCScoreCorrelation {evolqg} | R Documentation |
PC Score Correlation Test
Description
Given a set of covariance matrices and means for terminals, test the hypothesis that observed divergence is larger/smaller than expected by drift alone using the correlation on principal component scores.
Usage
PCScoreCorrelation(
means,
cov.matrix,
taxons = names(means),
show.plots = FALSE
)
Arguments
means |
list or array of species means being compared. array must have means in the rows. |
cov.matrix |
ancestral covariance matrix for all populations |
taxons |
names of taxons being compared. Must be in the same order of the means. |
show.plots |
Logical. If TRUE, plot of eigenvalues of ancestral matrix by between group variance is showed. |
Value
list of results containing:
correlation matrix of principal component scores and p.values for each correlation. Lower triangle of output are correlations, and upper triangle are p.values.
if show.plots is TRUE, also returns a list of plots of all projections of the nth PCs, where n is the number of taxons.
Author(s)
Ana Paula Assis, Diogo Melo
References
Marroig, G., and Cheverud, J. M. (2004). Did natural selection or genetic drift produce the cranial diversification of neotropical monkeys? The American Naturalist, 163(3), 417-428. doi:10.1086/381693
Examples
#Input can be an array with means in each row or a list of mean vectors
means = array(rnorm(40*10), c(10, 40))
cov.matrix = RandomMatrix(40, 1, 1, 10)
taxons = LETTERS[1:10]
PCScoreCorrelation(means, cov.matrix, taxons)
## Not run:
##Plots list can be displayed using plot_grid()
library(cowplot)
pc.score.output <- PCScoreCorrelation(means, cov.matrix, taxons, TRUE)
plot_grid(plotlist = pc.score.output$plots)
## End(Not run)