codep-package: Multiscale Codependence Analysis

Description Details Author(s) References See Also Examples

Description

Computation of Multiscale Codependence Analysis and spatial eigenvector maps, as an additional feature.

Multiscale Codependence Analysis (MCA) consists in assessing the coherence of pairs of variables in space (or time) using the product of their correlation coefficients with series of spatial (or temporal) eigenfunctions. That product, which is positive or negative when variables show similar or opposing trends, respectively, are called codependence coefficients. These eigenfunctions are obtained in three steps: 1) a distance matrice calculated from the locations of samples in space (or the organisation of the sampling schedule). 2) from that distance matrix, a matrix of spatial weights is obtained; the same matrix as to calculate Moran's autocorrelation index, hence the name, and 3) the spatial weight matrix is eigenvalue-decomposed after centering each rows and columns of the spatial weight matrix.

The statistical significance of the codependence coefficients is tested using parametric or permutational testing of a tau statistic. The tau statistic is the product of the two Student's t statistics obtained from each of the two variables with a given eigenfunction. The tau statistic can take both positive and negative values, thereby allowing one to perform one-directional or two-directional testing. For multiple response variables, testing is performed using the phi statistic instead. That statistics is the distribution of the product of two Fisher-Snedocor F statistics (see Product-distribution for details).

Details

Function MCA performs Multiscale Codependence Analysis (MCA).

Functions test.cdp and permute.cdp handle parametric permutational testing of the codependence coefficients, respectively.

Methods are provided to print and plot cdp-class objects (print.cdp and plot.cdp, respectively) as well as summary (summary.cdp), fitted values (fitted.cdp), residuals (residuals.cdp), and to make predictions (predict.cdp).

Function eigenmap calculates spatial eigenvector maps following the approach outlined in Dray et al. (2006), and which are necessary to calculate MCA. It returns a eigenmap-class object. The package also features methods to print (print.eigenmap) and plot (plot.eigenmap) these objects. Function eigenmap.score can be used to make predictions for spatial models built from the eigenfunctions of eigenmap using distances between one or more target locations and the sampled locations for which the spatial eigenvector map was built.

The package also features an examplary dataset Salmon containing 76 sampling site positions along a 1520 m river segment as well as functions cthreshold and minpermute, which calculates the testwise type I error rate threshold corresponding to a given familywise threshold and the minimal number of permutations needed for testing Multiscale Codependence Analysis given the alpha threshold, respectively.

The DESCRIPTION file: This package was not yet installed at build time.

Index: This package was not yet installed at build time.

Author(s)

Guillaume Guenard and Pierre Legendre, Bertrand Pages

Maintainer: Guillaume Guenard <guillaume.guenard@gmail.com>

References

Dray, S.; Legendre, P. and Peres-Neto, P. 2006. Spatial modelling: a comprehensive framework for principal coordinate analysis of neighbor matrices (PCNM). Ecol. Modelling 196: 483-493

Guénard, G., Legendre, P., Boisclair, D., and Bilodeau, M. 2010. Multiscale codependence analysis: an integrated approach to analyse relationships across scales. Ecology 91: 2952-2964

Guénard, G. Legendre, P. 2018. Bringing multivariate support to multiscale codependence analysis: Assessing the drivers of community structure across spatial scales. Meth. Ecol. Evol. 9: 292-304

See Also

Legendre, P. and Legendre, L. 2012. Numerical Ecology, 3rd English edition. Elsevier Science B.V., Amsterdam, The Neatherlands.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
data(Mite)
emap <- eigenmap(x = mite.geo,weighting=Wf.RBF,wpar=0.1)
emap
# Organize the environmental variables
mca0 <- MCA(Y = log1p(mite.species), X = mite.env, emobj = emap)
mca0_partest <- test.cdp(mca0, response.tests = FALSE)
summary(mca0_partest)
plot(mca0_partest, las = 2, lwd = 2)
plot(mca0_partest, col = rainbow(1200)[1L:1000], las = 3, lwd = 4,
     main = "Codependence diagram", col.signif = "white")
