these studies are supported by a strong theoretical basis since the classical papers by s. wright , r.a . the most popular approaches for estimating divergence include calculation of genetic distances and variance partitioning among and within populations using wright s fst and other related statistics , such as gst , ast , rst , st and st ( see holsinger and weir , 2009 for a recent review ) . for instance , the fst gives an estimate of the balance of genetic variability among and within populations , and is an unbiased estimator of divergence between pairs of populations under an island - model in which all populations diverged at the same time and are linked by approximately similar migration rates . however , migration rates usually vary proportionally with geographical distances , so that pairwise fst estimates between pairs of populations vary . regardless of how genetic divergence among populations is computed , a recurrent goal in landscape genetics is to evaluate the amount of spatial structure in the genetic distance matrix . for instance , it is common to use cluster ( such as upgma or neighbor - joining ) and ordination techniques ( e.g. , principal coordinates analysis ) to visualize the relationships among populations based on these matrices ( see lessa , 1990 ; felsenstein , 2004 ) . more recent techniques , such as bayesian approaches ( see balkenhol et al . , 2009 ; guillot et al . , 2009 ) , do not start from pairwise distances , but follow a similar reasoning of establishing clusters based on genetic differentiation among individuals . however , these approaches do not explicitly evaluate the effect of geographic space . by far , the mantel test is the most commonly used method to evaluate the relationship between geographic distance and genetic divergence ( mantel , 1967 ; see manly , 1985 , 1997 ) . the mantel test was proposed in 1967 to test the association between two matrices and was first applied in population genetics by sokal ( 1979 ) . despite recent controversies and criticisms about its statistical performance ( e.g. 
 harmon and glor 2010 ; legendre and fortin , 2010 ; guillot and rousset , 2013 ) and the existence of more sophisticated and complex approaches to analyze spatial multivariate data , the mantel test is still widely used . we believe that at least part of the problems associated with this test is due to lack of understanding of basic aspects of the test and misinterpretations in empirical applications . here we review the mantel test and its extensions ( mantel correlogram , partial correlation and regression ) , discussing how it can be associated with theoretical models in population genetics ( i.e. , isolation - by - distance and landscape models ) . routines of different forms of the mantel test are widely available in several computer programs for population genetic analyses ( table 1 ) and in several packages for the r platform ( r development core team , 2012 ) . all mantel tests performed here were conducted using the r packages vegan ( oksanen et al . , 2012 ) and ecodist ( goslee and urban , 2007 ) and a complete script is available from the authors upon request . we illustrate several applications of the mantel test using an example based on population genetic divergence among dipteryx alata populations , the  baru  , an endemic tree widely distributed in the brazilian cerrado biome ( see diniz - filho et al . previous analyses suggested that spatial patterns of genetic variability in this species are due to a combination of isolation - by - distance and range expansion after the last maximum glacial , creating clines in some loci . the mantel test , as originally formulated in 1967 , is given by 
 zm=i=1nj=1ngijdijwhere gij and dij are , respectively , the genetic and geographic distances between populations i and j , considering n populations . because zm is given by the sum of products of distances its value depends on how many populations are studied , as well as the magnitude of their distances . the zm - value can be compared with a null distribution , and mantel originally proposed to test it by the standard normal deviate ( snd ) , given by 
 snd = zm / var(zm)1/2where var(zm ) is the variance of the zm ( see mantel , 1967 and manly , 1985 for detailed formulas ) . later , however , mielke ( 1978 ) showed that this formulation is biased , working well only for large sample sizes , and suggested that a null distribution must be obtained empirically by permuting rows and columns of one of the distance matrices . thus , the idea underlying mantel s randomization test is that if there is a relationship between matrices g and d , the sum of products zm will be relatively high , and randomizing rows and columns will destroy this relationship so that zm values , after randomizations , will tend to be lower than the observed . if one generates , say , 999 values and none of the randomized zm - values is higher than the observed , it is possible to conclude that the chance to observe a zm - value as high as the observed by chance alone is 1/999 + 1 ( the 1 is the observed , which is conservatively added to both the numerator and denominator ) . one can also use a standardized version of the mantel s test ( zn ) : 
 zn=i=1nj=1n(gijg)(dijd)var(g)1/2var(d)1/2using the means (  and d ) and the variances ( var(g ) and var(d ) ) of the matrices g and d. the standardized version of mantel s test ( zn ) is actually the pearson correlation r between the standardized elements of the matrices g and d. zn values close to 1 indicate that an increase in geographic distance between populations i and j is related with an increase in genetic distances between these populations . zn values close to 1 indicate de opposite pattern , and zn values close to zero indicate that there is no relationship between the two matrices . notice also that if the two matrices g and d are standardized prior to the analysis ( so that the mean is equal to 0 and variance is equal to 1 ) mantel original zm and standardized zn have exactly the same value . for simplicity of notation , this standardized mantel test zn will be referred to hereafter as mantel correlation rm . the dataset for dipteryx alata populations used throughout the text consists of genotypes based on 8 micro - satellite loci of 644 individuals collected in 25 populations of the brazilian cerrado ( states of gois , mato grosso , mato grosso do sul , minas gerais and tocantins , figure 1 ; see diniz - filho et al . we built matrices of genetic distances among population by calculating pairwise fst estimated by an analysis of variance of allele frequencies ( holsinger and weir , 2009 ) and nei s genetic distances ( these two genetic distances are strongly correlated : rm = 0.868 ; p < 0.001 ) . we then correlated these genetic distance matrices with pairwise geographic distances ( measured in kilometers ) between populations . results of mantel tests are qualitatively the same using pairwise fst or nei s genetic distances , so a g matrix is hereafter given by the pairwise fst . the first and simplest application of the mantel test is to correlate genetic ( g ) and geographic ( d ) distances , seeking for spatial pattern of genetic variation . the scatterplot between elements in g and d matrices showed a linear relationship between genetic and geographic distances ( figure 2 ) . performing 4999 randomizations of the rows and columns of g generated the distribution of correlations under the null hypothesis . out of these 4999 values , none was larger than the observed value of 0.499 , so that the chance of obtaining a value as large as the observed is smaller than 1/5000 , indicating a p - value of 0.0002 . thus , we conclude that nearby populations tend to be genetically more similar than expected by chance , and genetic differences increase linearly with geographic distances . the mantel correlation , as shown in figure 2 , shows the overall relationship between matrices g and d. however , it is often interesting to study the relationship between genetic and geographic distances across space , especially if this relationship is not linear . thus , the matrix d can be divided into several sub - matrices , each one describing pairs of populations within a bounded interval of geographic distances . specifically , this is done to describe possible variations in the correlation between genetic and geographic distances . these matrices , called here wk , express in a binary form ( 0/1 values ) if pairs of populations are connected ( a value of 1 ) , or not ( a value of 0 ) , within a given geographic distance range , usually referred as  distance class  k. to analyze the variation of correlation coefficients across space it is , however , necessary to create multiple non - overlapping and contiguous distance classes . thus , several mantel correlations are obtained by performing a mantel test between g and the matrices w1 , w2 , w3 , ... , wk . finally , the mantel correlogram is constructed by plotting mantel correlations between g and each w against the mid - point of the respective distance class k ( oden and sokal , 1986 ; legendre and legendre , 2012 ) . the definition of distance classes , both in terms of the total number of classes and their upper and lower limits , is somewhat arbitrary and depends on the spatial distribution of the populations . a  rule of thumb  suggests about four to five classes for 20 populations . from a statistical point of view it is recommendable to keep the number of links ( pairs of populations ) within each matrix w approximately constant , which may require unequal distance intervals ( e.g. , 0100 km , 100250 km , 250500 km , 5002000 km , see sokal and oden , 1978a , b for a discussion ) . the most important issue about correlograms is that they should capture a continuous distribution in geographic space . however , one must keep in mind that , if the number of populations is relatively small , or if the populations are distributed irregularly across space ( e.g. aggregated in clusters ) , it may not be possible to use a large number of distance classes . this is so because there may not be enough pairs of populations within a given distance class to provide a reliable estimate of the correlation . for the  baru  populations , a correlogram with five geographic distances classes indicated that populations distant by 156 km ( first distance class : from 0 km to 318 km ) tend to be similar ( rm = 0.337 ; p < 0.001 with 4999 permutations ) ( figure 3a ) . the mantel correlation decreased more or less linearly up to a value of 0.333 ( p < 0.001 ) in the last distance class , when populations were approximately 1120 km apart . as discussed earlier , negative correlation values indicate that populations that are located at a given distance apart tend to be genetically dissimilar . notice , however , that the mantel correlations in both the first and last distance classes were not very high ( i.e. , 0.33 ) , indicating that the spatial structure is not strong ( remember that the overall mantel test is 0.499 , so that only about 24.9% ( i.e. 0.499 ) of the genetic divergence is explained by geographic distance - see below ) . it is also possible to compute the mean fst within each distance class and plot it against the mean value of the class ( figure 3b ) . this is sometimes called distogram and provides an interesting and more direct visual evaluation of spatial patterns in genetic structure . for the  baru  dataset , when nearby populations in the first distance class were compared , the mean fst was 0.224 ( smaller than the overall value of 0.367 ) , whereas in the last distance class the mean fst was equal to 0.522 , which is higher than the mean value . thus , the correlogram and the distogram showed a continuous and linear decrease of genetic similarity ( a higher mean fst , and a lower mantel correlation ) when geographic distance increased ( figure 2a ) . this result is expected when there is a clinal pattern of genetic variation in the studied region ( i.e. , when allele frequencies decrease or increase in a directional way ) . spatial clines can arise by selection along environmental gradients ( unlike in the case of microsatellite markers ) , and/or by range expansions or diffusion of genes through space in migratory events or allelic surfing . indeed , previous analyses suggest that patterns of genetic variation in  baru  are related to range expansions from north to south , tracking climate changes after the last glacial maximum ( see diniz - filho et al . , 2012b ) . other more complex patterns can be detected using correlograms , and perhaps the most common pattern observed in nature is an exponential - like decrease in which there are high mantel correlations in the first distance classes , which tend to decrease and stabilize after a given distance class , indicating that there are patches of genetic variation or similarity . these patches can be caused by several factors , including different environments driving genetic variation ( again unlike in the case of microsatellites ) , or the subdivision of the studied region by barriers , or simple isolation - by - distance ( see below ) . the geographic distance at which the mantel correlation is zero or non - significant indicates the size of the patch , and this can be useful for understanding population and genetic dynamics in space ( see sokal and wartenberg , 1983 ; sokal et al . , patch size can also be used for establishing more efficient approaches in conservation genetics , allowing to estimate regions within which genetic variability is similar ( see diniz - filho and telles , 2002 , 2006 ) . when exponential - like correlograms appear , the overall mantel test may be a poor estimate of the spatial pattern because it assumes a linear correlation between matrices . thus it is important to check for non - linearity and heteroscedastic relationships between geographic and genetic distances with a simple scatterplot before interpreting the result of a global mantel test . an even safer alternative would consist in using correlograms instead of the simple mantel test ( see borcard and legendre , 2012 ) . finally , it is also important to highlight that , despite recent discussions on the validity of the mantel test ( especially of the partial mantel tests , see below ) , the mantel correlogram deserves its place in the ecologist s  toolbox  . for instance , borcard and legendre ( 2012 ) recently used several simulations to show that the statistical performance of a mantel correlogram , for both type i and type ii error rates , is reliable . another possibility for using the mantel test is to compare the relationship between two matrices , but taking into account the effect of a third one ( usually the geographical distances ) , as originally proposed by smouse et al . when analyzing spatially distributed data , the main issue is to find out if the two matrices are  causally  related ( i.e. , in the sense that they indicate an ecological or evolutionary process ) , or if the observed relationship appears only because both variables are spatially structured by intrinsic effects ( i.e. , distance - structured dispersal causing more similarity between neighboring populations ) . when one is interested in evaluating the statistical correlation between two variables ( say , an allele frequency and temperature ) whose values are spatially distributed , the most common ( and statistically sound ) approach is to apply spatial regression , methods ( see diniz - filho et al . , 2009 for a review using genetic data and perez et al . , 2010 for an application ) . however , when the hypotheses are specified in terms of distance matrices , such as in the case of isolation - by - distance and many landscape models ( see wagner and fortin , 2013 ) , the most popular approach is to apply partial mantel tests ( see legendre and legendre , 2012 for a review ) . there are several forms of partial mantel tests ( see smouse et al . , 1986 ; oden and sokal , 1992 ; legendre and legendre , 2012 ) , but the general reasoning is to evaluate how two matrices are correlated after controlling , or keeping statistically constant , the effect of other matrices ( see sokal et al . , 1986 , 1989 , for initial applications ) . in a first approach , it is possible to calculate the partial correlation between matrices g and e ( where e is a distance matrix that one wants to correlate with g , keeping matrix d constant ) . the partial correlation is given by 
 r(ge|d)=rm  ( ge)rm  ( ed )  rm  ( gd)/[(1rm  ( ed))1/2 ]  [ ( 1rm  ( gd))1/2]where zn(ge ) is , for instance , the correlation coefficient between matrices g and e and r(ge|d ) is the correlation between g and e , after taking d into account . to illustrate these approaches with the  baru  dataset , first , for each locality , we obtained the altitude and 19 bioclimatic variables from worldclim ( hijmans et al . , 2005 ) and , after standardizing each variable to zero mean and unity variance , an environmental ( euclidean ) distance matrix for all possible pairwise combinations of the local populations was obtained . this matrix ( e ) expresses then the environmental ( mainly climatic ) differences between populations . second , we also estimated the amount of natural habitats remaining between pairs of populations , as the proportion of natural habitats in a 10 km wide  corridor  linking two populations ( a matrix r ) . this matrix was derived from land use data obtained using the vegetation cover maps of the brazilian biomes at the 1:250.000 spatial scale , based on compositions of the bands 3 , 4 and 5 of landsat 7 etm+ images of the year 2002 ( see diniz - filho et al . a simple mantel correlation revealed that fst is not correlated to the proportion of the natural remnants matrix r ( rm = 0.23 ; p = 0.142 ) , and that this matrix is not spatially correlated ( rm= 0.075 ; p = 0.552 ) . thus , no further partial analyses were needed ( dutilleul , 1993 ) . however , fst is significantly correlated with environmental distances e according to a simple mantel test ( rm = 0.302 ; p = 0.008 ) . however , we already know that genetic divergence is spatially patterned ( rm = 0.499 ) and there is also a very strong spatial pattern in environmental variation e ( rm = 0.838 ; p < 0.001 ) . thus , the main issue is to test if there is a correlation between g and e , after taking the geographic distances ( matrix d ) into account . this relationship is not expected for neutral markers as microsatellites , except if one considers that these loci are linked with adaptive ones . indeed , the partial correlation between g and e , after taking into account geographic distances d , was equal to - rm(ge|d ) = 0.248 ( p = 0.956 ) , so the relationship between genetic and environment disappeared when geographic structure common to both matrices was accounted for ( as in principle expected for neutral markers , as pointed out above ) . first , it is possible to quantify the relationships between fst and geographic distance d and environmental distance e by partial coefficients of determination , disentangling the amount of variation explained by each predictor matrix and their shared contribution ( see pellegrino et al . , 2005 for an application in a phylogeographical context ) . in the  baru example , the geographic distances explained 24.9% of the variation in fst ( the square of the mantel correlation , rm equal to 0.499 ) , whereas the effect of environment was equal to 9.09% . using a standard multiple regression framework , if the matrices e and d are used as explanatory matrices to explain fst , the overall rm is equal to 0.295 . the sum of the rm is slightly larger than the overall rm and , therefore , there is a small shared fraction ( 4.4% ) . the unique effects of geographic and environmental distances are equal to 0.204 and 0.046 , respectively . this result reveals that about half of the small explanatory power of environmental distances was due to spatial patterns ( in agreement with the results of the partial correlation shown above ) . finally , it is also possible to generalize the multiple regression approach and evaluate simultaneously the effects of several explanatory matrices , a framework called multiple regression on distance matrices ( mrm ; lichstein , 2007 ) . using the  baru  dataset , we can evaluate the  effects  of the explanatory distance matrices ( d , e and r ) on the genetic divergence estimated by fst . in this case , these matrices explained 32.1% of the variation in genetic divergence , and only the standardized partial regression coefficient of geographic distances was significant at p < 0.001 ( p - value for e was equal to 0.111 and for r equal to 0.239 ) . the results are thus similar to all previous mantel tests that did not show partial effects of the environment or proportion of natural remnants on genetic distances . by far , the partial test is still the most controversial application of mantel test , and there has been a long discussion about its statistical performance in terms of type i error and power ( raufaste and rousset , 2001 , 2002 ; castellano and balletto , 2002 ; cushman and landguth , 2010 ; harmon and glor 2010 ; legendre and fortin , 2010 ; guillot and rousset , 2013 ) . actually , since its initial applications , some potential problems of low power to detect correlation and inflated type i error in partial tests have been considered ( oden and sokal , 1992 ) , and different forms of permutations may provide different results depending on data characteristics ( legendre , 2000 ) . however , some issues emerge when matrices are built upon two variables ( transformed into matrices using euclidean distances ) and not multivariate distance matrices per se ( such as a nei genetic distance or pairwise fst ) . in this case there are more appropriate tools for correlating variables while taking their spatial structure into account ( dormann et al . , 2007 , diniz - filho et al . , 2009 ; guillot and rousset , 2013 ) . however , legendre and fortin ( 2010 ) , besides indicating that other approaches have higher statistical power than the mantel test , wrote that  ... the mantel test should not be used as a general method for the investigation of linear relationships or spatial structures in univariate or multivariate data  , and  its use should be restricted to tests of hypotheses that can only be formulated in terms of distances likewise , guillot and rousset ( 2013 ) recently found very high type i error rates for partial mantel tests and strongly condemned their use . nonetheless simulations showed that other approaches for estimating partial correlation between matrices ( i.e. , redundancy analysis based on eigenfunction spatial analyses - see section below ) may also have inflated type i error rates ( legendre et al . a simple solution to this problem with type i error was given by oden and sokal ( 1992 ) , who pointed out that when using partial mantel tests it is important to be conservative and only reject the null hypothesis of no correlation if p is much smaller ( say , p = 0.001 ) than the nominal level of 5% . until the development of other methods , this overall reasoning should be adopted when using partial mantel tests . the mantel correlation , as shown in figure 2 , shows the overall relationship between matrices g and d. however , it is often interesting to study the relationship between genetic and geographic distances across space , especially if this relationship is not linear . thus , the matrix d can be divided into several sub - matrices , each one describing pairs of populations within a bounded interval of geographic distances . specifically , this is done to describe possible variations in the correlation between genetic and geographic distances . these matrices , called here wk , express in a binary form ( 0/1 values ) if pairs of populations are connected ( a value of 1 ) , or not ( a value of 0 ) , within a given geographic distance range , usually referred as  distance class  k. to analyze the variation of correlation coefficients across space it is , however , necessary to create multiple non - overlapping and contiguous distance classes . thus , several mantel correlations are obtained by performing a mantel test between g and the matrices w1 , w2 , w3 , ... , wk . finally , the mantel correlogram is constructed by plotting mantel correlations between g and each w against the mid - point of the respective distance class k ( oden and sokal , 1986 ; legendre and legendre , 2012 ) . the definition of distance classes , both in terms of the total number of classes and their upper and lower limits , is somewhat arbitrary and depends on the spatial distribution of the populations . a  rule of thumb  suggests about four to five classes for 20 populations . from a statistical point of view it is recommendable to keep the number of links ( pairs of populations ) within each matrix w approximately constant , which may require unequal distance intervals ( e.g. , 0100 km , 100250 km , 250500 km , 5002000 km , see sokal and oden , 1978a , b for a discussion ) . the most important issue about correlograms is that they should capture a continuous distribution in geographic space . however , one must keep in mind that , if the number of populations is relatively small , or if the populations are distributed irregularly across space ( e.g. aggregated in clusters ) , it may not be possible to use a large number of distance classes . this is so because there may not be enough pairs of populations within a given distance class to provide a reliable estimate of the correlation . for the  baru  populations , a correlogram with five geographic distances classes indicated that populations distant by 156 km ( first distance class : from 0 km to 318 km ) tend to be similar ( rm = 0.337 ; p < 0.001 with 4999 permutations ) ( figure 3a ) . the mantel correlation decreased more or less linearly up to a value of 0.333 ( p < 0.001 ) in the last distance class , when populations were approximately 1120 km apart . as discussed earlier , negative correlation values indicate that populations that are located at a given distance apart tend to be genetically dissimilar . notice , however , that the mantel correlations in both the first and last distance classes were not very high ( i.e. , 0.33 ) , indicating that the spatial structure is not strong ( remember that the overall mantel test is 0.499 , so that only about 24.9% ( i.e. 0.499 ) of the genetic divergence is explained by geographic distance - see below ) . it is also possible to compute the mean fst within each distance class and plot it against the mean value of the class ( figure 3b ) . this is sometimes called distogram and provides an interesting and more direct visual evaluation of spatial patterns in genetic structure . for the  baru  dataset , when nearby populations in the first distance class were compared , the mean fst was 0.224 ( smaller than the overall value of 0.367 ) , whereas in the last distance class the mean fst was equal to 0.522 , which is higher than the mean value . thus , the correlogram and the distogram showed a continuous and linear decrease of genetic similarity ( a higher mean fst , and a lower mantel correlation ) when geographic distance increased ( figure 2a ) . this result is expected when there is a clinal pattern of genetic variation in the studied region ( i.e. , when allele frequencies decrease or increase in a directional way ) . spatial clines can arise by selection along environmental gradients ( unlike in the case of microsatellite markers ) , and/or by range expansions or diffusion of genes through space in migratory events or allelic surfing . indeed , previous analyses suggest that patterns of genetic variation in  baru  are related to range expansions from north to south , tracking climate changes after the last glacial maximum ( see diniz - filho et al . , 2012b ) . other more complex patterns can be detected using correlograms , and perhaps the most common pattern observed in nature is an exponential - like decrease in which there are high mantel correlations in the first distance classes , which tend to decrease and stabilize after a given distance class , indicating that there are patches of genetic variation or similarity . these patches can be caused by several factors , including different environments driving genetic variation ( again unlike in the case of microsatellites ) , or the subdivision of the studied region by barriers , or simple isolation - by - distance ( see below ) . the geographic distance at which the mantel correlation is zero or non - significant indicates the size of the patch , and this can be useful for understanding population and genetic dynamics in space ( see sokal and wartenberg , 1983 ; sokal et al . , patch size can also be used for establishing more efficient approaches in conservation genetics , allowing to estimate regions within which genetic variability is similar ( see diniz - filho and telles , 2002 , 2006 ) . when exponential - like correlograms appear , the overall mantel test may be a poor estimate of the spatial pattern because it assumes a linear correlation between matrices . thus it is important to check for non - linearity and heteroscedastic relationships between geographic and genetic distances with a simple scatterplot before interpreting the result of a global mantel test . an even safer alternative would consist in using correlograms instead of the simple mantel test ( see borcard and legendre , 2012 ) . finally , it is also important to highlight that , despite recent discussions on the validity of the mantel test ( especially of the partial mantel tests , see below ) , the mantel correlogram deserves its place in the ecologist s  toolbox  . for instance , borcard and legendre ( 2012 ) recently used several simulations to show that the statistical performance of a mantel correlogram , for both type i and type ii error rates , is reliable . another possibility for using the mantel test is to compare the relationship between two matrices , but taking into account the effect of a third one ( usually the geographical distances ) , as originally proposed by smouse et al . when analyzing spatially distributed data , the main issue is to find out if the two matrices are  causally  related ( i.e. , in the sense that they indicate an ecological or evolutionary process ) , or if the observed relationship appears only because both variables are spatially structured by intrinsic effects ( i.e. , distance - structured dispersal causing more similarity between neighboring populations ) . when one is interested in evaluating the statistical correlation between two variables ( say , an allele frequency and temperature ) whose values are spatially distributed , the most common ( and statistically sound ) approach is to apply spatial regression , methods ( see diniz - filho et al . , 2009 for a review using genetic data and perez et al . , 2010 for an application ) . however , when the hypotheses are specified in terms of distance matrices , such as in the case of isolation - by - distance and many landscape models ( see wagner and fortin , 2013 ) , the most popular approach is to apply partial mantel tests ( see legendre and legendre , 2012 for a review ) . , 1986 ; oden and sokal , 1992 ; legendre and legendre , 2012 ) , but the general reasoning is to evaluate how two matrices are correlated after controlling , or keeping statistically constant , the effect of other matrices ( see sokal et al . , 1986 , 1989 , for initial applications ) . in a first approach , it is possible to calculate the partial correlation between matrices g and e ( where e is a distance matrix that one wants to correlate with g , keeping matrix d constant ) . the partial correlation is given by 
 r(ge|d)=rm  ( ge)rm  ( ed )  rm  ( gd)/[(1rm  ( ed))1/2 ]  [ ( 1rm  ( gd))1/2]where zn(ge ) is , for instance , the correlation coefficient between matrices g and e and r(ge|d ) is the correlation between g and e , after taking d into account . to illustrate these approaches with the  baru  dataset , it is necessary to generate other explanatory matrices . first , for each locality , we obtained the altitude and 19 bioclimatic variables from worldclim ( hijmans et al . , 2005 ) and , after standardizing each variable to zero mean and unity variance , an environmental ( euclidean ) distance matrix for all possible pairwise combinations of the local populations was obtained . this matrix ( e ) expresses then the environmental ( mainly climatic ) differences between populations . second , we also estimated the amount of natural habitats remaining between pairs of populations , as the proportion of natural habitats in a 10 km wide  corridor  linking two populations ( a matrix r ) . this matrix was derived from land use data obtained using the vegetation cover maps of the brazilian biomes at the 1:250.000 spatial scale , based on compositions of the bands 3 , 4 and 5 of landsat 7 etm+ images of the year 2002 ( see diniz - filho et al . , 2012a ) . a simple mantel correlation revealed that fst is not correlated to the proportion of the natural remnants matrix r ( rm = 0.23 ; p = 0.142 ) , and that this matrix is not spatially correlated ( rm= 0.075 ; p = 0.552 ) . however , fst is significantly correlated with environmental distances e according to a simple mantel test ( rm = 0.302 ; p = 0.008 ) . however , we already know that genetic divergence is spatially patterned ( rm = 0.499 ) and there is also a very strong spatial pattern in environmental variation e ( rm = 0.838 ; p < 0.001 ) . thus , the main issue is to test if there is a correlation between g and e , after taking the geographic distances ( matrix d ) into account . this relationship is not expected for neutral markers as microsatellites , except if one considers that these loci are linked with adaptive ones . indeed , the partial correlation between g and e , after taking into account geographic distances d , was equal to - rm(ge|d ) = 0.248 ( p = 0.956 ) , so the relationship between genetic and environment disappeared when geographic structure common to both matrices was accounted for ( as in principle expected for neutral markers , as pointed out above ) . first , it is possible to quantify the relationships between fst and geographic distance d and environmental distance e by partial coefficients of determination , disentangling the amount of variation explained by each predictor matrix and their shared contribution ( see pellegrino et al . , 2005 for an application in a phylogeographical context ) . in the  baru example , the geographic distances explained 24.9% of the variation in fst ( the square of the mantel correlation , rm equal to 0.499 ) , whereas the effect of environment was equal to 9.09% . using a standard multiple regression framework , if the matrices e and d are used as explanatory matrices to explain fst , the overall rm is equal to 0.295 . the sum of the rm is slightly larger than the overall rm and , therefore , there is a small shared fraction ( 4.4% ) . the unique effects of geographic and environmental distances are equal to 0.204 and 0.046 , respectively . this result reveals that about half of the small explanatory power of environmental distances was due to spatial patterns ( in agreement with the results of the partial correlation shown above ) . finally , it is also possible to generalize the multiple regression approach and evaluate simultaneously the effects of several explanatory matrices , a framework called multiple regression on distance matrices ( mrm ; lichstein , 2007 ) . using the  baru  dataset , we can evaluate the  effects  of the explanatory distance matrices ( d , e and r ) on the genetic divergence estimated by fst . in this case , these matrices explained 32.1% of the variation in genetic divergence , and only the standardized partial regression coefficient of geographic distances was significant at p < 0.001 ( p - value for e was equal to 0.111 and for r equal to 0.239 ) . the results are thus similar to all previous mantel tests that did not show partial effects of the environment or proportion of natural remnants on genetic distances . by far , the partial test is still the most controversial application of mantel test , and there has been a long discussion about its statistical performance in terms of type i error and power ( raufaste and rousset , 2001 , 2002 ; castellano and balletto , 2002 ; cushman and landguth , 2010 ; harmon and glor 2010 ; legendre and fortin , 2010 ; guillot and rousset , 2013 ) . actually , since its initial applications , some potential problems of low power to detect correlation and inflated type i error in partial tests have been considered ( oden and sokal , 1992 ) , and different forms of permutations may provide different results depending on data characteristics ( legendre , 2000 ) . however , some issues emerge when matrices are built upon two variables ( transformed into matrices using euclidean distances ) and not multivariate distance matrices per se ( such as a nei genetic distance or pairwise fst ) . in this case there are more appropriate tools for correlating variables while taking their spatial structure into account ( dormann et al . , 2007 , diniz - filho et al . , 2009 ; guillot and rousset , 2013 ) . however , legendre and fortin ( 2010 ) , besides indicating that other approaches have higher statistical power than the mantel test , wrote that  ... the mantel test should not be used as a general method for the investigation of linear relationships or spatial structures in univariate or multivariate data  , and its use should be restricted to tests of hypotheses that can only be formulated in terms of distances likewise , guillot and rousset ( 2013 ) recently found very high type i error rates for partial mantel tests and strongly condemned their use . nonetheless simulations showed that other approaches for estimating partial correlation between matrices ( i.e. , redundancy analysis based on eigenfunction spatial analyses - see section below ) may also have inflated type i error rates ( legendre et al . a simple solution to this problem with type i error was given by oden and sokal ( 1992 ) , who pointed out that when using partial mantel tests it is important to be conservative and only reject the null hypothesis of no correlation if p is much smaller ( say , p = 0.001 ) than the nominal level of 5% . until the development of other methods , this overall reasoning should be adopted when using partial mantel tests . many recent studies have interpreted a significant mantel correlation between g and d as due to wright s isolation - by - distance ( ibd ) process . although this is one possibility , it is hardly the only one ( see meirmans , 2012 ) , and even a correlogram expressing a exponential - like decrease in mantel correlations may indicate other processes creating patches of genetic variation ( see sokal and oden , 1978a , b ; sokal and wartenberg , 1983 ) . thus , it is not straightforward to link patterns to processes and , in principle , a significant mantel test or a correlogram pattern only indicates that genetic variability is structured in geographic space . sokal and oden ( 1978b ; see also sokal and wartenberg , 1983 ; and diniz - filho and bini , 2012 for a historical review ) proposed a more complex framework based on spatial analyses ( a combination of univariate correlograms built with moran s i spatial correlograms ) to infer ibd , but even this framework is not unanimously accepted ( see slatkin and arter , 1991 ) . however , under the assumption that the processes driving genetic variation is ibd , it is possible to infer demographic and ecological parameters based on the shape of the correlograms ( see epperson , 2003 ; hardy and vekemans , 1999 ; vekemans and hardy , 2004 ) . rousset ( 1997 ) showed that , under ibd , the regression of fst/(1-fst ) against the logarithm of geographic distances would provide a linear relationship with slope b equal to 
 b=1/(4n2)and intercept a equal to 
 a=ln()+eln(2)+2a2where n is the population size ,  the variance of distance between parent and offspring ( 4 is wright s neighborhood area in two dimensions ) , a2 a constant related to the dispersal kernel , and e is euler s constant ( 0.5772 ) . in practice , although it is difficult to estimate population size and dispersal distance without further experiments ( capture - recapture data , for example ) , as it is difficult to assume a2 = 0 ( rousset , 1997 ) , the theoretical derivation clearly shows how empirical relationship between matrices can provide insights on ibd parameters . for the  baru  dataset , the transformation of both genetic and geographic distances indicates a non - linear relationship ( figure 4 ) , and the model with the transformations proposed by rousset ( 1997 ) is clearly less fit . this result suggests that ibd does not apply in general , and parameter estimation associated with this process may be flawed . because of the recent discussions on mantel tests ( see above ) , it is worthy to discuss other strategies for data analysis in the multivariate case . the overall problem in combining genetic data and geographic space , in a broad sense , is to convert the two datasets into a common  format for example , the discussions on the use of mantel tests in the bivariate case ( the correlation between two variables keeping distance constant , see guillot and rousset , 2013 ) started because space was expressed as distances , so a first idea was to transform genetic variables into distances and use a partial mantel test ( although simpler strategies to deal with spatial structures underlying two variables exist ) . if the data is multivariate , such as several alleles and loci used to calculate a divergence matrix , the mantel test can be even more directly applied , because pairwise distances can be intuitively compared using this approach . however , there are other possibilities to deal with the raw data ( i.e. , allelic frequencies ) and , because they are based on ordinations ( see legendre and legendre , 2012 ) , one can use scores to compare populations and not the original values per se . the most common current alternative to the mantel test ( and partial mantel tests ) is to ordinate the genetic distances ( fst ) and compare them with geographic coordinates or other vector representations of geographical distances ( e.g. , polynomial function of geographic coordinates ) . although it is also possible to perform the analyses below based on the 52 allele frequencies directly , this would generate a euclidean metric ( rogers ) in a linear ordination , making a comparison with mantel tests not exact ( although quite close , by considering the high correlation between nei , rogers and fst pairwise distances for the  baru  ) . so , we applied a principal coordinate analysis ( pcoa ) to the fst matrix and retained the first five axes based on a broken - stick criterion . we then used these five axes as a response matrix in a series of redundancy analysis ( rda ) ( legendre and legendre , 2012 ) , and compared them with the mantel tests already presented . first , an rda was carried out to analyze the spatial patterns of the genetic dataset ( as summarized by the first five axes derived from pcoa ) using latitude and longitude as explanatory variables . this is a multivariate generalization of the linear trend surface ( mtsa ) analysis ( see wartenberg , 1985 ; bocquet - appel and sokal , 1989 ) . the coefficient of determination r of the rda was equal to 0.251 ( that of the mantel test was equal to 0.249 ) . the similarity between these figures is expected by considering previous discussions about the strong linear component of genetic variation revealed by the mantel correlograms and reflecting past range expansion . however , the mtsa allows fitting a linear model , describing only broad - scale spatial structures . a polynomial function of the geographic coordinates would capture more complex patterns , but collinearity problems and low statistical power for small sample sizes make this approach less recommended . a more general approach to transform geographic space in a raw data form ( i.e. , variables x populations , instead of distance matrix ) is to apply an eigenfunction analysis of geographic distances ( or binary w connections ) to obtain there are several versions of this approach ( see griffith and peres - neto , 2006 ; bini et al . , 2009 ; landeiro and magnusson 2011 ; diniz - filho et al . , 2009 , 2012c ) . these methods are now collectively called spatial eigenfunction analyses ( sea ) and have been extensively used in ecology , and recently also gained attention from landscape geneticists ( i.e. , manel et al . , 2010 ; the idea of sea is to extract eigenvectors from geographic distances and connectivity matrices , and these eigenvectors tend to map the spatial structure among populations at different spatial scales . when allele frequencies or pcoa axes are regressed against these eigenvectors , some of them will tend to describe the spatial patterns in genetic variation . this can be done for single alleles , but here we modeled simultaneously the five axes from the pcoa of fst matrix using an rda , following a multidimensional approach . one of the main difficulties with this approach is to decide which spatial eigenvectors shall be used in the analyses , and several criteria can be applied . when the five axes derived from pcoa matrix were regressed against the three selected eigenvectors ( 1 , 3 and 5 ) , the rda r was equal to 0.362 , slightly higher than the one obtained by mtsa ( because it was able to capture more complex spatial structures in genetic data beyond the overall linear trend ) . thus , the mantel test , mtsa and sea all showed significant correlations between g and d. the magnitude of spatial pattern for e and r modeled by these different approaches was also similar ( see table 2 ) . however , an interesting application of the ordination approach based on rda is to evaluate partial relationships , providing thus an alternative to partial mantel tests ( which is important , by considering all discussions on the validity of the partial mantel test already pointed out ) . thus , a pcoa was used to map distances of matrix e and retaining the two axes according to the broken - stick criterion . the rda also revealed a significant relationship between g and e ( with an r = 0.215 ; p < 0.01 ) . by using the partial rda it is possible to test if the genetic and environmental matrices are actually correlated after the spatial structure of both matrices is taken into account when defining space by geographical coordinates , in the mtsa approach , the partial r between g and e was equal to 0.199 ( p < 0.01 ) , thus correlation between genetic and environment remained even when spatial structure ( i.e. , the linear trend ) was taken into account . however , using sea , the r between g and e ( controlling for spatial interdependence ) decreased to 0.083 , which was not statistically significant ( p = 0.23 ) . thus , when geographic space is modeled in a more appropriate way , the result from ordination was similar to that obtained by the mantel test , which is also consistent with the fact that neutral markers , such as microsatellites , are not expected to be correlated with climatic or environmental variation . thus , results from rda were similar to those provided by mantel tests , both when comparing two matrices and when testing partial relationships ( table 2 ) . notice , however , that the relationship between g and e is higher for rda than for the mantel test ( and this relationship actually disappears when d is taken into account ) . of course , this particular example does not solve the controversies on partial mantel tests , and other studies , using simulations , have been performed to better establish the statistical performance of these ( and other ) techniques . these studies concluded that , although sea and rda approaches may have more accurate type i and ii errors , under certain conditions they can behave as badly as mantel tests . moreover , sea has a more difficult component , which is the selection of eigenvectors ( both in response and explanatory , in our case ) to be used in the analyses . a mantel test is simpler and can be interpreted more directly , and thus may be still valid in many cases . we believe that our empirical results reinforce that when patterns are strong and clear , techniques tend to give comparable results . in all cases , results of partial analyses should be interpreted with caution and , more likely , using the different alternatives to search for a robust and consistent outcome . despite recent discussions and criticisms , we believe that the mantel test can be a powerful approach to analyze multivariate data , mainly if the ecological or evolutionary hypotheses are better ( or only ) expressed as pairwise distances or similarities , as pointed out by legendre and fortin ( 2010 ) . even though , an important guideline is to always check the assumptions of linearity and homoscedasticity in the relationships between genetic divergence and other matrices ( i.e. , geographic distances ) , because such violations are actually expected under theoretical models , such as ibd . if these violations occur , a global mantel test may be a biased description of the amount of spatial variation in the data . mantel correlograms may be useful to overcome these problems and , at the same time , may provide a more accurate and visually appealing description of the spatial patterns in the data . partial mantel tests can still be applied , but using a more conservative critical level for defining their significance and , if possible , coupled with ordination and spatial eigenfunction analyses . finally , because of the ongoing discussions , it is important that researchers are aware of other possibilities for analyzing data , such as performed here . although our empirical example with genetic variation in the  baru  tree does not allow a deep evaluation of the statistical performance of these techniques and comparison with simulation - based studies , it reveals that , as is common in empirical applications , results usually converge . thus , all these different approaches gave similar estimates of the magnitude of spatial variation in genetic variation in the  baru  tree in the cerrado biome , when compared with mantel test . more importantly , the results are expected based on previous knowledge of the ecological and evolutionary processes underlying such variation .
the comparison of genetic divergence or genetic distances , estimated by pairwise fst and related statistics , with geographical distances by mantel test is one of the most popular approaches to evaluate spatial processes driving population structure . 
 there have been , however , recent criticisms and discussions on the statistical performance of the mantel test . 
 simultaneously , alternative frameworks for data analyses are being proposed . here , we review the mantel test and its variations , including mantel correlograms and partial correlations and regressions . for illustrative purposes , we studied spatial genetic divergence among 25 populations of dipteryx alata (  baru  ) , a tree species endemic to the cerrado , the brazilian savannas , based on 8 microsatellite loci . 
 we also applied alternative methods to analyze spatial patterns in this dataset , especially a multivariate generalization of spatial eigenfunction analysis based on redundancy analysis . 
 the different approaches resulted in similar estimates of the magnitude of spatial structure in the genetic data . 
 furthermore , the results were expected based on previous knowledge of the ecological and evolutionary processes underlying genetic variation in this species . 
 our review shows that a careful application and interpretation of mantel tests , especially mantel correlograms , can overcome some potential statistical problems and provide a simple and useful tool for multivariate analysis of spatial patterns of genetic divergence .