Compute functional beta-diversity indices based on Hill numbers applied to distance between species following the framework from Chao et al. (2019).

beta.fd.hill(
asb_sp_w,
sp_dist,
q = c(0, 1, 2),
tau = "mean",
beta_type = "Jaccard",
check_input = TRUE,
details_returned = TRUE
)

Arguments

asb_sp_w

a matrix with weight of species (columns) in a set of assemblages (rows). Rows and columns should have names. NA are not allowed.

sp_dist

a matrix or dist object with distance between species. Species names should be provided and match those in 'asb_sp_w'. NA are not allowed.

q

a vector containing values referring to the order of diversity to use

tau

a character string with name of function to apply to distance matrix (i.e. among all pairs of species) to get the threshold used to define 'functionally indistinct set of species'. Could be qet to 'mean' (default), 'min' or 'max'.

beta_type

a character string with name of framework used for computing beta-diversity, either 'Jaccard' (default) or 'Sorensen'.

check_input

a logical value indicating whether key features the inputs are checked (e.g. class and/or mode of objects, names of rows and/or columns, missing values). If an error is detected, a detailed message is returned. Default: check_input = TRUE.

details_returned

a logical value indicating whether the user want to store values used for computing indices (see list below)

Value

A list with:

• asb_FDbeta a list with for each value of q a dist object with beta functional diversity indices for all pairs of assemblages item if store.details turned to TRUE a list details with

• malpha_fd_q a list with for each value of q a dist object with mean alpha functional diversity indices for all pairs of assemblages

• gamma_fd_q a list with for each value of q a dist object with gamma functional diversity indices for all pairs of assemblages

Note

When q=1 Jaccard-like and Sorensen-like beta-diversity are identical. FD computed with tau='min' is equivalent to Hill number taxonomic beta diversity. If tau='min' and there are species with null distance, tau is set to the minimum non-null value and a warning message is displayed. Indices values are stored as dist objects to optimize memory. See below example of how merging distance values in a dataframe with dist.to.df

References

Chao et al. (2019) An attribute diversity approach to functional diversity, functional beta diversity, and related (dis)similarity measures. Ecological Monographs, 89, e01343.

Author

Sebastien Villeger and Camille Magneville

Examples

# Load Species*Traits dataframe:
data('fruits_traits', package = 'mFD')

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)
#> [1] "Running w.type=equal on groups=c(Size)"
#> [1] "Running w.type=equal on groups=c(Plant)"
#> [1] "Running w.type=equal on groups=c(Climate)"
#> [1] "Running w.type=equal on groups=c(Seed)"
#> [1] "Running w.type=equal on groups=c(Sugar)"
#> [1] "Running w.type=equal on groups=c(Use,Use,Use)"

# Compute beta functional hill indices:
sp_dist          = sp_dist_fruits,
q                = c(0,1,2),
tau              = 'mean',
beta_type        = 'Jaccard',
check_input      = TRUE,
details_returned = TRUE)

# Then use the mFD::dist.to.df function to ease visualizing result:
## for q = 0:
mFD::dist.to.df(list_dist = list(FDq2 = baskets_beta$beta_fd_q$q0))
#>          x1        x2       FDq2
## for q = 1:
mFD::dist.to.df(list_dist = list(FDq2 = baskets_beta$beta_fd_q$q1))
#>          x1        x2         FDq2
## for q = 2:
mFD::dist.to.df(list_dist = list(FDq2 = baskets_beta$beta_fd_q$q2))
#>          x1        x2        FDq2