5.3 Contribution
Pierre Denelle, Boris Leroy and Maxime Lenormand
2024-11-11
Source:vignettes/a5_3_contribution.Rmd
a5_3_contribution.Rmd
In this vignette, we aim at evaluating the contribution of individual
species to each bioregion, using the function
contribution()
.
Data
We use the vegetation dataset that comes with
bioregion
.
data("vegedf")
data("vegemat")
# Calculation of (dis)similarity matrices
vegedissim <- dissimilarity(vegemat, metric = c("Simpson"))
vegesim <- dissimilarity_to_similarity(vegedissim)
Bioregionalization
We use the same three bioregionalization algorithms as in the visualization
vignette, i.e. a non-hierarchical, hierarchical and network
bioregionalizations.
We chose 3 bioregions for the non-hierarchical and hierarchical
bioregionalizations.
# Non hierarchical bioregionalization
vege_nhclu_kmeans <- nhclu_kmeans(vegedissim, n_clust = 3, index = "Simpson")
vege_nhclu_kmeans$cluster_info # 3
## partition_name n_clust
## K_3 K_3 3
# Hierarchical bioregionalization
set.seed(1)
vege_hclu_hierarclust <- hclu_hierarclust(dissimilarity = vegedissim,
index = names(vegedissim)[3],
method = "average", n_clust = 3)
vege_hclu_hierarclust$cluster_info # 3
## partition_name n_clust requested_n_clust output_cut_height
## 1 K_3 3 3 0.5625
# Network bioregionalization
set.seed(1)
vege_netclu_walktrap <- netclu_walktrap(vegesim,
index = names(vegesim)[3])
vege_netclu_walktrap$cluster_info # 3
## partition_name n_clust
## K_3 K_3 3
Indices
The contribution index
is calculated for each species x bioregion combination, following (Lenormand et al., 2019).
Its formula is
the following:
with the number of sites, the number of sites in which species is present, the number of sites belonging to the bioregion , the number of occurrences of species in sites belonging to the bioregion .
Contribution
We can now run the function contribution()
.
contrib_kmeans <- contribution(vege_nhclu_kmeans, vegemat,
indices = "contribution")
contrib_hclu <- contribution(vege_hclu_hierarclust, vegemat,
indices = "contribution")
contrib_netclu <- contribution(vege_netclu_walktrap, vegemat,
indices = "contribution")
contribution()
produces a single data.frame
output.