Calculate contribution metrics of sites and species
Source:R/site_species_metrics.R
site_species_metrics.Rd
This function calculates metrics to assess the contribution of a given species or site to its bioregion.
Usage
site_species_metrics(
cluster_object,
comat,
indices = c("rho"),
net = NULL,
site_col = 1,
species_col = 2
)
Arguments
- cluster_object
A
bioregion.clusters
object.- comat
A co-occurrence
matrix
with sites as rows and species as columns.- indices
A
character
specifying the contribution metric to compute. Available options arerho
,affinity
,fidelity
,indicator_value
andCz
.- net
NULL
by default. Required forCz
indices. Adata.frame
where each row represents an interaction between two nodes and an optional third column indicating the interaction's weight.- site_col
A number indicating the position of the column containing the sites in
net
. 1 by default.- species_col
A number indicating the position of the column containing the species in
net
. 2 by default.
Value
A data.frame
with columns Bioregion
, Species
, and the desired summary
statistics, or a list of data.frame
s if Cz
and other indices are
selected.
Details
The \(\rho\) metric is derived from Lenormand et al. (2019) with the following formula:
\(\rho_{ij} = \frac{n_{ij} - \frac{n_i n_j}{n}}{\sqrt{\left(\frac{n - n_j}{ n-1}\right) \left(1-\frac{n_j}{n}\right) \frac{n_i n_j}{n}}}\)
where \(n\) is the number of sites, \(n_i\) is the number of sites in which species \(i\) is present, \(n_j\) is the number of sites in bioregion \(j\), and \(n_{ij}\) is the number of occurrences of species \(i\) in sites of bioregion \(j\).
Affinity \(A\), fidelity \(F\), and individual contributions \(IndVal\) describe how species are linked to their bioregions. These metrics are described in Bernardo-Madrid et al. (2019):
Affinity of species to their region: \(A_i = \frac{R_i}{Z}\), where \(R_i\) is the occurrence/range size of species \(i\) in its associated bioregion, and \(Z\) is the total size (number of sites) of the bioregion. High affinity indicates that the species occupies most sites in its bioregion.
Fidelity of species to their region: \(F_i = \frac{R_i}{D_i}\), where \(R_i\) is the occurrence/range size of species \(i\) in its bioregion, and \(D_i\) is its total range size. High fidelity indicates that the species is not present in other regions.
Indicator Value of species: \(IndVal = F_i \cdot A_i\).
Cz
metrics are derived from Guimerà & Amaral (2005):
Participation coefficient: \(C_i = 1 - \sum_{s=1}^{N_M}{\left(\frac{k_{is}}{k_i}\right)^2}\), where \(k_{is}\) is the number of links of node \(i\) to nodes in bioregion \(s\), and \(k_i\) is the total degree of node \(i\). A high value means links are uniformly distributed; a low value means links are within the node's bioregion.
Within-bioregion degree z-score: \(z_i = \frac{k_i - \overline{k_{si}}}{\sigma_{k_{si}}}\), where \(k_i\) is the number of links of node \(i\) to nodes in its bioregion \(s_i\), \(\overline{k_{si}}\) is the average degree of nodes in \(s_i\), and \(\sigma_{k_{si}}\) is the standard deviation of degrees in \(s_i\).
References
Bernardo-Madrid R, Calatayud J, González‐Suárez M, Rosvall M, Lucas P, Antonelli A & Revilla E (2019) Human activity is altering the world’s zoogeographical regions. Ecology Letters 22, 1297–1305.
Guimerà R & Amaral LAN (2005) Functional cartography of complex metabolic networks. Nature 433, 895–900.
Lenormand M, Papuga G, Argagnon O, Soubeyrand M, Alleaume S & Luque S (2019) Biogeographical network analysis of plant species distribution in the Mediterranean region. Ecology and Evolution 9, 237–250.
See also
For more details illustrated with a practical example, see the vignette: https://biorgeo.github.io/bioregion/articles/a5_3_summary_metrics.html.
Associated functions: bioregion_metrics bioregionalization_metrics
Author
Pierre Denelle (pierre.denelle@gmail.com)
Boris Leroy (leroy.boris@gmail.com)
Maxime Lenormand (maxime.lenormand@inrae.fr)
Examples
comat <- matrix(sample(0:1000, size = 500, replace = TRUE, prob = 1/1:1001),
20, 25)
rownames(comat) <- paste0("Site",1:20)
colnames(comat) <- paste0("Species",1:25)
dissim <- dissimilarity(comat, metric = "Simpson")
clust1 <- nhclu_kmeans(dissim, n_clust = 3, index = "Simpson")
net <- similarity(comat, metric = "Simpson")
com <- netclu_greedy(net)
site_species_metrics(cluster_object = clust1, comat = comat,
indices = "rho")
#> Bioregion Species rho
#> 1 2 Species1 273.693082
#> 2 2 Species2 899.748523
#> 3 2 Species3 371.859306
#> 4 2 Species4 1365.500801
#> 5 2 Species5 -1.174174
#> 6 2 Species6 64.473189
#> 7 2 Species7 694.190225
#> 8 2 Species8 730.567543
#> 9 2 Species9 644.616165
#> 10 2 Species10 76.457053
#> 11 2 Species11 29.997506
#> 12 2 Species12 169.396488
#> 13 2 Species13 569.593065
#> 14 2 Species14 390.926899
#> 15 2 Species15 173.526353
#> 16 2 Species16 533.042279
#> 17 2 Species17 646.098176
#> 18 2 Species18 203.500027
#> 19 2 Species19 523.176834
#> 20 2 Species20 578.721112
#> 21 2 Species21 161.542489
#> 22 2 Species22 24.323280
#> 23 2 Species23 283.777904
#> 24 2 Species24 204.637832
#> 25 2 Species25 492.896334
#> 26 1 Species1 710.416933
#> 27 1 Species2 257.659360
#> 28 1 Species3 452.195405
#> 29 1 Species4 143.333278
#> 30 1 Species5 100.641349
#> 31 1 Species6 189.047062
#> 32 1 Species7 -1.412029
#> 33 1 Species8 1.079787
#> 34 1 Species9 147.029853
#> 35 1 Species10 1.775848
#> 36 1 Species11 319.693360
#> 37 1 Species12 94.191000
#> 38 1 Species13 612.828903
#> 39 1 Species14 135.214530
#> 40 1 Species15 109.941118
#> 41 1 Species16 50.208058
#> 42 1 Species17 -1.412029
#> 43 1 Species18 384.762174
#> 44 1 Species19 859.079585
#> 45 1 Species20 313.562574
#> 46 1 Species21 -1.452966
#> 47 1 Species22 879.220605
#> 48 1 Species23 157.566125
#> 49 1 Species24 279.332649
#> 50 1 Species25 60.701704
#> 51 3 Species1 803.244206
#> 52 3 Species2 705.280336
#> 53 3 Species3 893.612133
#> 54 3 Species4 594.908251
#> 55 3 Species5 1727.032086
#> 56 3 Species6 1701.066175
#> 57 3 Species7 2763.288247
#> 58 3 Species8 1765.336668
#> 59 3 Species9 1096.622882
#> 60 3 Species10 812.051118
#> 61 3 Species11 1815.420605
#> 62 3 Species12 1031.908767
#> 63 3 Species13 1233.944002
#> 64 3 Species14 1324.008505
#> 65 3 Species15 1200.578132
#> 66 3 Species16 1378.529437
#> 67 3 Species17 1483.041497
#> 68 3 Species18 1676.220533
#> 69 3 Species19 717.548848
#> 70 3 Species20 1288.645801
#> 71 3 Species21 1424.500190
#> 72 3 Species22 527.648980
#> 73 3 Species23 556.987582
#> 74 3 Species24 1592.144766
#> 75 3 Species25 947.738988
# Contribution metrics
site_species_metrics(cluster_object = com, comat = comat,
indices = c("rho", "affinity", "fidelity", "indicator_value"))
#> Bioregion Species rho affinity fidelity indval
#> 1 1 Species1 1.139845e+04 124.52632 139.17647059 1.733113e+04
#> 2 1 Species2 1.087012e+04 122.26316 129.05555556 1.577874e+04
#> 3 1 Species3 9.215487e+03 103.78947 109.55555556 1.137071e+04
#> 4 1 Species4 1.027192e+04 101.84211 138.21428571 1.407603e+04
#> 5 1 Species5 1.156202e+04 106.00000 167.83333333 1.779033e+04
#> 6 1 Species6 1.235504e+04 138.84211 146.55555556 2.034808e+04
#> 7 1 Species7 2.038682e+04 222.05263 248.17647059 5.510824e+04
#> 8 1 Species8 1.692341e+04 184.47368 206.17647059 3.803413e+04
#> 9 1 Species9 1.286634e+04 152.42105 144.80000000 2.207057e+04
#> 10 1 Species10 5.727094e+03 64.84211 68.44444444 4.438082e+03
#> 11 1 Species11 1.364900e+04 144.47368 171.56250000 2.478627e+04
#> 12 1 Species12 8.434448e+03 100.26316 95.25000000 9.550066e+03
#> 13 1 Species13 1.590943e+04 178.52632 188.44444444 3.364229e+04
#> 14 1 Species14 1.228269e+04 141.84211 141.84210526 2.011918e+04
#> 15 1 Species15 8.979785e+03 101.15789 106.77777778 1.080142e+04
#> 16 1 Species16 1.323185e+04 148.63158 156.88888889 2.331864e+04
#> 17 1 Species17 1.433313e+04 156.36842 174.76470588 2.732768e+04
#> 18 1 Species18 1.450900e+04 153.52632 182.31250000 2.798977e+04
#> 19 1 Species19 1.369900e+04 145.00000 172.18750000 2.496719e+04
#> 20 1 Species20 1.458143e+04 168.21053 168.21052632 2.829478e+04
#> 21 1 Species21 1.021958e+04 115.00000 121.38888889 1.395972e+04
#> 22 1 Species22 8.620244e+03 85.57895 116.14285714 9.939383e+03
#> 23 1 Species23 5.925083e+03 67.05263 70.77777778 4.745836e+03
#> 24 1 Species24 1.194173e+04 130.42105 145.76470588 1.901079e+04
#> 25 1 Species25 1.021958e+04 115.00000 121.38888889 1.395972e+04
#> 26 2 Species1 2.392584e+00 3.00000 0.17647059 5.294118e-01
#> 27 2 Species2 5.040760e+02 467.00000 25.94444444 1.211606e+04
#> 28 2 Species3 4.662244e+02 432.00000 24.00000000 1.036800e+04
#> 29 2 Species4 1.167785e+03 953.00000 68.07142857 6.487207e+04
#> 30 2 Species5 -7.947194e-01 0.00000 0.00000000 0.000000e+00
#> 31 2 Species6 1.633029e+01 16.00000 0.88888889 1.422222e+01
#> 32 2 Species7 6.044335e+02 544.00000 32.00000000 1.740800e+04
#> 33 2 Species8 1.240805e+01 12.00000 0.70588235 8.470588e+00
#> 34 2 Species9 8.207827e+00 9.00000 0.45000000 4.050000e+00
#> 35 2 Species10 1.092291e+01 11.00000 0.61111111 6.722222e+00
#> 36 2 Species11 -9.176629e-01 0.00000 0.00000000 0.000000e+00
#> 37 2 Species12 2.051957e+00 3.00000 0.15000000 4.500000e-01
#> 38 2 Species13 -9.733285e-01 0.00000 0.00000000 0.000000e+00
#> 39 2 Species14 5.263158e-02 1.00000 0.05263158 5.263158e-02
#> 40 2 Species15 1.515148e+02 141.00000 7.83333333 1.104500e+03
#> 41 2 Species16 4.434052e+00 5.00000 0.27777778 1.388889e+00
#> 42 2 Species17 3.911597e+01 36.00000 2.11764706 7.623529e+01
#> 43 2 Species18 -9.176629e-01 0.00000 0.00000000 0.000000e+00
#> 44 2 Species19 -9.176629e-01 0.00000 0.00000000 0.000000e+00
#> 45 2 Species20 -1.000000e+00 0.00000 0.00000000 0.000000e+00
#> 46 2 Species21 2.281915e+01 22.00000 1.22222222 2.688889e+01
#> 47 2 Species22 1.385695e+01 12.00000 0.85714286 1.028571e+01
#> 48 2 Species23 1.763888e+02 164.00000 9.11111111 1.494222e+03
#> 49 2 Species24 3.262260e+02 294.00000 17.29411765 5.084471e+03
#> 50 2 Species25 8.759957e+00 9.00000 0.50000000 4.500000e+00
# Cz indices
net_bip <- mat_to_net(comat, weight = TRUE)
clust_bip <- netclu_greedy(net_bip, bipartite = TRUE)
site_species_metrics(cluster_object = clust_bip, comat = comat,
net = net_bip, indices = "Cz")
#> Node Bioregion Category C z
#> 1 Site1 3 site 0.8050000 1.0954451
#> 2 Site2 1 site 0.8208617 0.7046643
#> 3 Site3 2 site 0.8128544 -1.2421180
#> 4 Site4 4 site 0.8199446 1.0223973
#> 5 Site5 6 site 0.8194444 -0.8017837
#> 6 Site6 2 site 0.8052930 0.2070197
#> 7 Site7 1 site 0.8088643 -0.1761661
#> 8 Site8 5 site 0.8128544 -0.3333333
#> 9 Site9 2 site 0.8181818 0.2070197
#> 10 Site10 6 site 0.8229167 -0.8017837
#> 11 Site11 1 site 0.8140496 1.5854946
#> 12 Site12 5 site 0.8200000 1.1666667
#> 13 Site13 1 site 0.8117914 1.5854946
#> 14 Site14 5 site 0.8166352 1.1666667
#> 15 Site15 3 site 0.8128544 1.0954451
#> 16 Site16 2 site 0.8125000 -1.2421180
#> 17 Site17 5 site 0.8099174 1.1666667
#> 18 Site18 6 site 0.8181818 -0.8017837
#> 19 Site19 4 site 0.8033241 1.7380754
#> 20 Site20 6 site 0.7958478 -0.8017837
#> 21 Species2 4 species 0.8209877 -0.4089589
#> 22 Species3 1 species 0.8209877 -0.1761661
#> 23 Species4 1 species 0.7959184 -0.1761661
#> 24 Species6 2 species 0.8086420 0.2070197
#> 25 Species7 6 species 0.8096886 1.0690450
#> 26 Species8 3 species 0.8235294 -0.7302967
#> 27 Species9 1 species 0.8200000 -0.1761661
#> 28 Species12 5 species 0.8200000 -0.3333333
#> 29 Species13 1 species 0.8209877 -1.0569964
#> 30 Species14 6 species 0.8199446 1.0690450
#> 31 Species15 3 species 0.8086420 -0.7302967
#> 32 Species16 5 species 0.7901235 -0.3333333
#> 33 Species17 1 species 0.8096886 -1.0569964
#> 34 Species18 5 species 0.7890625 -0.3333333
#> 35 Species19 1 species 0.8125000 -1.0569964
#> 36 Species20 3 species 0.8199446 -0.7302967
#> 37 Species21 5 species 0.8086420 -0.3333333
#> 38 Species22 4 species 0.7959184 -1.1246370
#> 39 Species24 2 species 0.8166090 1.6561573
#> 40 Species25 4 species 0.8209877 -0.4089589
#> 41 Species1 4 species 0.8096886 -0.4089589
#> 42 Species5 2 species 0.7777778 0.2070197
#> 43 Species10 5 species 0.8086420 -1.8333333
#> 44 Species11 6 species 0.8046875 1.0690450
#> 45 Species23 4 species 0.8086420 -0.4089589