scores.dcca {douconca} | R Documentation |
This function works very much like the vegan
scores
function, in particular
scores.cca
, with the additional results such as
regression coefficients and linear combinations of traits
('regr_traits','lc_traits')
. All scores from CA obey the so called
transition formulas and so do the scores of CCA and dc-CA. The differences
are, for CCA, that the linear combinations of environmental variables (the
constrained site scores) replace the usual (unconstrained)
site scores, and for dc-CA, that the linear combinations of traits (the
constrained species scores) also replace the usual
(unconstrained) species scores in the transition formulas.
## S3 method for class 'dcca'
scores(
x,
...,
choices = 1:2,
display = "all",
scaling = "sym",
which_cor = "in model",
tidy = FALSE
)
x |
object of class |
... |
Other arguments passed to the function (currently ignored). |
choices |
integer vector of which axes to obtain. Default: all dc-CA axes. |
display |
a character vector, one or more of |
scaling |
numeric (1,2 or 3) or character |
which_cor |
character or list of trait and environmental variables names (in this order) in the data frames for which inter-set correlations must calculated. Default: a character ("in_model") for all traits and variables in the model, including collinear variables and levels. |
tidy |
Return scores that are compatible with |
The function is modeled after scores.cca
.
The t-ratios are taken from a multiple regression of the unconstrained species (or site) scores on to the traits (or environmental variables).
An example of which_cor
is: which_cor = list(traits = "SLA",
env = c("acidity", "humidity"))
.
A data frame if tidy = TRUE
. Otherwise, a matrix if a single
item is asked for and a named list of matrices if more than one item is
asked for. The following names can be included:
c("sites", "constraints_sites", "centroids", "regression", "t_values",
"correlation", "intra_set_correlation", "biplot", "species",
"constraints_species", "regression_traits", "t_values_traits",
"correlation_traits", "intra_set_correlation_traits", "biplot_traits",
"centroids_traits")
. Each matrix has an attribute "meaning"
explaining its meaning. With tidy = TRUE
, the resulting data frame
has attributes "scaling"
and "meaning"
; the latter has two
columns: (1) name of score type and (2) its meaning, usage and
interpretation.
An example of the meaning of scores in scaling "symmetric"
with
display ="all"
:
CMWs of the trait axes (constraints species) in scaling 'symmetric' optimal for biplots and, almost so, for inter-site distances.
linear combination of the environmental predictors and the covariates (making the ordination axes orthogonal to the covariates) in scaling 'symmetric' optimal for biplots and, almost so, for inter-site distances.
mean, sd, VIF, standardized regression coefficients and their optimistic t-ratio in scaling 'symmetric'.
t-values of the coefficients of the regression of the CWMs of the trait composite on to the environmental variables
inter set correlation, correlation between environmental variables and the sites scores (CWMs)
intra set correlation, correlation between environmental variables and the dc-ca axis (constrained sites scores)
biplot scores of environmental variables for display with biplot-traits for fourth-corner correlations in scaling 'symmetric'.
environmental category means of the site scores in scaling 'symmetric' optimal for biplots and, almost so, for inter-environmental category distances.
SNC on the environmental axes (constraints sites) in scaling 'symmetric' optimal for biplots and, almost so, for inter-species distances.
linear combination of the traits and the trait covariates (making the ordination axes orthogonal to the covariates) in scaling 'symmetric' optimal for biplots and, almost so, for inter-species distances.
mean, sd, VIF, standardized regression coefficients and their optimistic t-ratio in scaling 'symmetric'.
t-values of the coefficients of the regression of the SNCs along a dc-CA axis on to the traits
inter set correlation, correlation between traits and the species scores (SNCs)
intra set correlation, correlation between traits and the dc-ca axis (constrained species scores)
biplot scores of traits for display with biplot scores for fourth-corner correlation in scaling 'symmetric'.
trait category means of the species scores in scaling 'symmetric' optimal for biplots and, almost so, for inter-trait category distances.
The statements on optimality for distance interpretations are based on the
scaling
and the relative magnitude of the dc-CA eigenvalues of the
chosen axes.
data("dune_trait_env")
# rownames are carried forward in results
rownames(dune_trait_env$comm) <- dune_trait_env$comm$Sites
mod <- dc_CA(formulaEnv = ~A1 + Moist + Mag + Use + Manure,
formulaTraits = ~ SLA + Height + LDMC + Seedmass + Lifespan,
response = dune_trait_env$comm[, -1], # must delete "Sites"
dataEnv = dune_trait_env$envir,
dataTraits = dune_trait_env$traits)
anova(mod, by = "axis")
# For more demo on testing, see demo dune_test.r
mod_scores <- scores(mod)
# correlation of axes with a variable that is not in the model
scores(mod, display = "cor", scaling = "sym", which_cor = list(NULL, "X_lot"))
cat("head of unconstrained site scores, with meaning\n")
print(head(mod_scores$sites))
mod_scores_tidy <- scores(mod, tidy = TRUE)
print("names of the tidy scores")
print(names(mod_scores_tidy))
cat("\nThe levels of the tidy scores\n")
print(levels(mod_scores_tidy$score))
cat("\nFor illustration: a dc-CA model with a trait covariate\n")
mod2 <- dc_CA(formulaEnv = ~ A1 + Moist + Mag + Use + Manure,
formulaTraits = ~ SLA + Height + LDMC + Lifespan + Condition(Seedmass),
response = dune_trait_env$comm[, -1], # must delete "Sites"
dataEnv = dune_trait_env$envir,
dataTraits = dune_trait_env$traits)
cat("\nFor illustration: a dc-CA model with both environmental and trait covariates\n")
mod3 <- dc_CA(formulaEnv = ~A1 + Moist + Use + Manure + Condition(Mag),
formulaTraits = ~ SLA + Height + LDMC + Lifespan + Condition(Seedmass),
response = dune_trait_env$comm[, -1], # must delete "Sites"
dataEnv = dune_trait_env$envir,
dataTraits = dune_trait_env$traits, verbose = FALSE)
cat("\nFor illustration: same model but using dc_CA_object = mod2 for speed, ",
"as the trait model and data did not change\n")
mod3B <- dc_CA(formulaEnv = ~A1 + Moist + Use + Manure + Condition(Mag),
dataEnv = dune_trait_env$envir,
dc_CA_object = mod2, verbose= FALSE)
cat("\ncheck on equality of mod3 (from data) and mod3B (from a dc_CA_object)\n",
"the expected difference is in the component 'call'\n ")
print(all.equal(mod3, mod3B)) # only the component call differs