Main functions
FD::dbFD()
is probably the most known function to compute functional diversity indices. It comes from the FD
package proposed by Laliberté, Legendre, and Shipley (2014). It can compute many indices: functional richness, Rao’s quadratic entropy, community-weighted mean, functional divergence, functional dispersion, and functional group richness. This swiss-army knife of functional diversity indices has many options and compute several indices in a single run.
hillR::hill_func()
comes from the hillR
package that computes Hill numbers for taxonomic, functional, and functional diversity (Li 2018). It implements indices proposed by Chao, Chiu, and Jost (2014). It computes Rao’s quadratic entropy, the mean functional diversity per species, as well as the total functional diversity.
adiv::QE()
comes from the adiv
package which proposes a toolkit to analyze biodiversity (Pavoine 2020). This function computes Rao’s quadratic entropy.
SYNCSA::rao.diversity()
comes from SYNCSA
package which proposes a simulation framework for meta-communities (Debastiani and Pillar 2012). The function computes Rao’s quadratic entropy as well as functional redundancy.
Benchmark between packages
We will now benchmark the functions included in fundiversity
with the corresponding function in other packages using the microbenchmark::microbenchmark()
function.
tictoc::tic()
library(fundiversity)
data("traits_birds", package = "fundiversity")
data("site_sp_birds", package = "fundiversity")
dist_traits_birds <- dist(traits_birds)
With the fairly small (~220 species, 8 sites, 4 traits) provided dataset in fundiversity
:
pkg_bench <- microbenchmark::microbenchmark(
fundiversity = {
fundiversity::fd_raoq(traits = NULL, site_sp_birds, dist_traits_birds)
},
adiv = {
adiv::QE(site_sp_birds, dis = dist_traits_birds)
},
hillR = {
hillR::hill_func(site_sp_birds, dist_traits_birds, traits_as_is = TRUE)[1, ]
},
SYNCSA = {
SYNCSA::rao.diversity(site_sp_birds,
phylodist = as.matrix(dist_traits_birds),
standardize = FALSE)$PhyRao
},
FD = {
suppressMessages(
FD::dbFD(x = dist_traits_birds, a = site_sp_birds, stand.x = FALSE,
calc.FRic = TRUE, calc.CWM = FALSE, calc.FDiv = FALSE,
calc.FGR = FALSE, m = "max", stand.FRic = FALSE,
messages = FALSE))
},
times = 30
)
ggplot2::autoplot(pkg_bench)
pkg_bench
#> Unit: milliseconds
#> expr min lq mean median uq max neval cld
#> fundiversity 2.10149 2.407032 2.772199 2.58316 3.180594 4.188936 30 a
#> adiv 14.14454 14.526534 18.580014 15.58279 19.739028 41.526147 30 a
#> hillR 20.08181 20.486426 24.078429 21.26945 27.074169 37.166011 30 a
#> SYNCSA 97.95745 104.834362 127.459092 112.78063 152.813453 173.017482 30 b
#> FD 3461.85925 3546.031242 3660.392313 3611.61166 3799.379164 3983.139659 30 c