PhyloMantel: Mantel test with phylogenetic permutations

Description Usage Arguments Value Note Author(s) References Examples

View source: R/PhyloMantel.R

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

1
2
3
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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)

Example output

Loading required package: plyr
   Rsquared Probability 
  0.4891338   0.0690000 
   Rsquared Probability 
  0.4891338   0.0680000 
'nperm' >= set of all permutations: complete enumeration.
Set of permutations < 'minperm'. Generating entire set.
   Rsquared Probability 
  0.4891338   0.0750000 
Warning message:
In MantelCor.default(comparisons, mh.dist) :
  Matrices do not appear to be correlation matrices. Use with caution.

evolqg documentation built on May 30, 2017, 1:52 a.m.

Related to PhyloMantel in evolqg...