Function to compute pairwise network dissimilarity indices based on Hill numbers following the method described in Ohlmann et al. 2019
compute_dis(metanetwork, q = 1, res = NULL, ncores = 4)
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
number of cores used for the computation, default is 4
a list of data.frame
containing node and link pairwise dissimilarities
This function compute pairwise dissimilarity 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$$
For \(q = 1\), the pairwise node dissimilarity indices are computed from pairwise diversities as: $$\delta_P=\frac{\log(G_P)-log(A_P)}{\log 2}$$ where \(G_P\) is node \(\gamma\)-diversity and \(A_P\) the node \(\alpha\)-diversity
Pairwise link diversity is: $$\delta_L=\frac{\log(G_L)-log(A_L)}{\log 2}$$ where \(G_P\) is the link \(\gamma\)-diversity and \(A_P\) the link \(\alpha\)-diversity
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_dis(meta_angola,q = 1,ncores = 1)
#> computing node pairwise dissimilarities at resolution: Species
#> computing link pairwise dissimilarities at resolution: Species
#> computing node pairwise dissimilarities at resolution: Phylum
#> computing link pairwise dissimilarities at resolution: Phylum
#> $Species
#> $Species$nodes
#> X1986 X2003
#> X1986 0.0000000 0.1311726
#> X2003 0.1311726 0.0000000
#>
#> $Species$links
#> X1986 X2003
#> X1986 0.0000000 0.1999978
#> X2003 0.1999978 0.0000000
#>
#>
#> $Phylum
#> $Phylum$nodes
#> X1986 X2003
#> X1986 0.000000000 0.005952805
#> X2003 0.005952805 0.000000000
#>
#> $Phylum$links
#> X1986 X2003
#> X1986 0.000000000 0.007835491
#> X2003 0.007835491 0.000000000
#>
#>
#computing dissimilarities only at Phylum level
compute_dis(meta_angola,q = 1,res = "Phylum",ncores = 1)
#> computing node pairwise dissimilarities at resolution: Phylum
#> computing link pairwise dissimilarities at resolution: Phylum
#> $Phylum
#> $Phylum$nodes
#> X1986 X2003
#> X1986 0.000000000 0.005952805
#> X2003 0.005952805 0.000000000
#>
#> $Phylum$links
#> X1986 X2003
#> X1986 0.000000000 0.007835491
#> X2003 0.007835491 0.000000000
#>
#>