Full text
968 | Journal of Biogeography. 2022;49:968–978.wileyonlinelibrary.com/journal/jbi Received: 20 May 2021 | Revised: 31 January 2022 | Accepted: 12 February 2022 DOI: 10.1111/jbi.14351 METHOD Assessing the nonlinear decay of community similarity: Permutation and siteblock resampling significance tests Sara Martínez- Santalla1 | Ramiro Martín- Devasa1 | Carola Gómez- Rodríguez2 | Rosa M. Crujeiras3 | Andrés Baselga1 This is an open access article under the terms of the Creative Commons Attribution-NonCommercial-NoDerivs License, which permits use and distribution in any medium, provided the original work is properly cited, the use is non-commercial and no modifications or adaptations are made. © 2022 The Authors. Journal of Biogeography published by John Wiley & Sons Ltd. 1CRETUS, Department of Zoology, Genetics and Physical Anthropology, Universidade de Santiago de Compostela, Santiago de Compostela, Spain 2CRETUS, Department of Functional Biology (Area of Ecology), Universidade de Santiago de Compostela, Santiago de Compostela, Spain 3CITMAga, Department of Statistics, Mathematical Analysis and Optimization, Universidade de Santiago de Compostela, Santiago de Compostela, Spain Correspondence Sara Martínez- Santalla, CRETUS, Department of Zoology, Genetics and Physical Anthropology, Universidade de Santiago de Compostela, Santiago de Compostela, Spain. Email: saramartinez.s[email protected] Funding information European Regional Development Fund; Ministerio de Ciencia e Innovación Handling Editor: Simone Fattorini Abstract Aim: Modelling how community similarity decays with spatial distance is a key tool for the study of the processes behind community variation (beta diversity). Distancedecay models are computed from pairwise metrics (i.e. community similarity and spatial distance between localities) and hence suffer from pairwise dependence in the data, precluding the use of standard significance tests. Besides, distancedecay patterns are inherently nonlinear because similarity is bounded between 1 and 0. However, the only standard method to assess model significance under pairwise dependency is the Mantel test, which considers a linear model. To allow the use of nonlinear models in the assessment of distancedecay patterns, we introduce here a nonlinear significance test combining a pseudo- R2 statistic with either permutations or blocksite resampling with replacement. Location: Global. Taxon: Applicable to any taxon. Methods: To assess the performance of the pseudo- R2 significance test (i.e. type I error and statistical power), we have applied this method to exponential and powerlaw generalized linear models of simulated distancedecay data. We compared its performance with the one of a linear model (i.e. Mantel test) and illustrated its use with real data. Results: The pseudo- R2 significance test has generally good type I error and statistical power, even for highly nonlinear relationships. The Mantel test shows an adequate empirical approximation of type I error, but presents lower statistical power when the distancedecay relationship highly departs from linearity. Main conclusions: The proposed pseudo- R2 significance test for nonlinear models is adequate for exponential and powerlaw models of distancedecay of similarity and should be preferred over the linear Mantel test. Furthermore, this significance test could also be used in other nonlinear distancebased regressions. The novel siteblock resampling method could also be applied to other statistical questions related to distancedecay models that cannot be tackled using permutations, such as estimating the variance of model parameters.
| 969 MARTÍNEZ-SANTALLA et al. 1 | INTRODUCTION The decrease in similarity between biological communities with increasing distance (i.e. distancedecay of similarity) is a macroecological pattern that has been profusely studied in the last two decades. It is used as a fundamental tool for understanding variation in community composition and the processes underlying them (Gómez- Rodríguez & Baselga, 2018; Tornero et al., 2018; Tuomisto et al., 2003; among others). This pattern has also been analysed in applied conservation studies, for example, to identify relevant factors for community turnover in endangered or altered areas (e.g. Draper et al., 2019; Zhang et al., 2019). The most common approach to study distancedecay patterns is to fit a statistical model of the relationship between two pairwise matrices: community similarity and spatial distance. This statistical model allows the estimation of parameters with biological relevance, such as the proportion of variation in community similarity that is explained by distance, or the rate at which community similarity decays with distance. The search for an adequate model of distancedecay started with the seminal paper by Nekola and White (1999), in which they found that an exponential model (logtransformed similarity linearly regressed on distance) was the best fit to their data. Since then, distancedecay patterns have been mostly assessed with Linear Models (LM) with or without logtransformed similarity and distance (e.g. Nekola & White, 1999) or Generalized Linear Models (GLM) (e.g. Millar et al., 2011; Soininen et al., 2007). More recently, Nekola and McGill (2014) used simulated data to show that the expected functional form of the distancedecay relationship is either a negative exponential function at larger spatial scales or a powerlaw function at smaller spatial scales. However, even when the most adequate nonlinear functional form is selected, it is not straightforward to correctly assess the significance of the relationship given the inherent pairwise dependence of the data. Significance tests commonly used for LMs and GLMs (i.e. the F- test; see Hastie & Pregibon, 1993) should not be applied to distancedecay data because similarity and distance values violate the independence assumption. This results from similarity/distance matrices being constructed by comparing all possible pairs of communities (Legendre et al., 1994; Smouse et al., 1986). Thus, each independent observation (i.e. a biological community) is involved in the calculation of multiple similarity/distance values, which are therefore not independent among them. In the case of linear models, the statistical bias caused by pairwise dependence in distance matrices has been accounted for in the Mantel (Mantel, 1967) test. The Mantel test assesses the independence between two distance variables by comparing a linear statistic (Pearson's correlation) or a nonparametric statistic (Spearman's or Kendall's rank correlation) to the null correlation distribution (test calibration), obtained through samplingsite permutations. When paired with nonparametric correlation statistics, the Mantel test can accommodate the expected nonlinear relationship between community similarity and spatial distance (Dietz, 1983). However, when possible, the use of nonlinear parametric models (e.g. exponential or powerlaw) should be preferred over plain nonparametric tests. Nonlinear parametric distancedecay models are particularly useful because parameter comparisons between models fitted for different taxa or regions are key to assess the processes behind distancedecay patterns (Gómez- Rodríguez & Baselga, 2018; Peguero et al., 2021; Saito et al., 2015; Soininen et al., 2007; Yang et al., 2021). To our knowledge, there is no explicit significance test available to assess the significance of negative exponential or powerlaw distancedecay models that considers both the pairwise structure of distance data (in the test calibration strategy) and their functional form (in the test statistic). The lack of independence in distance and similarity matrices due to its pairwise structure constitutes the first challenge for designing a significance test of nonlinear distancedecay models, which compares the nonlinear pattern found by the model to what would be expected if similarity and distance were independent from each other (null hypothesis). Most significance tests (e.g. the F- test) have a fundamental assumption of units of observation being independent that is violated by the pairwise structure of distance matrices, causing an artificial inflation of degrees of freedom, known as pseudoreplication, that increases with sample size (Hurlbert, 1984) (Figure 1). Pseudoreplication can increase the type I error of significance tests, which can lead to falsely considering the distancedecay model as significant. In the context of distancedecay models, pseudoreplication arises because from N sites, we can compute N * (N − 1)/2 similarities. To avoid the inflation of type I error, the Mantel test estimates the null distribution of correlation between similarity and distance through permutations of the sampling sites in the similarity matrix. It then contrasts the observed correlation against its null distribution and calculates the pvalue as the proportion of cases in which the null correlation is higher than the observed correlation. The Mantel test constitutes a robust significance test for linear models, although it may be biased when the spatial structure of data is not accounted for (Guillot & Rousset, 2013; Legendre et al., 2015; Legendre & Fortin, 2010). Moreover, a departure from linearity in the relationship may lower its ability to reject the null hypothesis when it is false (low statistical power) (Diniz- Filho et al., 2013; Zeller et al., 2016). This limitation is particularly important in distancedecay models, as we know beforehand that nonlinear models are the expected functional forms (Nekola & McGill, 2014). More fundamentally, the Mantel test is not equivalent to testing the significance of a nonlinear distancedecay model since it does not compare the fitted model with its null hypothesis, but instead uses a linear or nonparametric correlation. KEYWORDS beta diversity, distancedecay of similarity, Mantel test, significance test, siteblock resampling, spatial turnover
970 | MARTÍNEZ-SANTALLA et al. Effectively detecting nonlinear patterns (i.e. having high statistical power or, in other words, low type II error) is the second challenge for designing a significance test of exponential and powerlaw models of distancedecay. A possible approach is to use a GLM's pseudo- R2 statistic, which is suitable for nonlinear models, and estimates how much of the null variation in the data is explained by a fitted, validated model (McCullagh & Nelder, 1989). Thus, in a GLM context, the pseudo- R2 compares the fit of the model of interest with a null model in which similarity and distance are independent and hence there is no distancedecay relationship. If we follow the rationale of the Mantel test and combine the pseudo- R2 statistic with permutations of sampling sites in the response matrix, it could be possible to estimate its null distribution under conditions of pairwise dependence. Another option would be to use a resampling method that accounts for the pairwise structure of the data to generate independent resamples (with replacement) of similarity and distance data. In this case, the goal is to preserve the pairwise structure of the data, and therefore resamples should be taken as blocks of similarities involving any given site (siteblock resampling). Although for a significance test, both methods would likely yield identical results, a siteblock resampling adapted to distancedecay data could be extended to other inference questions affected by pairwise dependence, such as variance estimation of model parameters or testing for differences between fitted models. The pseudo- R2 value has been previously used in similar contexts, for instance combined with randomizations that do not preserve the pairwise structure of the data (Gómez- Rodríguez & Baselga, 2018), in nonlinear regressions of distance matrices (Lichstein, 2007), or used both as a significance test and a tool for model selection (Generalized Dissimilarity Modelling; Ferrier et al., 2007) of nonlinear distancedecay models. However, to our knowledge, no study has formally assessed the performance of a permutation or blocksite resampling significance test for nonlinear distancedecay models. Distancedecay models have been extensively used in community ecology and biogeography (see, e.g., Nekola & White, 1999, Soininen et al., 2007 and the hundreds of citing papers). From first principles, we know that the relationship between community similarity and spatial (or environmental) distance must be nonlinear (Nekola & McGill, 2014). Therefore, the lack of a standard procedure to assess the significance of nonlinear distancedecay models is a major gap in the biogeographers' toolkit. In this paper, we assess the performance of a pseudo- R2 statistic in combination with permutations or siteblock resampling as a significance test for exponential and powerlaw models of distancedecay. We propose two strategies to estimate the null distribution of the pseudo- R2 statistic while considering the pairwise structure of distancedecay data: (i) permutations of sampling sites in the similarity matrix (equivalent to the permutations applied in a Mantel test, but associated here with the pseudo- R2 statistic of a nonlinear model) or (ii) a siteblock resampling method based in selecting as resampling blocks all similarities or distances that involve a given site. We then assess the ability of the pseudo- R2 significance test to detect the absence of distancedecay (type I error) and its presence (statistical power) using simulations and, finally, we apply the test to three real data examples. This new methodology constitutes an appropriate alternative for nonlinear parametric models, and should be preferred over the Mantel test, as the latter assesses linear or nonparametric relationships. 2 | MATERIALS AND METHODS 2.1 | Simulated and real data To assess the performance of a significance test based on a pseudo- R2 statistic for exponential and powerlaw models of distancedecay of community similarity, our aim was to approximate (1) its type I error, that is, the probability of rejecting the null hypothesis when it is true and (2) its statistical power, that is, the probability of rejecting the null hypothesis when it is false. To quantify these, we simulated data of biological communities across space under two hypotheses (Figure 2): 1. Null (H0): Absence of relationship between community similarity and spatial distance between communities (i.e. no distancedecay pattern). All species have the same probability of being present at any site, and the species composition of a community does not depend on its spatial location. Thus, spatial distance and FIGURE 1 Pseudoreplication in distance and similarity data. Sample size artificially inflates after computing similarity and distance matrices, as four sites (i.e. communities) result in six similarity values (i.e. for N sites we have N * (N − 1)/2 similarities or distances). Another evidence of the existence of pseudoreplication and pairwise dependence in distance data is given by the fact that site A is involved in the computation of all the similarity and distance values marked in red (i.e. N – 1 values). Created with BioRe nder.com
| 971 MARTÍNEZ-SANTALLA et al. biological similarity are independent, so the null model and the distancedecay model have the same fit to the data. 2. Alternative (H1): Nonlinear distancedecay of similarity between communities. Species are spatially aggregated and the species composition of a community is correlated with the composition of other communities close to it. Thus, spatial distance is a predictor of community similarity, so the distancedecay model fits the data better than the null model. To control for the effect of sample size in the error of the pseudo- R2 test, we simulated communities in N = {10, 50, 100} sites with a total of S = 150 species across them. For the simulation of communities under the null hypothesis, N random spatial coordinates were generated from a uniform distribution with a range between 0 and 9000. Then, independently from these coordinates, we simulated species presence– absence matrices of dimension N × S (N sites and S species) using a binomial random variable with a different probability of success for each species. This probability was taken from the probabilities of a simulated lognormal distribution, to ensure that there is a high proportion of species with narrow distributions and only a few widely distributed species, thus simulating a common pattern in natural communities (Gaston, 1996). For the simulation of communities under the alternative hypothesis, we generated Gaussian Random Fields (GRF) using grf from the ‘geoR’ package v.1.7- 5.2.2 (Ribeiro Jr et al., 2020) in R with an exponential covariance function. This function allowed us to simulate S species as spatially correlated Gaussian variables with values in N random spatial points. The exponential covariance of the GRF forces the resemblance between Gaussian variables (species) observed in two sampling points to decrease with the distance separating them, such a covariance function is given by: where 𝜑 is the range parameter that controls the strength of spatial autocorrelation, 𝜎2 is the partial sill, h is the distance between two points and C(h) is the covariance between variables in those two points. For higher values of 𝜑 , the similarity between community composition will decrease more slowly with increasing distance and vice versa. To obtain N × S presence– absence matrices, as required by many similarity indexes, we transformed the Gaussian variables to binomial data using a different probability of success for each species. This probability was taken from the probabilities of a simulated lognormal distribution, to ensure that there is a high proportion of species with narrow distributions and only a few widely distributed species, as in the case of the null model. We simulated three scenarios under the alternative hypothesis with varying degrees of spatial autocorrelation in the species composition of sampled sites ( 𝜑={300, 5000, 40,000} ), and 𝜎2=1 . (1) C(h)=𝜎 2 e( −h 𝜑 ) FIGURE 2 Pipeline of the simulations used in this study for assessing the performance of the pseudo- R2 test ( R2 KLD ) as a significance test of exponential and powerlaw models of distancedecay of similarity. Created with BioRe nder.com
972 | MARTÍNEZ-SANTALLA et al. Finally, we selected three sets of presence/absence matrices with different decay of similarity rate to illustrate the application of the test to real data: (1) Barro Colorado Island's trees (BCI), with 50 onehectare plots and 225 species (Condit et al., 2002; through ‘vegan’ package v.2.5- 4 in R, Oksanen et al., 2019); (2) Trechus beetles in Southern Europe, with 16 countries and 253 species; and (3) Amara beetles in Northern Europe, with 18 countries and 135 species. Trechus and Amara datasets were taken from Löbl and Smetana (2003) and countries were separated into Northern and Southern subsets following Gómez- Rodríguez and Baselga (2018), as these two European regions present markedly different distancedecay patterns. 2.2 | Data processing and distancedecay models Once we had presence/absence matrices and coordinates for every dataset, both simulated and real, we computed spatial distance and community similarity triangular matrices (semimatrices). Then we fitted distancedecay models to the semimatrices to test the significance of the models with the pseudo- R2 test. For distance semimatrices (Dx), we calculated Euclidean distances between coordinates of the simulated sampling sites. In the BCI dataset, distance was computed between the UTM coordinates from BCI.env in the R ‘vegan’ package. In Amara and Trechus datasets, distance was computed between the centroids of territories. Lastly, we obtained similarity semimatrices (Simy) by applying the Simpson's index using the function beta. pair from R package ‘betapart’ v.1.5.4 (Baselga et al., 2021; Baselga & Orme, 2012). We chose GLMs over LMs as for fitting exponential and powerlaw models to our distancedecay data because their regression parameters are estimated considering the untransformed similarities. Thus, the residuals used to compute the pseudo- R2 statistic in a GLM are untransformed, avoiding the possible bias caused by directly logtransforming similarity and modifying or removing 0- similarity values (Millar et al., 2011; O'Hara & Kotze, 2010). We fitted exponential GLMs by choosing the logarithm as link function and Gaussian errors. For the powerlaw GLMs, we did the same but transformed the geographical distance using the logarithm. We constructed null GLMs by regressing similarity on its own mean. All models were computed using the glm2 function from the ‘glm2’ package in R, v.1.2.1 (Marschner, 2011). 2.3 | The pseudo- R2 test: R2 KLD To test the significance of exponential and powerlaw models of distancedecay, we use the pseudo- R2 measure based on the Kullback– Leibler divergence described by Cameron and Windmeijer (1997). Our choice of a pseudo- R2 statistic for this significance test is based on the facts that (1) its null hypothesis is the independence between similarity and distance, (2) it can be calculated for exponential and powerlaw models and (3) it estimates the proportion of deviance in the null model that is explained by the fitted model, thus serving as a measure of explained variation. Its formulation is: in which D( y𝜇 0) is the deviance of the null model (interceptonly model) and D( y𝜇 1) is the deviance of the distancedecay model. In a GLM context, the deviance of a model is a measure of how well the model fits the data, with a lower deviance value implying a better fit (McCullagh & Nelder, 1989). Therefore, a larger value of r2 KLD implies a better fit to the data by the distancedecay model. To estimate the statistic's value in our data, R2 KLD , we obtained the deviance values of the fitted models using the deviance function from the ‘stats’ package v.3.5.0 (R Core Team, 2018). For data with no pairwise dependence, this test is equivalent to an F- test (Hastie & Pregibon, 1993). However, for similarity and distance data, the distribution of the statistic under the null hypothesis is not known because cases are not independent (Legendre et al., 1994). Therefore, to obtain the pvalue of the R2 KLD test, we have to estimate its expected distribution under the null hypothesis via resampling methods. The key feature to account for the dependence between pairwise similarities is to consider all the similarities or distance values related to a single site as the basic unit for resampling. These sets of data (i.e. all similarity/distance values in which a particular site/community is involved) are hereinafter referred as siteblocks. Thus, we estimated the null distribution of R2 KLD (Figure 2) using (i) siteblock permutations, which permute together all the similarity or distance values related to a single site (siteblocks) and (ii) siteblock resampling, which samples with replacement the siteblocks in the similarity and distance matrices and then randomizes withinblock values in the similarity matrix (Figure 3). 2.3.1 | Siteblock permutations We used the following procedure to obtain permutations of sampling sites in the similarity matrix (Simy), making similarity and distance (Dx) independent (Figure 3a): 1. We reordered Simy by row and column (Sim y*) without modifying Dx. 2. We fitted a GLM to Simy* and Dx, and a null GLM to Simy*; then computed both deviance values and calculated R2 KLD *. 3. We repeated 1– 2 for B permutations. 2.3.2 | Siteblock resampling Here, in contrast to the permutation procedure, resamples of siteblocks (i.e. all similarities or distances involving a given site) are taken (2) R 2 KLD =D ( y 𝜇 0 ) −D ( y 𝜇 1 ) D ( y𝜇 0)
| 973 MARTÍNEZ-SANTALLA et al. with replacement and saved to a similarity block matrix. To obtain resamples under the null hypothesis, withinblock values need to be randomized in the similarity block matrix. The procedure was (Figure 3b) as follows: 1. For N sites, siteblocks were defined by selecting the values of Dx and Simy involving a given site. We saved those N blocks as columns of two block matrices, one for each variable (Dx and Simy). 2. We drew N block resamples (columns of block matrices) with replacement, ensuring that the same blocks were sampled for both Dx and Simy, and saved them as two resample matrices. 3. To force Simy to be independent from Dx (null hypothesis of the deviance test), without changing the block structure, we randomized the Simy resample matrix by column (i.e. values within each block resample were randomized in Simy). 4. Initially, resample matrices are built with duplicate observations (N * [N − 1] values) because each block includes N − 1 values. In this step, we downsized the resample matrices to the original size of the similarity and distance matrices (N * [N − 1]/2 values), by sampling N * [N − 1]/2 values from both resample matrices. These values were saved as Dx* and Simy* resample vectors. 5. We fitted a GLM to Dx* and Simy* and a null GLM to Simy*, computed both deviance values and calculated R2 KLD *. FIGURE 3 Schematic representation of the permutation (a) and siteblock resampling (b) procedures to estimate the null distribution of the pseudo- R2 statistic ( R2 KLD ) while considering the pairwise structure of distancedecay data. Created with BioRe nder.com
974 | MARTÍNEZ-SANTALLA et al. 6. We repeated steps 1– 5 B times. Once we had the null distribution estimated by any of these two methods, we obtained the pvalue of the test as the proportion of times when R2 KLD * was larger than R2 KLD . 2.4 | Assessing the performance of the significance test To assess the performance of R2 KLD (Equation 2) in combination with siteblock permutations or siteblock resampling procedures for significance testing of distancedecay patterns, we used simulated data to estimate their respective probabilities of (i) rejecting the null hypothesis when it is true (type I error) and (ii) rejecting the null hypothesis when it is false (statistical power). For all the simulation scenarios, the significance level was 0.05. For comparison, we also estimated Mantel test's type I error using the mantel() function from ‘vegan’ package as well as the type I error of the F- test (type I ANOVA as implemented by the anova function from ‘stats’ package). This allowed us to assess how the inflation of type I error in the F- test was corrected by our pseudo- R2 test and the Mantel test. To estimate type I error and statistical power, we simulated data under the null and the alternative hypothesis, respectively. We then applied R2 KLD with 2500 siteblock permutations or siteblock resamples, the Mantel test with 2500 permutations, and the F- test, and repeated the simulation procedure 1000 times (Figure 2). The expected type I error rate was the same as the significance level, 0.05, which would indicate that the statistic is correctly calibrated. As for statistical power, we expected that the adequacy of the chosen model to the simulated distancedecay relationship would condition the performance of R2 KLD . In 𝜑 = 5000 and 𝜑 = 40,000 scenarios, the decay of similarity is extended across all the simulated distance range and should be easily detected by all the studied models (exponential, powerlaw and the linear model of the Mantel test). In contrast, in the scenario with a weaker spatial correlation, 𝜑 = 300, there is a rapid initial decay of similarity from over 0.9 to around 0.4, but for most of the distance range (approximately 95% of the maximum distance), the pattern is close to the null hypothesis. As such, it should be more difficult to detect with the pseudo- R2 test than the other two simulated scenarios of distancedecay and hence allows to check its performance with weaker patterns (Figure S1). Finally, we illustrated the application of the pseudo- R2 test and the Mantel test in the real datasets. In these three scenarios (BCI, Amara and Trechus), we also compared the fit of linear, exponential and powerlaw distancedecay models using the estimated R2 KLD values to showcase the differences between them. We conducted all the simulations and statistical work using R v.3.5.0 (R Core Team, 2018). We ran the simulations in the FINISTERRAE supercomputer, a service facilitated by the Centro de Supercomputación de Galicia (CESGA). 3 | RESULTS In simulations under the null hypothesis, all statistics (exponential R2 KLD , powerlaw R2 KLD and Mantel's r) had distributions with a mean close to 0 (Figure 4), reflecting the equivalence under this scenario between the fitted models and the null model. Both permutation and siteblock resampling strategies used to estimate the null distribution of R2 KLD avoided the inflation of type I error. Their estimated type I error was close to 0.05 and did not increase with the number of sites in the similarity matrix (Figure 4). The Mantel test showed an equally good performance regarding type I error. On the contrary, the F- test failed to return an accurate type I error rate and its inflation increased with sample size (Figure S2). In simulations under the alternative hypothesis, for the scenarios with high spatial autocorrelation in community composition ( 𝜑 = 5000 and 𝜑 = 40,000), most R2 KLD estimated values were over 0.25, meaning that exponential and powerlaw models based on spatial distance were able to explain a considerable proportion of variation in community similarity. However, when spatial autocorrelation in community composition was low ( 𝜑 = 300), the values of R2 KLD were generally under 0.05, which implies that the powerlaw and exponential models do not explain a higher proportion of variability than the null model (Figure 4; Figures S3 and S4). This had consequences in the statistical power, as this scenario ( 𝜑 = 300) is in fact very similar to the null hypothesis. In consequence, in simulations under the alternative hypothesis, the R2 KLD significance test, based either on siteblock permutations or siteblock resampling, was generally able to reject the null hypothesis for all combinations of spatial autocorrelation and sample size (statistical power > 0.9), except for the distancedecay scenario with the weakest spatial autocorrelation ( 𝜑 = 300) (Figure 4; Figures S3 and S4). On the contrary, when spatial autocorrelation was weak ( 𝜑 = 300), the estimated statistical power increased with sample size, especially for the powerlaw R2 KLD , although all tests performed poorly for extremely low sample sizes (N = 10), as expected. The negative exponential R2 KLD and the Mantel test, which do not accommodate a rapid initial distancedecay, always presented a lower statistical power than the powerlaw model (Figure 4; Figure S4). Finally, R2 KLD test was able to detect significant (α = 0.05) distancedecay patterns in the three real data cases, independently of whether the model applied was negative exponential or powerlaw; as the Mantel test did for linear models (Figure 5; Table S1). Overall, we found that negative exponential, powerlaw and linear models were not equivalent in their fit to real data; especially for the Trechus dataset, which had the most pronounced distancedecay. The powerlaw model fitted best the data (highest R2 KLD values) in BCI and Trechus datasets, although the amount of explained variation was much higher in the southern European Trechus beetles than in the tree communities of Barro Colorado Island. In turn, the negative exponential model (and similarly the linear model) provided a better fit for the northern European Amara beetles.
| 975 MARTÍNEZ-SANTALLA et al. 4 | DISCUSSION In this paper, we assessed the performance of a significance test, based on a deviancebased pseudo- R2 ( R2 KLD ), for exponential and powerlaw models of distancedecay of similarity. Our results show that the R2 KLD significance test performs well for nonlinear distancedecay patterns, using either siteblock permutations or siteblock resampling to estimate the distribution of R2 KLD under the null hypothesis. In other words, both blocksite permutations and blocksite resampling accounted for the pairwise dependence of the similarity and distance values, thus overcoming the inflation of the type I error that would arise if standard significance tests were used. We thus provide a method with several major advantages for the study of distancedecay patterns: (i) it provides a measure of goodness- of- fit, the pseudo- R2 statistic, which is easily interpretable as the amount of variation in community similarity explained by spatial distance (or alternative predictors with pairwise structure, e.g. climatic distance); (ii) it provides a robust estimate of statistical significance, with good type I error rate and statistical power; and (iii) it allows the implementation of Generalized Linear Models to fit the distancedecay relationship, with all the advantages derived from GLMs, such as modelcomparison- based AIC or the estimation of model parameters with biological relevance (i.e. the slope of the distancedecay) that can be compared between different regions or taxonomic groups. We have found that the R2 KLD significance test performed well under absence and presence of distancedecay, independently of the calibration strategy used to estimate its null hypothesis (either permutations or siteblock resampling). That is, type I error was low and statistical power was high, either with permutations or siteblock resampling strategies. The Mantel test performed well to detect distancedecay patterns when the decay pattern was clearly FIGURE 4 Proportion of significant tests across 1000 simulations for the siteblock permutations (P), siteblock resampling (R) and Mantel test (M). Simulations were run either under the null hypothesis (a, b) or the alternative hypotheses (c, d for 𝜑 = 300; and e,f for 𝜑 = 5000), and for a small (N = 10 in a, c, e) and large (N = 100 in b, d, f) number of sites. The proportion of significant tests in simulations under the null hypothesis is type I error, while the proportion of significant tests in simulations under the alternative hypothesis is statistical power. Estimated distribution of the statistics ( R2 KLD or Pearson r), type I error and statistical power are shown for negative exponential (yellow), powerlaw (blue) and linear Mantel models (red). Results for the 𝜑 = 40,000 scenario, as well as for N = 50 under all simulation scenarios are provided in the supplementary material (Figures S3 and S4)
976 | MARTÍNEZ-SANTALLA et al. present across the full range of distance and could be approximately accommodated by a linear model. However, the Mantel test suffered from low statistical power when the decay pattern was curved and less marked (data simulated with 𝜑 = 300). It should be stressed that we know a priori that linear models are not appropriate for similarity/dissimilarity indices, as these are bounded between zero and one, leading to nonlinear, asymptotic relationships with spatial or environmental distances. As shown by Diniz- Filho et al. (2013) and Zeller et al. (2016), the Mantel test can fail to detect a distancedecay relationship when this relationship is far from linear. This issue with the Mantel test is exemplified by the distancedecay scenario simulated with the weakest spatial autocorrelation ( 𝜑 = 300). In this scenario, similarity decays steadily at very short distances and reaches the lower asymptote fast (i.e. the decay pattern is strongly nonlinear). As expected, the powerlaw model R2 KLD detects more efficiently the distancedecay pattern (lower type II error) than the exponential R2 KLD or the linear model (Mantel test) since the powerlaw function can accommodate steep initial distancedecay. The potential misfit of the Mantel test as a significance test when modelling highly nonlinear patterns can also be observed in empirical data. For example, in the most pronounced and less linear of the real distancedecay data examples (Trechus), we found differences between the models' fit with the powerlaw model having the best value of explained deviance. These two results showcase the relevance of introducing in the community ecology/macroecology toolkit a significance test for nonlinear distancedecay models. Indeed, testing the significance of a linear and nonlinear model is not equivalent since they fit the data differently. As a result, the use of a linear significance test for a nonlinear model could lead to not detecting the distancedecay pattern that we are really modelling. The methods proposed here are subject of some limitations. First, we would like to explicitly acknowledge that a pseudo- R2 value does not substitute the necessary diagnostic checking of the model's assumptions (such as homoscedasticity or normally distributed residuals). Its use as a measure of explained variation must be conditioned on these assumptions being statistically validated, or the model being adequate for the data of interest and the research question by other means (e.g. in Nekola & McGill, 2014), as advised in the work of Nakagawa and Schielzeth (2013). Additionally, the pseudo- R2 statistic might be overly optimistic for small sample sizes as an estimation of explained variation and its value should be corrected accordingly (Heinzl et al., 2005). As a second limitation, the spatial structure of nonspatial distances (i.e. climatic distances) might pose additional problems. The use of R2 KLD combined with site permutations or siteblock resampling as a significance test could be applied to other types of nonlinear distancedecay models, in which the predictors are not spatial distances but distances between climatic variables, time, etc (e.g. Astorga et al., 2012 and Saito et al., 2015, with environmental distances; Matsuoka et al., 2016, with temporal distances). However, the use of Mantel tests with structured distance variables (e.g. a spatially structured climatic variable) has been criticized by various authors because neither the original Mantel nor the partial Mantel test (Smouse et al., 1986) are able to overcome the effect of this structure (Guillot & Rousset, 2013; Legendre et al., 2015; Legendre & Fortin, 2010). When applied to structured predictor variables other than spatial distances, R2 KLD will very likely present a similar bias. A possible solution for spatially structured variables could be a modification of the test following the work of Crabot et al. (2019) with the Mantel test. These authors proposed a method based on spatially FIGURE 5 Empirical distancedecay models for (a) Barro Colorado Island's trees (BCI), (b) Trechus beetles in southern Europe and (c) Amara beetles in northern Europe. Pseudo- R2 values are provided for different models (i.e. negative exponential, powerlaw and linear) pvalue. The R2 KLD significance test was applied to exponential and powerlaw models and the Mantel test to linear models. *** = <0.001