This function computes a Mantel test between two dissimilarity matrices. The available correlations are Pearson, Spearman, and Kendall.
mantel_test(formula = formula(data), data = sys.parent(),correlation ="Pearson", nperm =1000)
Arguments
formula: formula y ~ x describing the test to be conducted where y and x are distance matrices (as "dist" objects).
data: an optional data frame containing the variables in the model as columns of dissimilarities. By default, the variables are taken from the current environment.
correlation: indicates which correlation (R) must be used among Pearson (default), Spearman, and Kendall correlations.
nperm: a number of permutations to evaluate the significance of the correlation. By default, it equals 1000, but this can be very long for the Kendall correlation.
Returns
mantelr: Mantel correlation (R).
pval1: one-tailed p-value (null hypothesis: R <= 0).
pval2: one-tailed p-value (null hypothesis: R >= 0).
pval3: two-tailed p-value (null hypothesis: R = 0).
Details
This function is adapted from the function mantel in the R-package ecodist (Goslee & Urban, 2007).
References
Perez-Lamarque B, Maliet O, Pichon B, Selosse M-A, Martos F, Morlon H. 2022. Do closely related species interact with similar partners? Testing for phylogenetic signal in bipartite interaction networks. bioRxiv, 2021.08.30.458192, ver. 6 peer-reviewed and recommended by Peer Community in Evolutionary Biology. https://doi.org/10.1101/2021.08.30.458192
Goslee, S.C. & Urban, D.L. (2007). The ecodist package for dissimilarity-based analysis of ecological data. J. Stat. Softw., 22, 1–19.
Mantel, N. 1967. The detection of disease clustering and a generalized regression approach. Cancer Research 27:209-220.
Author(s)
Benoît Perez-Lamarque
See Also
phylosignal_network
phylosignal_sub_network
Examples
# Measuring phylogenetic signal in species interactions using a Mantel test # (do closely related species interact with similar partners?)library(RPANDA)# Load the datadata(mycorrhizal_network)network <- mycorrhizal_network[[1]]# bipartite interaction matrix tree_orchids <- mycorrhizal_network[[2]]# phylogenetic tree (phylo object)network <- network[,tree_orchids$tip.label]ecological_distances <- as.matrix(vegan::vegdist(t(network),"jaccard", binary=FALSE))phylogenetic_distances <- cophenetic.phylo(tree_orchids)mantel_test(as.dist(ecological_distances)~ as.dist(phylogenetic_distances),correlation="Pearson", nperm =10000)