functcomp: Functional Composition

functcompR Documentation

Functional Composition

Description

functcomp returns the functional composition of a set of communities, as measured by the community-level weighted means of trait values (CWM; e.g. Lavorel et al. 2008).

Usage

functcomp(x, a, CWM.type = c("dom", "all"), bin.num = NULL)

Arguments

x

matrix or data frame containing the functional traits. Traits can be numeric, ordered, or factor. Binary traits should be numeric and only contain 0 and 1. character traits will be converted to factor. For a given trait, species with NA are excluded.

a

matrix containing the abundances of the species in x (or presence-absence, i.e. 0 or 1). Rows are sites and species are columns. The number of species (columns) in a must match the number of species (rows) in x. In addition, the species labels in a and x must be identical and in the same order. NAs will be replaced by 0.

CWM.type

character string indicating how nominal, binary and ordinal traits should be handled. See ‘details’.

bin.num

vector indicating binary traits to be treated as continuous.

Details

functcomp computes the community-level weighted means of trait values for a set of communities (i.e. sites). For a continuous trait, CWM is the mean trait value of all species present in the community (after excluding species with NAs), weighted by their relative abundances.

For ordinal, nominal and binary traits, either the dominant class is returned (when CWM.type is "dom"), or the abundance of each individual class is returned (when CWM.type is "all").

The default behaviour of binary traits being treated as nominal traits can be over-ridden by specifying bin.num, in which case they are treated as numeric traits.

When CWM.type = "dom", if the maximum abundance value is shared between two or more classes, then one of these classes is randomly selected for CWM. Because species with NAs for a given trait are excluded for that trait, it is possible that when CWM.type is set to "all", the sum of the abundances of all classes for a given ordinal/nominal/binary trait does not equal the sum of the species abundances. Thus, it is definitely not recommended to have NAs for very abundant species, as this will lead to biased estimates of functional composition.

Value

a data frame containing the CWM values of each trait for each community.

Note

functcomp is implemented in dbFD and will be returned if calc.CWM is TRUE.

Author(s)

Etienne Laliberté etiennelaliberte@gmail.com https://www.elaliberte.info/

References

Lavorel, S., K. Grigulis, S. McIntyre, N. S. G. Williams, D. Garden, J. Dorrough, S. Berman, F. Quétier, A. Thébault and A. Bonis (2008) Assessing functional diversity in the field - methodology matters! Functional Ecology 22:134-147.

See Also

dbFD for measuring distance-based multidimensional functional diversity indices, including CWM.

Examples

# for ordinal, nominal and binary variables
# returns only the most frequent class
ex1 <- functcomp(dummy$trait, dummy$abun)
ex1

# returns the frequencies of each class
ex2 <- functcomp(dummy$trait, dummy$abun, CWM.type = "all")
ex2

# example with real data from New Zealand short-tussock grasslands
ex3 <- functcomp(tussock$trait, tussock$abun)
ex3

FD documentation built on Nov. 26, 2023, 5:07 p.m.