functional_divergence: Calculates functional divergence

View source: R/functional_divergence.R

functional_divergenceR Documentation

Calculates functional divergence

Description

Calculates functional divergence from a species-trait matrix and possibly an abundance vector. Weights should only be supplied, when using 'gower'=TRUE.

Usage

functional_divergence(
  x,
  w,
  a = rep(1, nrow(x)),
  ch = T,
  gower = T,
  detailed = F
)

Arguments

x

numeric matrix. Species-trait matrix.

w

numeric vector. A vector of length equal to columns in 'x', which specifies the variable weights. If missing, weights are equal.

a

optional numeric vector. Species-abundances.

ch

optional numeric or logical. Should the center of be based on the convex hull of the species, if true the convex hull is estimated on a 2-D PCoA. If a numeric the convex hull is estimateds on a N-D PCoA.

gower

a logical. Calculate entropy based on Gower dissimilarity as opposed to euclidean distance.

detailed

a logical. If true the partial divergences and convex hull vertices are returned.

Value

a number. Or if 'detailed'=TRUE, a list containing; the community functional divergences, the partial divergences and a boolean indicating whether a species is in the set of convex hull vertices for all present species in each site (missing values are missing species).

Details

This functions implements functional divergence as it is defined in \insertCiteVilleger2008asgerbachelor. It handles both euclidean distance and Gower dissimilarity (however not with ordered factors or asymmetric binary variables).

The argument 'ch' defines a maximum trait dimensionality, which will be lowered on a site by site basis, if the number of species is lower than the number of (ordinated) traits. OBS: If 'ch'=FALSE, then no convex hull will be calculated, and instead all site-present species will be used for center of mass calculation.

References

\insertRef

Villeger2008asgerbachelor


asgersvenning/bachelor documentation built on May 2, 2023, 7:06 a.m.