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

PhyloMantel

Mantel test with phylogenetic permutations


Description

Performs a matrix correlation with significance given by a phylogenetic Mantel Test. Pairs of rowns and columns are permuted with probability proportional to their phylogenetic distance.

Usage

PhyloMantel(
  tree,
  matrix.1,
  matrix.2,
  ...,
  permutations = 1000,
  ComparisonFunc = function(x, y) cor(x[lower.tri(x)], y[lower.tri(y)]),
  k = 1
)

Arguments

tree

phylogenetic tree. Tip labels must match names in input matrices

matrix.1

pair-wise comparison/distance matrix

matrix.2

pair-wise comparison/distance matrix

...

aditional parameters, currently ignored

permutations

Number of permutations used in significance calculation

ComparisonFunc

comparison function, default is MatrixCor

k

determines the influence of the phylogeny. 1 is strong influence, and larger values converge to a traditional mantel test.

Value

returns a vector with the comparison value and the proportion of times the observed comparison is smaller than the correlations from the permutations.

Note

This method should only be used when there is no option other than representing data as pair-wise. It suffers from low power, and alternatives should be used when available.

Author(s)

Diogo Melo, adapted from Harmon & Glor 2010

References

Harmon, L. J., & Glor, R. E. (2010). Poor statistical performance of the Mantel test in phylogenetic comparative analyses. Evolution, 64(7), 2173-2178.

Lapointe, F. J., & Garland, Jr, T. (2001). A generalized permutation model for the analysis of cross-species data. Journal of Classification, 18(1), 109-127.

Examples

data(dentus)
data(dentus.tree)
tree = dentus.tree
cor.matrices = dlply(dentus, .(species), function(x) cor(x[-5]))
comparisons = MatrixCor(cor.matrices)

sp.means = dlply(dentus, .(species), function(x) colMeans(x[-5]))
mh.dist = MultiMahalanobis(means = sp.means, cov.matrix = PhyloW(dentus.tree, cor.matrices)$'6')
PhyloMantel(dentus.tree, comparisons, mh.dist, k = 10000)

#similar to MantelCor for large k:
## Not run: 
PhyloMantel(dentus.tree, comparisons, mh.dist, k = 10000)
MantelCor(comparisons, mh.dist)

## 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.