The Mantel test (Mantel, 1967) may be used to calculate correlations between corresponding positions of two (dis)similarity or distance matrices ( |

Null hypothesis: |
The distances among objects in a matrix of response variables are not linearly correlated with another matrix of explanatory variables. |

Null hypothesis:(with a matrix of response data and a matrix of geographic distances) |
The response data matrix is not structured along a spatial gradient. |

Figure 1: The Mantel test finds correlations between (dis)similarity matrices. a) A Bray-Curtis dissimilarity matrix calculated for species response data at four samples. b) A Euclidean distance matrix calculated for a set of standardised environmental parameters at the same four samples as a). In this toy example, the Mantel statistic r_{M}, based on Pearson's product-moment correlation, is approximately -0.14 and is not significant. Naturally, many more samples are required for adequate significance testing. |

z_{M} |
The Mantel statistic, z_{M}, is computed by adding the cross products of the two (dis)similarity matrices being tested. As (dis)similarity matrices are symmetrical about their diagonals, half of each matrix (excluding values on the diagonal) is unfolded (i.e. vectorised by stacking the values in each row below those of the previous the row) in order to compute their cross products. |

r_{M} |
Calculated similarity to z_{M}, however, values in the unfolded matrices are standardised before cross product computation. Thus, r_{M} falls between -1 and 1, similar to a correlation coefficient. |

ranked_{M} |
A ranked Mantel statistic may also be computed by converting distances into ranks before computing r_{M}. The correlations that result from this are comparable to the non-parametric, Spearman correlations. |

**Model testing**

The Mantel approach can also be used to test a hypothesis or a model. In this model testing approach, one matrix contains response data, while the other contains a representation of an

*a priori*model to test. The 'model matrix' thus represents the alternative hypothesis of the test. If significant Mantel statistics are found, they provide some support for the model.The model matrix may be a classification of objects into groups formatted to resemble a (dis)similarity matrix. In this case, the Mantel test is equivalent to a non-parametric MANOVA (NPMANOVA). The model matrix may also be a quantitative representation of a hypothetical gradient.

Figure 2: The Mantel test can be used to test an a) A Bray-Curtis dissimilarity matrix calculated for species response data at four sites. b) A model dissimilarity matrix asserting that samples 1 and 2 are maximally dissimilar from samples 3 and 4 and both pairs are maximally similar. This asserts that samples 1 and 2, and samples 3 and 4, form two distinct groups.a priori model or hypothesis. |

**Testing significance**

Mantel statistics are tested for significance by

**permutation**. Rows and columns of either distance matrix (but not both matrices) can be permuted and a Mantel statistic recomputed each time to determine the expected distribution of the statistic under the null hypothesis. Observing where the value of the statistic calculated from the observed data falls in the permuted distribution allows one to assess the likelihood of the observed correlation arising by chance. Note, however, that the permutation of values in a (dis)similarity matrix is not completely random, but should actually reflect a permutation of the raw data followed by the calculation of a new (dis)similarity matrix.**Assumptions**

- Unless using the ranked Mantel statistic, the Mantel approach is suited to detect linear relationships between (dis)similarity matrices.
- Response and explanatory variables must be independent. That is, each matrix must represent a different data set. If one matrix is in any way derived from the other, the test is invalid.

**Warnings**

- It is recommended that the Mantel test should be used only for hypotheses framed in terms of (dis)similarity or distance between pairs of objects (See Legendre et al., [2005] for discussion). If hypotheses references raw data, consider constrained analyses such as redundancy analysis (RDA) or canonical correspondence analysis (CCA).
- The Mantel test is not suited to detect non-linear relationships between (dis)similarity matrices.
- Be aware if you are testing similarity or dissimilarity matrices and interpret your results accordingly.

- Do not test a model derived from a data set on the same data set. In this scenario, the hypothesis and the model are not independent. This is an example of data dredging.
- Be aware that a Mantel correlelogram uses repeated Mantel tests to (usually) check for spatial or temporal autocorrelation. The interpretation is somewhat different to the standard Mantel test.

**Implementations**

- R
- The
*mantel()*function in the package vegan - The
*mantel.test()*function in the package ape

**References**

- Legendre P, Legendre L.
*Numerical Ecology*. 2nd ed. Amsterdam: Elsevier, 1998. ISBN 978-0444892508. - Legendre P, Borcard D, Peres-Neto PR (2005) Analyzing beta diversity: Partitioning the spatial variation of community composition data.
*Ecol Monogr*.**75**:435–450. - Mantel NA (1967) The detection of disease clustering and a generalized regression approach.
*Cancer Res*.**27**: 209-220.