Learn R Programming

douconca (version 1.2.3)

anova.cca0: Permutation Test for canonical correspondence analysis

Description

anova.cca0 performs residual predictor permutation for cca0, which is robust against differences in the weights (ter Braak & te Beest, 2022). The arguments of the function are similar to those of anova.cca, but more restricted.

Usage

# S3 method for cca0
anova(
  object,
  ...,
  permutations = 999,
  by = c("omnibus", "axis"),
  n_axes = "all"
)

Value

A list with two elements with names table and eigenvalues. The table is as from anova.cca and eigenvalues gives the CCA eigenvalues.

Arguments

object

an object from dc_CA.

...

unused.

permutations

a list of control values for the permutations as returned by the function how, or the number of permutations required (default 999), or a permutation matrix where each row gives the permuted indices.

by

character "axis" which sets the test statistic to the first eigenvalue of the RDA model. Default: NULL which sets the test statistic to the weighted variance fitted by the predictors (=sum of all constrained eigenvalues). The default is quicker computationally as it avoids computation of an svd of permuted data sets.

n_axes

number of axes used in the test statistic (default: "all"). Example, the test statistic is the sum of the first two eigenvalues, if n_axes=2. With a numeric n_axes and model ~X + Condition(Z), the residuals of X with respect to Z are permuted with a test statistic equal to the sum of the first n_axes eigenvalues of the fitted Y in the model Y ~ X + Z, with Y the response in the model. In the default "all", the test statistic is all eigenvalues of the model Y ~ X|Z, i.e. the effects of X after adjustment for the effects on Y of Z. If by = "axis", the setting of n_axes is ignored.

Details

The algorithm is based on published R-code for residual predictor permutation in canonical correspondence analysis (ter Braak & te Beest, 2022), but using QR-decomposition instead of ad-hoc least-squares functions.

Note that anova.cca0 is much slower than anova.cca.

As anova.cca is implemented in lower level language, it is difficult to see what it implements. In simulations (with and without Condition() ) anova.cca gives results that are very similar to residual predictor permutation (RPP), but, with by = "axis", it can be conservative and is then less powerful than RPP (as tested with vegan 2.6-8).

References

ter Braak, C.J.F. & te Beest, D.E. (2022). Testing environmental effects on taxonomic composition with canonical correspondence analysis: alternative permutation tests are not equal. Environmental and Ecological Statistics. 29 (4), 849-868. tools:::Rd_expr_doi("10.1007/s10651-022-00545-4")

Examples

Run this code
data("dune_trait_env")

# rownames are carried forward in results
rownames(dune_trait_env$comm) <- dune_trait_env$comm$Sites
abun <- dune_trait_env$comm[, -1]  # must delete "Sites"

mod <- cca0(formula = abun ~ A1 + Moist + Mag + Use + Manure,
            data = dune_trait_env$envir)

mod # Proportions equal to those Canoco 5.15

scores(mod, which_cor = c("A1", "X_lot"), display = "cor")

set.seed(123)
anova(mod)
anova(mod, by = "axis")

mod2 <- vegan::cca(abun ~ A1 + Moist + Mag + Use + Manure,
                   data = dune_trait_env$envir)
anova(mod2, by = "axis")

dat <- dune_trait_env$envir
dat$Mag <- "SF"
predict(mod, type = "lc", newdata = dat)

Run the code above in your browser using DataLab