Function to compute (some) network metrics on the metaweb and local networks

compute_metrics(metanetwork, res = NULL)

Arguments

metanetwork

object of class 'metanetwork'

res

a vector containing the resolutions at which the metrics are computed

Value

a data.frame

Details

This function computes network metrics for the metaweb and local networks at the available resolutions. This function computes the following metrics:

  • weighted connectance: connectance weighted by abundances and link probability (see Ohlmann et al. 2019) Denoting \(p_q\) abundance of node \(q\) and \(\pi_{ql}\) the interaction probability between nodes \(q\) and \(l\), then the weighted connectance \(C\) is: $$C = \sum_{q,l} \pi_{ql}p_q p_l$$

  • mean_TL and max_TL: mean and max trophic level of each network, using values computed from compute_TL() method.

  • mean_shortest_path_length: mean shortest path lenght of each network computed using igraph mean_distance() function.

References

  • Csardi, G., & Nepusz, T. (2006). The igraph software package for complex network research. InterJournal, complex systems, 1695(5), 1-9.

  • 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.

Examples

library(metanetwork)
library(igraph)

#on angola dataset
data("meta_angola")
compute_metrics(meta_angola)
#> $Species
#>         connectance  mean_TL   max_TL mean_shortest_path_length
#> metaweb  0.02925731 1.561919 2.739126                 0.2201667
#> X1986    0.02859672 1.561919 2.739126                 0.2201667
#> X2003    0.02918298 1.561919 2.739126                 0.2201667
#> 
#> $Phylum
#>         connectance  mean_TL   max_TL mean_shortest_path_length
#> metaweb  0.02925731 1.315389 2.229886                0.05117634
#> X1986    0.02859672 1.319967 2.278338                0.04603361
#> X2003    0.02918298 1.317792 2.206484                0.05471144
#> 

#computing metrics only at Phylum level
compute_metrics(meta_angola,res = "Phylum")
#> $Phylum
#>         connectance  mean_TL   max_TL mean_shortest_path_length
#> metaweb  0.02925731 1.315389 2.229886                0.05117634
#> X1986    0.02859672 1.319967 2.278338                0.04603361
#> X2003    0.02918298 1.317792 2.206484                0.05471144
#>