View source: R/assess_functional_space.R
| assess_functional_space | R Documentation |
Diagnostic tool to evaluate the quality of the PCoA-based functional space
constructed from a trait matrix. Intended for use before running core
analyses (asc_paired, asc_pairwise, etc.) to identify
potential distortion from negative eigenvalues or excessive dimensionality
reduction.
assess_functional_space(
traits,
dist_method = "gower",
dim_retention = c("msd", "variance", "broken_stick"),
var_tol = 0.8,
correction = c("none", "sqrt"),
type = NULL,
weights = NULL
)
traits |
A data frame or matrix of functional traits. |
dist_method |
Distance metric for the trait matrix. Default is |
dim_retention |
Character. Method for choosing the number of axes:
|
var_tol |
Numeric. Proportion of cumulative variance to retain (used
when |
correction |
Character. |
type, weights |
Optional; passed unchanged to |
All functions of the package build the same functional space: a PCoA of
the distances between species traits (Gower by default), keeping the
number of axes given by dim_retention. This function shows that
space before any analysis, with two diagnostics:
Number of axes. By default ("msd") the number of
axes, from 2 to 10, whose Euclidean distances best reproduce the trait
distances (lowest mSD, Maire et al. 2015). The table msd shows
the fidelity for each number of axes. More axes describe the traits
better, but FRic can only be computed in communities with more species
than axes.
Quality. The Gower distance is not strictly Euclidean, so
the PCoA can give negative eigenvalues. The quality index is the share
of positive eigenvalues; below 0.80, negative eigenvalues represent more
than 20\
(traits with many missing values, redundant or badly coded traits).
correction = "sqrt" (square root of the Gower dissimilarity,
Euclidean for complete data with constant weights, Gower 1971) removes
the negative eigenvalues, but it changes the distances between species,
so results with and without it are not comparable, and its effect on
the null-model tests has not been evaluated by simulation.
A list of class ascent_space (it also carries the class
ascfcd_space of ascent 0.5.0, which will be dropped in 0.6.0) with:
Numeric. PCoA quality index (sum(positive_eig) / sum(abs(all_eig))). Values above 0.80 are generally acceptable.
Integer. Number of species in the trait matrix.
Integer. Number of traits.
Integer. Number of PCoA axes retained.
Character. Rule used to choose them.
Numeric. Cumulative variance explained by retained axes.
Numeric vector. Relative variance per retained axis.
Integer. Count of negative eigenvalues.
Numeric. Percentage of total absolute eigenvalue represented by negative eigenvalues.
Numeric vector. All raw eigenvalues from PCoA.
Data frame. For k = 1 to 10 axes, the mean squared deviation (mSD) between the trait distances and the Euclidean distances in the first k axes (both scaled to a maximum of 1) and their Pearson correlation (Maire et al. 2015). Lower mSD = more faithful space.
Maire, E., Grenouillet, G., Brosse, S., & Villeger, S. (2015). How many dimensions are needed to accurately assess functional diversity? A pragmatic approach for assessing the quality of functional spaces. Global Ecology and Biogeography, 24, 728-740.
# Check the functional space before any analysis
q <- assess_functional_space(birds_sim$traits)
# Number of axes kept (rule: mSD) and quality (>= 0.8 is adequate). FRic can
# only be computed in samples with more species than retained axes.
q
# Fidelity of the space for 1 to 10 axes (lower mSD = more faithful)
summary(q)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.