| Title: | Diversity Through Hill Numbers |
|---|---|
| Description: | Calculate taxonomic, functional and phylogenetic diversity measures through Hill Numbers proposed by Chao, Chiu and Jost (2014) <doi:10.1146/annurev-ecolsys-120213-091540>. |
| Authors: | Daijiang Li [aut, cre] |
| Maintainer: | Daijiang Li <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.7.0 |
| Built: | 2026-11-27 16:10:17 UTC |
| Source: | https://github.com/daijiang/hillR |
Calculate functional diversity for each site (alpha diversity).
hill_func( comm, traits, traits_as_is = FALSE, q = 0, base = exp(1), check_data = TRUE, div_by_sp = FALSE, ord = c("podani", "metric"), fdis = TRUE, stand_dij = FALSE )hill_func( comm, traits, traits_as_is = FALSE, q = 0, base = exp(1), check_data = TRUE, div_by_sp = FALSE, ord = c("podani", "metric"), fdis = TRUE, stand_dij = FALSE )
comm |
A data frame or matrix of community data (e.g. vegetation data). Sites as rows, species
as columns. Values must be non-negative abundances (or 0/1 for presence/absence); missing values
( |
traits |
A data frame of species functional traits data. Species as rows, traits as columns. It can include both continuous and categorical data. It will be transformed into a distance matrix using 'FD::gowdis(traits)'. If all traits are numeric, then it will use Euclidean distance. |
traits_as_is |
if |
q |
Hill number, |
base |
Deprecated and ignored. Hill numbers do not depend on the base of the logarithm;
previous versions returned incorrect values when |
check_data |
whether to check data first? Default is |
div_by_sp |
as FD calculated in this way will be highly correlated with taxonomic diversity,
one potential simple way to correct this is to divide the results by the number of species.
However, a more common way to deal with correlations is to use null models and calculate standardized effect sizes.
Therefore, I set the default to be |
ord |
ord in |
fdis |
whether to calculate FDis, default is |
stand_dij |
whether to standardize distance matrix to have max value of 1? Default is |
A matrix, with these information for each site: Q (Rao's Q); D_q (functional hill number,
the effective number of equally abundant and functionally equally distinct species);
MD_q (mean functional diversity per species, the effective sum of pairwise distances between
a fixed species and all other species); FD_q (total functional diversity, the effective total functional
distance between species of the assemblage). See Chiu and Chao 2014 page 4 for more information.
Sites without any species get NA.
Chao, Anne, Chun-Huo Chiu, and Lou Jost. Unifying Species Diversity, Phylogenetic Diversity, Functional Diversity, and Related Similarity and Differentiation Measures Through Hill Numbers. Annual Review of Ecology, Evolution, and Systematics 45, no. 1 (2014): 297–324. <doi:10.1146/annurev-ecolsys-120213-091540>.
Chiu, Chun-Huo, and Anne Chao. Distance-Based Functional Diversity Measures and Their Decomposition: A Framework Based on Hill Numbers. PLoS ONE 9, no. 7 (July 7, 2014): e100014. <doi:10.1371/journal.pone.0100014>.
dummy = FD::dummy hill_func(comm = dummy$abun, traits = dummy$trait, q = 0) hill_func(comm = dummy$abun, traits = dummy$trait, q = 1) hill_func(comm = dummy$abun, traits = dummy$trait, q = 0.9999) hill_func(comm = dummy$abun, traits = dummy$trait, q = 2) hill_func(comm = dummy$abun, traits = dummy$trait, q = 3)dummy = FD::dummy hill_func(comm = dummy$abun, traits = dummy$trait, q = 0) hill_func(comm = dummy$abun, traits = dummy$trait, q = 1) hill_func(comm = dummy$abun, traits = dummy$trait, q = 0.9999) hill_func(comm = dummy$abun, traits = dummy$trait, q = 2) hill_func(comm = dummy$abun, traits = dummy$trait, q = 3)
Calculate functional gamma, alpha, and beta diversity for all communities, as well as site similarity. These values are based on ALL communities.
hill_func_parti( comm, traits, traits_as_is = FALSE, q = 0, base = exp(1), check_data = TRUE, rel_then_pool = TRUE, ord = c("podani", "metric"), stand_dij = FALSE, show_warning = TRUE )hill_func_parti( comm, traits, traits_as_is = FALSE, q = 0, base = exp(1), check_data = TRUE, rel_then_pool = TRUE, ord = c("podani", "metric"), stand_dij = FALSE, show_warning = TRUE )
comm |
A data frame or matrix of community data (e.g. vegetation data). Sites as rows, species
as columns. Values must be non-negative abundances (or 0/1 for presence/absence); missing values
( |
traits |
A data frame of species functional traits data. Species as rows, traits as columns. It can include both continuous and categorical data. It will be transformed into a distance matrix using 'FD::gowdis(traits)'. If all traits are numeric, then it will use Euclidean distance. |
traits_as_is |
if |
q |
Hill number, |
base |
Deprecated and ignored. Hill numbers do not depend on the base of the logarithm;
previous versions returned incorrect values when |
check_data |
whether to check data first? Default is |
rel_then_pool |
default is |
ord |
ord in |
stand_dij |
whether to standardize distance matrix to have max value of 1? Default is |
show_warning |
whether to print warning, default is |
a data frame with one row (across all sites), including these columns: q, RaoQ of pooled assemblage, gamma diversity, alpha diversity, beta diversity, local species overlap (similar to Sorensen), and region species overlap (similar to Jaccard). See Chiu and Chao 2014 Table 3 for more information.
Chao, Anne, Chun-Huo Chiu, and Lou Jost. Unifying Species Diversity, Phylogenetic Diversity, Functional Diversity, and Related Similarity and Differentiation Measures Through Hill Numbers. Annual Review of Ecology, Evolution, and Systematics 45, no. 1 (2014): 297–324. <doi:10.1146/annurev-ecolsys-120213-091540>.
Chiu, Chun-Huo, and Anne Chao. Distance-Based Functional Diversity Measures and Their Decomposition: A Framework Based on Hill Numbers. PLoS ONE 9, no. 7 (July 7, 2014): e100014. <doi:10.1371/journal.pone.0100014>.
dummy = FD::dummy hill_func_parti(comm = dummy$abun, traits = dummy$trait, q = 0) hill_func_parti(comm = dummy$abun, traits = dummy$trait, q = 1) hill_func_parti(comm = dummy$abun, traits = dummy$trait, q = 0.9999) hill_func_parti(comm = dummy$abun, traits = dummy$trait, q = 2) hill_func_parti(comm = dummy$abun, traits = dummy$trait, q = 3)dummy = FD::dummy hill_func_parti(comm = dummy$abun, traits = dummy$trait, q = 0) hill_func_parti(comm = dummy$abun, traits = dummy$trait, q = 1) hill_func_parti(comm = dummy$abun, traits = dummy$trait, q = 0.9999) hill_func_parti(comm = dummy$abun, traits = dummy$trait, q = 2) hill_func_parti(comm = dummy$abun, traits = dummy$trait, q = 3)
Calculate pairwise functional gamma, alpha, and beta diversity for communities, as
well as site similarity. It is based on hill_func_parti.
If comm has >2 sites, this function will give results for all pairwise comparisons.
hill_func_parti_pairwise( comm, traits, traits_as_is = FALSE, q = 0, rel_then_pool = TRUE, output = c("data.frame", "matrix"), pairs = c("unique", "full"), .progress = TRUE, show_warning = TRUE, ... )hill_func_parti_pairwise( comm, traits, traits_as_is = FALSE, q = 0, rel_then_pool = TRUE, output = c("data.frame", "matrix"), pairs = c("unique", "full"), .progress = TRUE, show_warning = TRUE, ... )
comm |
A data frame or matrix of community data (e.g. vegetation data). Sites as rows, species
as columns. Values must be non-negative abundances (or 0/1 for presence/absence); missing values
( |
traits |
A data frame of species functional traits data. Species as rows, traits as columns. It can include both continuous and categorical data. It will be transformed into a distance matrix using 'FD::gowdis(traits)'. If all traits are numeric, then it will use Euclidean distance. |
traits_as_is |
if |
q |
Hill number, |
rel_then_pool |
default is |
output |
output type: data.frame (default) or matrix. If matrix, then this function will return a list of matrices. |
pairs |
full or unique (default). Do you want to compare all possible pairs (i.e. n^2) or just unique pairs (i.e. |
.progress |
Whether to show progress bar. Default is 'TRUE'. |
show_warning |
whether to print warning, default is |
... |
additional arguments |
A data frame (tibble) with results for all pairwise comparisons, or a list of matrices
if output = "matrix". Distances between species are computed once from all species in
comm and shared by all pairs, so they match hill_func_parti() on all sites.
Sites without any species are removed first.
Chao, Anne, Chun-Huo Chiu, and Lou Jost. Unifying Species Diversity, Phylogenetic Diversity, Functional Diversity, and Related Similarity and Differentiation Measures Through Hill Numbers. Annual Review of Ecology, Evolution, and Systematics 45, no. 1 (2014): 297–324. <doi:10.1146/annurev-ecolsys-120213-091540>.
Chiu, Chun-Huo, and Anne Chao. Distance-Based Functional Diversity Measures and Their Decomposition: A Framework Based on Hill Numbers. PLoS ONE 9, no. 7 (July 7, 2014): e100014. <doi:10.1371/journal.pone.0100014>.
## Not run: dummy = FD::dummy hill_func_parti_pairwise(comm = dummy$abun, traits = dummy$trait, q = 0) hill_func_parti_pairwise(comm = dummy$abun, traits = dummy$trait, q = 0, output = 'matrix') hill_func_parti_pairwise(comm = dummy$abun, traits = dummy$trait, q = 0, output = 'matrix', pairs = 'full') hill_func_parti_pairwise(comm = dummy$abun, traits = dummy$trait, q = 1) hill_func_parti_pairwise(comm = dummy$abun, traits = dummy$trait, q = 0.9999) hill_func_parti_pairwise(comm = dummy$abun, traits = dummy$trait, q = 2) hill_func_parti_pairwise(comm = dummy$abun, traits = dummy$trait, q = 3) ## End(Not run)## Not run: dummy = FD::dummy hill_func_parti_pairwise(comm = dummy$abun, traits = dummy$trait, q = 0) hill_func_parti_pairwise(comm = dummy$abun, traits = dummy$trait, q = 0, output = 'matrix') hill_func_parti_pairwise(comm = dummy$abun, traits = dummy$trait, q = 0, output = 'matrix', pairs = 'full') hill_func_parti_pairwise(comm = dummy$abun, traits = dummy$trait, q = 1) hill_func_parti_pairwise(comm = dummy$abun, traits = dummy$trait, q = 0.9999) hill_func_parti_pairwise(comm = dummy$abun, traits = dummy$trait, q = 2) hill_func_parti_pairwise(comm = dummy$abun, traits = dummy$trait, q = 3) ## End(Not run)
Calculate alpha phylogenetic diversity based on Hill numbers
hill_phylo( comm, tree, q = 0, base = exp(1), rel_then_pool = TRUE, show_warning = TRUE, return_dt = FALSE, trim_to_site = FALSE )hill_phylo( comm, tree, q = 0, base = exp(1), rel_then_pool = TRUE, show_warning = TRUE, return_dt = FALSE, trim_to_site = FALSE )
comm |
A data frame or matrix of community data (e.g. vegetation data). Sites as rows, species
as columns. Values must be non-negative abundances (or 0/1 for presence/absence); missing values
( |
tree |
A phylogeny with class 'phylo'. |
q |
Hill number, |
base |
Deprecated and ignored. Hill numbers do not depend on the base of the logarithm;
previous versions returned incorrect values when |
rel_then_pool |
default is |
show_warning |
whether to print warning, default is |
return_dt |
Whether to return the Phylogenetic Hill numbers Dt, default is 'FALSE'. |
trim_to_site |
Whether to measure each site on the subtree spanned by its own species only. Default is 'FALSE': all sites share the same reference tree (the phylogeny of all species in 'comm'), so branches between the root of that tree and the most recent common ancestor of a site's species are included. This follows Chao et al. (2010) and makes values comparable across sites. If 'TRUE', those branches are excluded for each site, so the result for a site is the same as analyzing that site on its own (i.e., with the phylogeny trimmed to its species); sites with only one species will then get 'NA'. |
Reference tree. hill_phylo() measures all sites on one shared reference tree:
the phylogeny of all species present in comm (species in tree but not in
comm are pruned first). For each site, the branches between the root of that tree and
the most recent common ancestor of the site's own species are included, so values are
comparable across sites (Chao et al. 2010). This also means that the value for a site depends
on which other sites are in comm, because together they determine the root of the
reference tree. Analyzing a site on its own gives a different value, because the tree is then
pruned to that site's species. Use trim_to_site = TRUE to measure each site on the
subtree of its own species instead, which gives the same value as analyzing the site on its own.
In contrast, hill_phylo_parti and hill_phylo_parti_pairwise measure
each comparison on the phylogeny of the species in the sites being compared (all sites, or the
two sites of a pair), without the branches above the most recent common ancestor of those species.
A vector of hill number based phylogenetic diversity ('PD(T)', effective total branch length) for all sites. Sites without any species get 'NA'. If 'trim_to_site = TRUE', sites with only one species also get 'NA'.
Chiu & Chao & Daijiang Li
Chao, Anne, Chun-Huo Chiu, and Lou Jost. Unifying Species Diversity, Phylogenetic Diversity, Functional Diversity, and Related Similarity and Differentiation Measures Through Hill Numbers. Annual Review of Ecology, Evolution, and Systematics 45, no. 1 (2014): 297–324. <doi:10.1146/annurev-ecolsys-120213-091540>.
Chao, Anne, Chun-Huo Chiu, and Lou Jost. Phylogenetic Diversity Measures Based on Hill Numbers. Philosophical Transactions of the Royal Society B 365, no. 1558 (2010): 3599-3609. <doi:10.1098/rstb.2010.0272>.
comm = dummy = FD::dummy$abun tree = ape::rtree(n = ncol(comm), tip.label = paste0('sp', 1:8)) hill_phylo(comm, tree, q = 0) hill_phylo(comm, tree, q = 0.999) hill_phylo(comm, tree, q = 1) hill_phylo(comm, tree, q = 2) # each site measured on the subtree of its own species hill_phylo(comm, tree, q = 1, trim_to_site = TRUE)comm = dummy = FD::dummy$abun tree = ape::rtree(n = ncol(comm), tip.label = paste0('sp', 1:8)) hill_phylo(comm, tree, q = 0) hill_phylo(comm, tree, q = 0.999) hill_phylo(comm, tree, q = 1) hill_phylo(comm, tree, q = 2) # each site measured on the subtree of its own species hill_phylo(comm, tree, q = 1, trim_to_site = TRUE)
Calculate overall phylogenetic diversity and site similarity across multiple sites.
hill_phylo_parti( comm, tree, q = 0, base = exp(1), rel_then_pool = TRUE, show_warning = TRUE, check_data = TRUE )hill_phylo_parti( comm, tree, q = 0, base = exp(1), rel_then_pool = TRUE, show_warning = TRUE, check_data = TRUE )
comm |
A data frame or matrix of community data (e.g. vegetation data). Sites as rows, species
as columns. Values must be non-negative abundances (or 0/1 for presence/absence); missing values
( |
tree |
A phylogeny with class 'phylo'. |
q |
Hill number, |
base |
Deprecated and ignored. Hill numbers do not depend on the base of the logarithm;
previous versions returned incorrect values when |
rel_then_pool |
default is |
show_warning |
whether to print warning, default is |
check_data |
Whether to check and clean the community data and phylogeny. Default is 'TRUE'. If 'FALSE', 'comm' must have no empty sites or species, and one column per tip of 'tree'. |
Reference tree. With check_data = TRUE, the phylogeny is pruned to the species
present in comm, so gamma, alpha and beta diversity are measured on the tree spanning those
species; branches above their most recent common ancestor are not included. This differs from
hill_phylo, which measures each site on one shared reference tree that includes the
branches from its root down to each site's species (unless trim_to_site = TRUE). With
check_data = FALSE, tree is used as given.
A data frame with one row (across all sites) and six columns: q, gamma diversity, alpha diversity, beta diversity, local similarity (similar to Sorensen), and region similarity (similar to Jaccard).
Chiu & Chao, Daijiang Li
Chao, Anne, Chun-Huo Chiu, and Lou Jost. Unifying Species Diversity, Phylogenetic Diversity, Functional Diversity, and Related Similarity and Differentiation Measures Through Hill Numbers. Annual Review of Ecology, Evolution, and Systematics 45, no. 1 (2014): 297–324. <doi:10.1146/annurev-ecolsys-120213-091540>.
comm = dummy = FD::dummy$abun tree = ape::rtree(n = ncol(comm), tip.label = paste0('sp', 1:8)) hill_phylo_parti(comm, tree, q = 0) hill_phylo_parti(comm, tree, q = 0.999) hill_phylo_parti(comm, tree, q = 1) hill_phylo_parti(comm, tree, q = 2)comm = dummy = FD::dummy$abun tree = ape::rtree(n = ncol(comm), tip.label = paste0('sp', 1:8)) hill_phylo_parti(comm, tree, q = 0) hill_phylo_parti(comm, tree, q = 0.999) hill_phylo_parti(comm, tree, q = 1) hill_phylo_parti(comm, tree, q = 2)
Calculate pairwise phylogenetic diversity.
hill_phylo_parti_pairwise( comm, tree, q = 0, output = c("data.frame", "matrix"), pairs = c("unique", "full"), rel_then_pool = TRUE, .progress = TRUE, show_warning = TRUE, ... )hill_phylo_parti_pairwise( comm, tree, q = 0, output = c("data.frame", "matrix"), pairs = c("unique", "full"), rel_then_pool = TRUE, .progress = TRUE, show_warning = TRUE, ... )
comm |
A data frame or matrix of community data (e.g. vegetation data). Sites as rows, species
as columns. Values must be non-negative abundances (or 0/1 for presence/absence); missing values
( |
tree |
A phylogeny with class 'phylo'. |
q |
Hill number, |
output |
output type: data.frame (default) or matrix. If matrix, then this function will return a list of matrices. |
pairs |
full or unique (default). Do you want to compare all possible pairs (i.e. n^2) or just unique pairs (i.e. |
rel_then_pool |
default is |
.progress |
Whether to show progress bar. Default is 'TRUE'. |
show_warning |
whether to print warning, default is |
... |
Not used, except for the deprecated |
Reference tree. Each pair of sites is measured on the phylogeny of the species in that
pair, as hill_phylo_parti does for those two sites: branches above the most recent
common ancestor of the pair's species are not included, so different pairs can be measured on
different subtrees. This differs from hill_phylo, which measures every site on one
shared reference tree.
A data frame (tibble) with results for all pairwise comparisons, or a list of matrices
if output = "matrix". Each pair is measured on the phylogeny of the species in that pair,
as in hill_phylo_parti(). Sites without any species are removed first.
Chao, Anne, Chun-Huo Chiu, and Lou Jost. Unifying Species Diversity, Phylogenetic Diversity, Functional Diversity, and Related Similarity and Differentiation Measures Through Hill Numbers. Annual Review of Ecology, Evolution, and Systematics 45, no. 1 (2014): 297–324. <doi:10.1146/annurev-ecolsys-120213-091540>.
## Not run: comm = dummy = FD::dummy$abun tree = ape::rtree(n = ncol(comm), tip.label = paste0('sp', 1:8)) hill_phylo_parti_pairwise(comm, tree, q = 0, show_warning = FALSE) hill_phylo_parti_pairwise(comm, tree, q = 0.999, show_warning = FALSE) hill_phylo_parti_pairwise(comm, tree, q = 1, show_warning = FALSE) hill_phylo_parti_pairwise(comm, tree, q = 2, show_warning = FALSE) ## End(Not run)## Not run: comm = dummy = FD::dummy$abun tree = ape::rtree(n = ncol(comm), tip.label = paste0('sp', 1:8)) hill_phylo_parti_pairwise(comm, tree, q = 0, show_warning = FALSE) hill_phylo_parti_pairwise(comm, tree, q = 0.999, show_warning = FALSE) hill_phylo_parti_pairwise(comm, tree, q = 1, show_warning = FALSE) hill_phylo_parti_pairwise(comm, tree, q = 2, show_warning = FALSE) ## End(Not run)
Calculate taxonomic diversity for each site (alpha diversity).
hill_taxa(comm, q = 0, MARGIN = 1, base = exp(1))hill_taxa(comm, q = 0, MARGIN = 1, base = exp(1))
comm |
A data frame or matrix of community data (e.g. vegetation data). Sites as rows, species
as columns. Values must be non-negative abundances (or 0/1 for presence/absence); missing values
( |
q |
Hill number, |
MARGIN |
default is 1, if sites are columns, set |
base |
Deprecated and ignored. Hill numbers do not depend on the base of the logarithm;
previous versions returned incorrect values when |
A named vector, diversity values for each site in the comm.
Sites without any species get NA when q > 0 (and 0 when q = 0).
Chao, Anne, Chun-Huo Chiu, and Lou Jost. Unifying Species Diversity, Phylogenetic Diversity, Functional Diversity, and Related Similarity and Differentiation Measures Through Hill Numbers. Annual Review of Ecology, Evolution, and Systematics 45, no. 1 (2014): 297–324. <doi:10.1146/annurev-ecolsys-120213-091540>.
Jost, Lou. Entropy and diversity. Oikos 113, no. 2 (2006): 363-375. <doi:10.1111/j.2006.0030-1299.14714.x>.
dummy = FD::dummy hill_taxa(comm = dummy$abun, q = 0) # same as: vegan::specnumber(dummy$abun) hill_taxa(comm = dummy$abun, q = 0.999) hill_taxa(comm = dummy$abun, q = 1) # same as: exp(vegan::diversity(x = dummy$abun, index = 'shannon')) hill_taxa(comm = dummy$abun, q = 2) # same as: vegan::diversity(x = dummy$abun, index = 'invsimpson')dummy = FD::dummy hill_taxa(comm = dummy$abun, q = 0) # same as: vegan::specnumber(dummy$abun) hill_taxa(comm = dummy$abun, q = 0.999) hill_taxa(comm = dummy$abun, q = 1) # same as: exp(vegan::diversity(x = dummy$abun, index = 'shannon')) hill_taxa(comm = dummy$abun, q = 2) # same as: vegan::diversity(x = dummy$abun, index = 'invsimpson')
Calculate taxonomic gamma, alpha, and beta diversity across all communities, as well as site similarity. If comm has 2 sites, this function gives pair comparison. If comm has >2 sites, gamma diversity is the diversity of the pooled assemblage, alpha is the average diversity across all site, beta is across all communities.
hill_taxa_parti( comm, q = 0, base = exp(1), rel_then_pool = TRUE, show_warning = TRUE, check_data = TRUE )hill_taxa_parti( comm, q = 0, base = exp(1), rel_then_pool = TRUE, show_warning = TRUE, check_data = TRUE )
comm |
A data frame or matrix of community data (e.g. vegetation data). Sites as rows, species
as columns. Values must be non-negative abundances (or 0/1 for presence/absence); missing values
( |
q |
Hill number, |
base |
Deprecated and ignored. Hill numbers do not depend on the base of the logarithm;
previous versions returned incorrect values when |
rel_then_pool |
default is |
show_warning |
whether to print warning, default is |
check_data |
whether to check data first? Default is |
A data frame with one row (across all sites), including these columns: q, gamma diversity, alpha diversity, beta diversity, MacArthur's homogeneity measure, local similarity (species overlap, similar to Sorensen), and region similarity (species overlap, similar to Jaccard). See Chao, Chiu and Jost 2014 Table 2 for more information.
Chao, Anne, Chun-Huo Chiu, and Lou Jost. Unifying Species Diversity, Phylogenetic Diversity, Functional Diversity, and Related Similarity and Differentiation Measures Through Hill Numbers. Annual Review of Ecology, Evolution, and Systematics 45, no. 1 (2014): 297–324. <doi:10.1146/annurev-ecolsys-120213-091540>.
Jost, Lou. Entropy and diversity. Oikos 113, no. 2 (2006): 363-375. <doi:10.1111/j.2006.0030-1299.14714.x>.
dummy = FD::dummy hill_taxa_parti(comm = dummy$abun, q = 0) hill_taxa_parti(comm = dummy$abun, q = 1) hill_taxa_parti(comm = dummy$abun, q = 0.9999999) hill_taxa_parti(comm = dummy$abun, q = 0.9999999, rel_then_pool = FALSE) hill_taxa_parti(comm = dummy$abun, q = 1, rel_then_pool = FALSE) hill_taxa_parti(comm = dummy$abun, q = 2) hill_taxa_parti(comm = dummy$abun, q = 3)dummy = FD::dummy hill_taxa_parti(comm = dummy$abun, q = 0) hill_taxa_parti(comm = dummy$abun, q = 1) hill_taxa_parti(comm = dummy$abun, q = 0.9999999) hill_taxa_parti(comm = dummy$abun, q = 0.9999999, rel_then_pool = FALSE) hill_taxa_parti(comm = dummy$abun, q = 1, rel_then_pool = FALSE) hill_taxa_parti(comm = dummy$abun, q = 2) hill_taxa_parti(comm = dummy$abun, q = 3)
Calculate pairwise taxonomic gamma, alpha, and beta diversity for communities, as
well as site similarity. It is based on hill_taxa_parti.
If comm has >2 sites, this function will give results for all pairwise comparisons.
hill_taxa_parti_pairwise( comm, q = 0, rel_then_pool = TRUE, output = c("data.frame", "matrix"), pairs = c("unique", "full"), .progress = TRUE, show_warning = TRUE, ... )hill_taxa_parti_pairwise( comm, q = 0, rel_then_pool = TRUE, output = c("data.frame", "matrix"), pairs = c("unique", "full"), .progress = TRUE, show_warning = TRUE, ... )
comm |
A data frame or matrix of community data (e.g. vegetation data). Sites as rows, species
as columns. Values must be non-negative abundances (or 0/1 for presence/absence); missing values
( |
q |
Hill number, |
rel_then_pool |
default is |
output |
output type: data.frame (default) or matrix. If matrix, then this function will return a list of matrices. |
pairs |
full or unique (default). Do you want to compare all possible pairs (i.e. n^2) or just unique pairs (i.e. |
.progress |
Whether to show progress bar. Default is 'TRUE'. |
show_warning |
whether to print warning, default is |
... |
Not used, except for the deprecated |
A data frame (tibble) with results for all pairwise comparisons, or a list of matrices
if output = "matrix". Sites without any species are removed first. With pairs = "full",
the diagonal compares each site with itself (beta diversity and similarities of 1).
Chao, Anne, Chun-Huo Chiu, and Lou Jost. Unifying Species Diversity, Phylogenetic Diversity, Functional Diversity, and Related Similarity and Differentiation Measures Through Hill Numbers. Annual Review of Ecology, Evolution, and Systematics 45, no. 1 (2014): 297–324. <doi:10.1146/annurev-ecolsys-120213-091540>.
Jost, Lou. Entropy and diversity. Oikos 113, no. 2 (2006): 363-375. <doi:10.1111/j.2006.0030-1299.14714.x>.
## Not run: dummy = FD::dummy hill_taxa_parti_pairwise(comm = dummy$abun, q = 0) hill_taxa_parti_pairwise(comm = dummy$abun, q = 0, output = 'matrix') hill_taxa_parti_pairwise(comm = dummy$abun, q = 1) hill_taxa_parti_pairwise(comm = dummy$abun, q = 0.9999999) hill_taxa_parti_pairwise(comm = dummy$abun, q = 0.9999999, rel_then_pool = FALSE) hill_taxa_parti_pairwise(comm = dummy$abun, q = 1, rel_then_pool = FALSE) hill_taxa_parti_pairwise(comm = dummy$abun, q = 2) hill_taxa_parti_pairwise(comm = dummy$abun, q = 3) ## End(Not run)## Not run: dummy = FD::dummy hill_taxa_parti_pairwise(comm = dummy$abun, q = 0) hill_taxa_parti_pairwise(comm = dummy$abun, q = 0, output = 'matrix') hill_taxa_parti_pairwise(comm = dummy$abun, q = 1) hill_taxa_parti_pairwise(comm = dummy$abun, q = 0.9999999) hill_taxa_parti_pairwise(comm = dummy$abun, q = 0.9999999, rel_then_pool = FALSE) hill_taxa_parti_pairwise(comm = dummy$abun, q = 1, rel_then_pool = FALSE) hill_taxa_parti_pairwise(comm = dummy$abun, q = 2) hill_taxa_parti_pairwise(comm = dummy$abun, q = 3) ## End(Not run)
The R package 'hillR' implements the framework proposed by Chao, et al. 2014 and makes it easy to calculate taxonomic, functional, and phylogenetic diversity of ecological communities as Hill numbers. For each facet of diversity, 'hillR' has three functions. The first set of functions (hill_taxa, hill_func, and hill_phylo) calculates alpha diversity of each site. The second set of functions (hill_taxa_parti, hill_func_parti, and hill_phylo_parti) calculates diversity across all sites. The third set of functions (hill_taxa_parti_pairwise, hill_func_parti_pairwise, and hill_phylo_parti_pairwise) calculates all possible pairwise diversity across all sites. Users can set the argument _q_ to control the weight of species abundance.
Users may be interested in other similar packages such as vegetarian and iNEXT.
hill_taxa, hill_taxa_parti, hill_taxa_parti_pairwise
hill_func, hill_func_parti, hill_func_parti_pairwise
hill_phylo, hill_phylo_parti, hill_phylo_parti_pairwise
Chao, Anne, Chun-Huo Chiu, and Lou Jost. Unifying Species Diversity, Phylogenetic Diversity, Functional Diversity, and Related Similarity and Differentiation Measures Through Hill Numbers. Annual Review of Ecology, Evolution, and Systematics 45, no. 1 (2014): 297–324. <doi:10.1146/annurev-ecolsys-120213-091540>.