data(dune, dune.env)
mod <- cca(dune ~ ., data = dune.env)
## defaults to species tolerances
tolerance(mod)
## sample heterogeneities for CCA axes 1:6
tolerance(mod, which = "sites", choices = 1:6)
## average should be 1 with scaling = "sites", hill = TRUE
tol <- tolerance(mod, which = "sites", scaling = "sites", hill = TRUE,
choices = 1:4)
colMeans(tol)
apply(tol, 2, sd)
## Rescaling tries to set all tolerances to 1
tol <- tolerance(decorana(dune))
colMeans(tol)
apply(tol, 2, sd)
## Relation of tolerances (within-species variation) and eigenvalues
## (between-species variation) - with adequate 'scaling'.
tol <- tolerance(mod, what = "species", scaling = "sites", choices=1:4)
w <- weights(mod, "species")
all.equal(colSums(tol^2 * w),
1 - eigenvals(mod)[1:4])
Run the code above in your browser using DataLab