Learn R Programming

adespatial (version 0.3-24)

msr.4thcorner: Moran spectral randomization for fourth-corner analysis

Description

This function allows to test fourth-corner statistics using constrained null models (for traits and/or environmental variables). If the argument phyloORorthobasis is specified, random traits are phylogenetically-constrained to preserve the global autocorrelation (Moran's I) and the phylogenetic structures at multiple scales. If not, standard permutations are used. If the argument listwORorthobasis is specified, random environmental variables are spatially-constrained to preserve the global autocorrelation (Moran's I) and the spatial structures at multiple scales. If not, standard permutations are used. 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 `4thcorner`
msr(
  x,
  listwORorthobasis,
  phyloORorthobasis,
  nrepet = x$npermut,
  method = c("pair", "triplet", "singleton"),
  ...
)

Value

An object of class 4thcorner randomized replicates.

Arguments

x

An object generated by the fourthcorner function.

listwORorthobasis

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

phyloORorthobasis

an object of the class phylo (phylogeny) created by the functions of the ape package or an object of class orthobasis generated by functions of adephylo (me.phylo)

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.

Author

Stephane Dray stephane.dray@univ-lyon1.fr

References

Braga, J., Thuiller, W., ter Braak, C.J.F. and Dray, S. (2018) Integrating spatial and phylogenetic information in the fourth-corner analysis to test trait-environment relationships. Ecology, 99:2667-2674.

See Also

msr.default, me.phylo

Examples

Run this code

if(require("ade4", quietly = TRUE) & require("adephylo", quietly = TRUE)
& require("spdep", quietly = TRUE) & require("ape", quietly = TRUE)){
data(mafragh, package = "ade4")
fr1 <- fourthcorner(mafragh$env, mafragh$flo, mafragh$traits$tabQuantitative, nrepet = 49)
phy <- read.tree(text = mafragh$tre)
lw <- nb2listw(mafragh$nb)
fr1.msr <- msr(fr1, listwORorthobasis = lw, phyloORorthobasis = phy)

fr1
fr1.msr
}

Run the code above in your browser using DataLab