divPartition: Partitionning network diversity in alpha, beta and gamma...

Description Usage Arguments Value Author(s) References Examples

View source: R/divPartition.R

Description

This function computes alpha, beta and gamma diversity of a list of networks. It measures either group, links, or probability of links diversity.

Usage

1
2
divPartition(gList, groups, eta=1, framework=c('RLC','Chao'),
             type=c('P','L','Pi'), abTable=NULL)

Arguments

gList

A list of graph objects of class igraph.

groups

A named vector of class character indicating the group to which each node belongs to. The length of groups must correspond to the number of different nodes present in gList. The names names(groups) must correspond to the nodes names in gList. If NULL, the groups are the initial nodes.

eta

A positive number that controls the weight given to abundant groups/links. Default value is 1.

framework

The framework used to partitionate diversity, either Reeve Leinster Cobbold ('RLC') or Chao ('Chao')

type

The type of diversity to measure and partitionate. It can be groups diversity ('P'), link diversity ('L') or probability of link diversity ('Pi').

abTable

A matrix of size the number of nodes of the metanetwork times the number of networks. The rownames of this matrix must be the node names of metanetwork and the columns must be in an order corresponding to gList. The element (i,j) of this matrix is the abundance of species i in network j. Importantly, the non-nul elements in each column of abTalbe must correspond to the nodes present in each element of gList

Value

Returns a list the following components:

mAlpha

The mean value of alpha-diversity accross all networks.

Alphas

A vector of numeric containing the local alpha-diversities (i.e. the alpha-diversity value for each network).

Beta

The value of the overall beta-diversity

Gamma

The value of the gamma-diversity

Author(s)

Authors: Stephane Dray, Vincent Miele, Marc Ohlmann, Wilfried Thuiller Maintainer: Wilfried Thuiller <wilfried.thuiller@univ-grenoble-alpes.fr>

References

Marc Ohlmann, Vincent Miele, Stephane Dray, Loic Chalmandrier, Louise O'Connor & Wilfried Thuiller, Diversity indices for ecological networks: a unifying framework using Hill numbers. Ecology Letters (2019) <doi:10.1111/ele.13221>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Generating a set of Erdos-Renyi graphs and give node names.
library(econetwork)
library(igraph)
nbGraph <- 10
gList <- c()
n <- 57 # number of nodes of each graph
C <- 0.1  # connectance of each graph
for(i in 1:nbGraph){
  graphLocal <- erdos.renyi.game(n, type='gnp', p.or.m=C, directed=TRUE)
  V(graphLocal)$name <- as.character(1:57)
  gList = c(gList,list(graphLocal))
}

# vector that gives the group of each node
groups <- c(rep("a",23),rep("b",34)) 
names(groups) <- as.character(1:57)
# generating random (non-nul) abundances data
abTable <- sapply(1:nbGraph,function(x) rpois(n,1)+1)
rownames(abTable) = unlist(unique(lapply(gList,function(g) V(g)$name)))

# Diversities in link abundances
# at a node level
divPartition(gList, framework='Chao', type = 'L')
# at a node level while taking into account node abundances
divPartition(gList, framework='Chao', type = 'L', abTable = abTable)
# at a group level
divPartition(gList, framework='Chao', groups, type = 'L')
# at a group level while taking into account node abundances
divPartition(gList, framework='Chao', groups, type = 'L', abTable = abTable)

Example output

Attaching package:igraphThe following objects are masked frompackage:stats:

    decompose, spectrum

The following object is masked frompackage:base:

    union

$mAlpha
[1] 323.3488

$Alphas
  1   2   3   4   5   6   7   8   9  10 
343 310 303 306 312 345 339 335 325 319 

$Beta
[1] 5.830914

$Gamma
[1] 1885.419

$mAlpha
[1] 258.1721

$Alphas
       1        2        3        4        5        6        7        8 
262.7152 255.8141 242.7255 251.8009 244.2358 259.6165 284.8913 258.2186 
       9       10 
271.4906 252.8990 

$Beta
[1] 6.266209

$Gamma
[1] 1617.76

$mAlpha
[1] 3.844212

$Alphas
       1        2        3        4        5        6        7        8 
3.803013 3.911524 3.840046 3.781633 3.846667 3.796603 3.895602 3.788159 
       9       10 
3.906566 3.875301 

$Beta
[1] 1.004235

$Gamma
[1] 3.860491

$mAlpha
[1] 3.841939

$Alphas
       1        2        3        4        5        6        7        8 
3.822980 3.895346 3.717882 3.747427 3.879356 3.764908 3.899589 3.935931 
       9       10 
3.893264 3.869311 

$Beta
[1] 1.00727

$Gamma
[1] 3.869869

econetwork documentation built on Oct. 18, 2021, 5:09 p.m.