#
rng <- list(x = seq(min(mite.geo[,"x"]) - 0.1, max(mite.geo[,"x"]) + 0.1, 0.05),
            y = seq(min(mite.geo[,"y"]) - 0.1, max(mite.geo[,"y"]) + 0.1, 0.05))
grid <- cbind(x = rep(rng[["x"]], length(rng[["y"]])),
              y = rep(rng[["y"]], each = length(rng[["x"]])))
newdists <- matrix(NA, nrow(grid), nrow(mite.geo))
for(i in 1L:nrow(grid)) {
  newdists[i,] <- ((mite.geo[,"x"] - grid[i,"x"])^2 +
                    (mite.geo[,"y"] - grid[i,"y"])^2)^0.5
}
#
spmeans <- colMeans(mite.species)
pca0 <- svd(log1p(mite.species) - rep(spmeans, each = nrow(mite.species)))
#
prd0 <- predict(mca0_partest,
                newdata = list(target = eigenmap.score(emap, newdists)))
Uprd0 <- (prd0 - rep(spmeans, each = nrow(prd0))) 
#
### Printing the response variable
prmat <- Uprd0[,1L]
dim(prmat) <- c(length(rng$x),length(rng$y))
zlim <- c(min(min(prmat),min(pca0$u[,1L])),max(max(prmat),max(pca0$u[,1L])))
image(z = prmat, x = rng$x, y = rng$y, asp = 1, zlim = zlim,
      col = rainbow(1200L)[1L:1000], ylab = "y", xlab = "x")
points(x = mite.geo[,"x"], y = mite.geo[,"y"], pch = 21,
       bg = rainbow(1200L)[round(1+(999*(pca0$u[,1L]-zlim[1L])/(zlim[2L]-zlim[1L])),0)])
#

Example output

Loading required package: parallel

Moran's eigenvector map containing 48 basis functions.
Functions span 70 observations.

Eigenvalues:
 [1] 1.865346e+01 9.527364e+00 3.412793e+00 3.144370e+00 2.126661e+00
 [6] 8.794083e-01 7.277611e-01 3.009295e-01 2.173357e-01 1.598639e-01
[11] 1.021974e-01 7.193102e-02 3.663115e-02 3.138651e-02 1.793673e-02
[16] 1.216847e-02 4.694981e-03 3.675778e-03 2.836480e-03 2.137597e-03
[21] 1.265182e-03 7.682698e-04 6.220003e-04 4.945038e-04 3.119693e-04
[26] 1.292270e-04 8.185096e-05 6.037447e-05 5.182858e-05 2.662068e-05
[31] 1.901207e-05 1.216981e-05 9.440889e-06 8.360219e-06 5.273596e-06
[36] 2.825103e-06 1.808937e-06 7.430352e-07 5.128666e-07 4.124048e-07
[41] 3.051672e-07 2.262343e-07 1.934075e-07 1.194355e-07 5.928511e-08
[46] 4.279740e-08 2.747926e-08 1.730860e-08


Multiple Multi-scale Codependence Analysis
---------------------------

14 explanatory variables


Test table:
                 Variable        phi df1 df2 Pr(>|phi|)
dbMEM1           WatrCont 2513.05090  35  68   <2.2e-16
dbMEM4          Shrub:Few   76.08541  35  67    1.4e-07
dbMEM2  Substrate:Sphagn1   76.64292  35  66    1.3e-07
dbMEM6         Shrub:None  132.30291  35  65    3.7e-11
dbMEM3          Shrub:Few   36.13769  35  64    0.00059
dbMEM5         Shrub:Many   45.32013  35  63    6.7e-05
dbMEM24          SubsDens   17.23002  35  62       0.13

No individual response testing available

codep documentation built on May 2, 2019, 3:45 p.m.