
Performs a matrix correlation with significance given by a phylogenetic Mantel Test. Pairs of rows and columns are permuted with probability proportional to their phylogenetic distance.
PhyloMantel(
tree,
matrix.1,
matrix.2,
...,
permutations = 1000,
ComparisonFunc = function(x, y) cor(x[lower.tri(x)], y[lower.tri(y)]),
k = 1
)
returns a vector with the comparison value and the proportion of times the observed comparison is smaller than the correlations from the permutations.
phylogenetic tree. Tip labels must match names in input matrices
pair-wise comparison/distance matrix
pair-wise comparison/distance matrix
additional parameters, currently ignored
Number of permutations used in significance calculation
comparison function, default is MatrixCor
determines the influence of the phylogeny. 1 is strong influence, and larger values converge to a traditional mantel test.
Diogo Melo, adapted from Harmon & Glor 2010
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.
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:
if (FALSE) {
PhyloMantel(dentus.tree, comparisons, mh.dist, k = 10000)
MantelCor(comparisons, mh.dist)
}
Run the code above in your browser using DataLab