Function to compute network diversity indices based on Hill numbers following the method described in Ohlmann et al. 2019
compute_div(metanetwork, q = 1, res = NULL)
object of class 'metanetwork'
viewpoint parameter controlling the weight given to abundant species/groups and links, default is 1
a vector containing the resolutions at which the diversities are computed
a data.frame
This function compute diversity indices using Hill numbers on node and link abundances. Importantly, a viewpoint parameters \(q\) allows giving more weigth to abundant nodes/links. Given a network, we note \(p_q\) the abundance of node \(q\)
(stored as node attribute ab
) and \(\pi_{ql}\) interaction probability between nodes \(q\) and \(l\) (stored as edge attribute weight
). The link abundance \(L_{ql}\) between nodes
\(q\) and \(l\) is then:
$$L_{ql} = \pi_{ql}p_q p_l$$
Node diversity (for \(q = 1\)) is then computed as:
$$D(p) = \exp (\sum_q - p_q \log p_q)$$
Link diversity is computed as:
$$D(L) = \exp (\sum_{ql} - \frac{L_{ql}}{C} \log L_{ql}{C})$$
where \(C\) is the weighted connectance
$$C = \sum_{ql} \pi_{ql}p_q p_l$$
The overall \(\alpha\)-diversity in node abundances is (for \(q = 1\)): $$A_{P} = \exp(\sum_{q=1}^{Q} \sum_{k} - \frac{P_{qk}}{P_{++}} \log(\frac{P_{qk}}{P_{++}}) - \log(K))$$ The overall \(\alpha\)-diversity in node abundances is (for \(q = 1\)): $$A_{P} = exp(\sum_{q=1}^{Q} \sum_{k=1}^{K} - \frac{P_{qk}}{P_{++}} log ( \frac{P_{qk}}{P_{++}}) - log(K) )$$ where \(P_{++}=\sum_{k} \sum_{q} P_{qk}\) The overall \(\alpha\)-diversities in link abundances and link probabilities are equal to: $$A_{L} = exp (\sum_{q,l=1}^{Q} \sum_{k=1}^{K} - \frac{L_{qlk}}{L_{+++}} \log (\frac{L_{qlk}}{L_{+++}}) - log(K))$$ where \(L_{+++}=\sum_{k} \sum_{q,l} L_{qlk}\). The \(\gamma\)-diversity in node and link abundances are (for \(q = 1\)): $$G_{P}=exp(\sum_{q=1}^{Q} -\frac{P_{q+}}{P_{++}} log (\frac{P_{q+}}{P_{++}}))$$ $$G_{L}=exp(\sum_{q,l=1}^{Q} -\frac{L_{ql+}}{L_{+++}} log(\frac{L_{ql+}}{L_{+++}}))$$ The \(\beta\)-diversity is then defined in a multiplicative way: $$B_{P}=\frac{G_P}{A_P}$$ $$B_{L}=\frac{G_P}{A_L}$$
For more details on \(\alpha\)-,\(\beta\)- and \(\gamma\)-diversity, see Ohlmann et al. 2019.
Ohlmann, M., Miele, V., Dray, S., Chalmandrier, L., O'connor, L., & Thuiller, W. (2019). Diversity indices for ecological networks: a unifying framework using Hill numbers. Ecology letters, 22(4), 737-747.
library(metanetwork)
library(igraph)
#on angola dataset
data("meta_angola")
compute_div(meta_angola,q = 1)
#> $nodes
#> Species Phylum
#> Gamma_P 13.666059 2.680737
#> mean_Alpha_P 12.478328 2.669698
#> Beta_P 1.095183 1.004135
#> Alpha_X1986_P 9.027714 2.494158
#> Alpha_X2003_P 17.247852 2.857593
#>
#> $links
#> Species Phylum
#> Gamma_L 55.718125 3.812301
#> mean_Alpha_L 48.505518 3.791652
#> Beta_L 1.148697 1.005446
#> Alpha_X1986_L 36.481408 3.410505
#> Alpha_X2003_L 64.492722 4.215394
#>
#computing diversities only at Phylum level
compute_div(meta_angola,q = 1,res = "Phylum")
#> $nodes
#> Phylum
#> Gamma_P 2.680737
#> mean_Alpha_P 2.669698
#> Beta_P 1.004135
#> Alpha_X1986_P 2.494158
#> Alpha_X2003_P 2.857593
#>
#> $links
#> Phylum
#> Gamma_L 3.812301
#> mean_Alpha_L 3.791652
#> Beta_L 1.005446
#> Alpha_X1986_L 3.410505
#> Alpha_X2003_L 4.215394
#>