Learn R Programming

adespatial (version 0.1-1)

msr.mantelrtest: Moran spectral randomization for Mantel test

Description

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).

Usage

# S3 method for mantelrtest
msr(x, listwORorthobasis, nrepet = x$rep,
  method = c("pair", "triplet", "singleton"), ...)

Arguments

x

An object generated by the mantel.randtest function.

listwORorthobasis

an object of the class listw (spatial weights) created by the functions of the spdep package or an object of class orthobasis

nrepet

an integer indicating the number of replicates

method

an character specifying which algorithm should be used to produce spatial replicates (see msr.default).

further arguments of the msr.default function.

Value

An object of class randtest.

References

Crabot, J., Clappe, S., Dray, S. and Datry, T. (submitted) Restoring the Mantel tests.

See Also

msr.default, mantel.randtest

Examples

Run this code
# NOT RUN {
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

}

# }

Run the code above in your browser using DataLab