Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

PCScoreCorrelation

PC Score Correlation Test


Description

Given a set of covariance matrices and means for terminals, test the hypothesis that obseved divergency 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

boolean. If TRUE, plot of eigenvalues of ancetral 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 outputput 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)

evolqg

Tools for Evolutionary Quantitative Genetics

v0.2-8
MIT + file LICENSE
Authors
Ana Paula Assis, Diogo Melo, Edgar Zanella, Fabio Andrade Machado, Guilherme Garcia
Initial release
2020-11-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.