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

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/msr.4thcorner.R

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

1
2
3
## S3 method for class '4thcorner'
msr(x, listwORorthobasis, phyloORorthobasis,
  nrepet = x$npermut, method = c("pair", "triplet", "singleton"), ...)

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

...

further arguments of the codemsr.default function.

Value

An object of class 4thcorner randomized replicates.

Author(s)

Stephane Dray [email protected]

References

Braga, J., Thuiller, W., ter Braak, C.J.F. and Dray, S. (submitted) A novel approach to consider phylogenetic and spatial autocorrelations when testing for trait-environment relationships.

See Also

msr.default, me.phylo

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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
}

adespatial documentation built on Sept. 27, 2018, 5:04 p.m.