quality.fspaces {mFD}R Documentation

Compute functional spaces and their quality

Description

Compute a Principal Coordinates Analysis (PCoA) using functional distance between species. Then the function evaluates the quality of spaces built using an increasing number of principal components. Quality is evaluated as the (absolute or squared) deviation between trait-based distance (input) and distance in the PCoA-based space (raw Euclidean distance or scaled distance according to its maximum value and maximum of trait-based distance). Option to compute a functional dendrogram and its quality. This function is based on the framework presented in Maire et al. (2015).

Usage

quality.fspaces(
  sp_dist,
  fdendro = NULL,
  maxdim_pcoa = 10,
  deviation_weighting = "absolute",
  fdist_scaling = FALSE
)

Arguments

sp_dist

a dist object with pairwise distance among all species (at least 3 species needed). Functional distance matrix from trait values can be computed using funct.dist function.

fdendro

a character string indicating the clustering algorithm to use to compute dendrogram. Should be one of the method recognized by hclust (e.g. 'average' for UPGMA). Default: fdendro = NULL (so no dendrogram computed).

maxdim_pcoa

a single numeric value with maximum number of PCoA axes to consider to build multidimensional functional spaces. Default: maxdim_pcoa = 10. See below about number of axes actually considered.

deviation_weighting

a character string referring to the method(s) used to weight the differences between species pairwise distance in the functional space and trait-based distance. 'absolute' (default) means absolute differences are used to compute mean absolute deviation mad index; 'squared' means squared differences are used to compute root of mean squared deviation rmsd index. Both values could be provided to compare quality metrics.

fdist_scaling

a vector with logical value(s) specifying whether distances in the functional space should be scaled before computing differences with trait-based distances. Scaling ensures that trait-based distances and distances in the functional space have the same maximum. Default: FALSE. Both values could be provided to compare quality metrics.

Value

A list with:

Note

The maximum number of dimensions considered for assessing quality of functional spaces depends on number of PC axes with positive eigenvalues (i.e. axes with negative eigenvalues are not considered); so it could be lower than $maxdim_pcoa. The quality metric obtained with deviation_weighting = 'squared' and fdist_scaling = TRUE is equivalent to the square-root of the 'mSD' originally suggested in Maire et al. (2015).

Author(s)

Sebastien Villeger, Eva Maire, and Camille Magneville

References

Maire et al. (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.

Examples

# Load Species x Traits Data
data("fruits_traits", package = "mFD")

# Load Traits x Categories Data
data("fruits_traits_cat", package = "mFD")

# Compute Functional Distance
sp_dist_fruits <- mFD::funct.dist(
  sp_tr         = fruits_traits,
  tr_cat        = fruits_traits_cat,
  metric        = "gower",
  scale_euclid  = "scale_center",
  ordinal_var   = "classic",
  weight_type   = "equal",
  stop_if_NA    = TRUE)

# Compute Functional Spaces Quality (to retrieve species coordinates)
fspaces_quality_fruits <- mFD::quality.fspaces(
  sp_dist             = sp_dist_fruits,
  maxdim_pcoa         = 10,
  deviation_weighting = "absolute",
  fdist_scaling       = FALSE,
  fdendro             = "average")
 fspaces_quality_fruits
  
# Retrieve Species Coordinates
sp_faxes_coord_fruits <- fspaces_quality_fruits$details_fspaces$sp_pc_coord
sp_faxes_coord_fruits

[Package mFD version 1.0.7 Index]