This function allows to test the Mantel statistic using constrained null models in the presence of spatial autocorrelation. Random replicates of the second distance matrix are produced. They are spatially-constrained to preserve the global autocorrelation (Moran's I) and the spatial structures at multiple scales. Multiscale property is defined by the power spectrum (i.e. decomposition of the variance of the original variables) on a basis of orthonormal eigenvectors (Moran's Eigenvector Maps, MEM).
An object generated by the mantel.randtest
function.
an object of the class listw
(spatial
weights) created by the functions of the spdep package or an object
of class orthobasis
an integer
indicating the number of replicates
an character specifying which algorithm should be used to
produce spatial replicates (see msr.default
).
further arguments of the msr.default
function.
An object of class randtest
.
Crabot, J., Clappe, S., Dray, S. and Datry, T. (2019) Testing the Mantel statistic with a spatially-constrained permutation procedure. Methods in Ecology and Evolution. in press.
if(require("ade4", quietly = TRUE)
& require("spdep", quietly = TRUE)){
data(mafragh, package = "ade4")
d1 <- dist(mafragh$env[,1:3])
d2 <- dist(mafragh$env[,7])
t1 <- mantel.randtest(d1,d2)
t1
lw <- nb2listw(mafragh$nb)
t2 <- msr(t1, listwORorthobasis = lw)
t2
}
#> Warning: Zero distance(s)
#> Warning: Zero distance(s)
#> Monte-Carlo test
#> Call: msr.mantelrtest(x = t1, listwORorthobasis = lw)
#>
#> Observation: 0.1197583
#>
#> Based on 999 replicates
#> Simulated p-value: 0.205
#> Alternative hypothesis: greater
#>
#> Std.Obs Expectation Variance
#> 0.820956883 0.045009996 0.008290148