f_disp: Functional dispersion

View source: R/f_disp.R

f_dispR Documentation

Functional dispersion

Description

\Sexpr[results=rd, stage=render]{ lifecycle::badge("maturing") }

This function calculates functional dispersion.

Usage

f_disp(
  x,
  trait_db = NULL,
  tax_lev = "Taxa",
  type = NULL,
  traitSel = FALSE,
  col_blocks = NULL,
  nbdim = 2,
  distance = "gower",
  zerodist_rm = FALSE,
  correction = "none",
  traceB = FALSE,
  set_param = list(max_nbdim = 15, prec = "Qt", tol = 1e-07, cor.zero = TRUE)
)

Arguments

x

Result of aggregate_taxa().

trait_db

A trait dataset. Can be a data.frame or a dist object. Taxonomic level of the traits dataset must match those of the taxonomic dataset. No automatic check is done by the function.

tax_lev

Character vector giving the taxonomic level used to retrieve trait information. Possible levels are Taxa, Species, Genus, Family as returned by aggregate_taxa().

type

The type of variables speciefied in trait_db. Must be one of F, fuzzy, or C, continuous. If more control is needed please consider to provide trait_db as a dist object. It works only when trait_db is a data.frame, otherwise ingored.

traitSel

Interactively select traits.

col_blocks

A vector that contains the number of modalities for each trait. Not needed when euclidean distance is used.

nbdim

Number of dimensions for the multidimensional functional spaces. We suggest to keep nbdim as low as possible. By default biomonitoR set the number of dimensions to 2. Select auto if you want the automated selection approach according to Maire et al. (2015).

distance

To be used to compute functional distances, euclidean or gower. Default to gower. See details.

zerodist_rm

If TRUE aggregates taxa with the same traits.

correction

Correction methods for negative eigenvalues, can be one of none, lingoes, cailliez, sqrt and quasi. Ignored when type is set to C.

traceB

If TRUE returns a list as specified in details.

set_param

A list of parameters for fine tuning the calculations. max_nbdim set the maximum number of dimension for evaluating the quality of the functional space. prec can be Qt or QJ, please refere to the convhulln documentation for more information. Deafault to QJ, less accurate but less prone to errors. tol a tolerance threshold for zero, see the function is.euclid, lingoes and cailliez from the ade4 for more details. Default to 1e-07. If cor.zero is TRUE, zero distances are not modified. see the function is.euclid, lingoes and cailliez from the ade4 for more details. Default to TRUE.

Details

Functional dispersion represents a facet of functional diversity for a community with species distributed in a multidimensional functional space. It quantifies the dispersion (i.e., spread) of the S species in the T-dimensional space. It is calculated as the mean distance in multidimensional trait space of individual species to the centroid of all species. Functional Dispersion index represents the multivariate analogue of the weighted mean absolute deviation (MAD); this makes the new index unaffected by species richness by construction. Following Laliberte and Legendre (2010) the metric is closely related to Rao's quadratic entropy and integrate information on relative abundances. See formulas and more information in Laliberte and Legendre (2010).

The gower distance refers to the mixed-variables coefficient of distance of Pavoine et al. (2009) as implemented in the ade4 package. This distance is meant to be used with fuzzy data.

Value

a vector with fuzzy functional richness results.

  1. results: results of f_disp();

  2. traits: a data.frame containing the traits used for the calculations;

  3. taxa: a data.frame conaining the taxa used for the calculations;

  4. nbdim: number of dimensions used after calculatin the quality of functional spaces according to Maire et al. (2015);

  5. correction: the type of correction used.

  6. NA_detection: a data.frame containing taxa on the first column and the corresponding trais with NAs on the second column.

  7. duplicated_traits: if present, list the taxa with the same traits.

References

Laliberte, E. and Legendre, P., 2010. A distance-based framework for measuring functional diversity from multiple traits. Ecology, 91(1), pp.299-305.

Pavoine, S., Vallet, J., Dufour, A. B., Gachet, S., & Daniel, H. (2009). On the challenge of treating various types of variables: application for improving the measurement of functional diversity. Oikos, 118(3), 391-402.

See Also

aggregate_taxa

Examples

data(macro_ex)

data_bio <- as_biomonitor(macro_ex)
data_agr <- aggregate_taxa(data_bio)
data_ts <- assign_traits(data_agr)
# averaging
data_ts_av <- average_traits(data_ts)

col_blocks <- c(8, 7, 3, 9, 4, 3, 6, 2, 5, 3, 9, 8, 8, 5, 7, 5, 4, 4, 2, 3, 8)

f_disp(data_agr, trait_db = data_ts_av, type = "F", col_blocks = col_blocks)
f_disp(data_agr,
  trait_db = data_ts_av, type = "F", col_blocks = col_blocks,
  nbdim = 10, correction = "cailliez"
)

library(ade4)

rownames(data_ts_av) <- data_ts_av$Taxa
traits_prep <- prep.fuzzy(data_ts_av[, -1], col.blocks = col_blocks)

traits_dist <- ktab.list.df(list(traits_prep))
traits_dist <- dist.ktab(traits_dist, type = "F")

f_disp(data_agr, trait_db = traits_dist)

alexology/biomonitoR documentation built on Oct. 10, 2024, 12:02 a.m.