get_diversity_from_path: Compute the diversity associated to a random walk following a...

Description Usage Arguments Value Examples

Description

get_diversity_from_path computes diversity values of the probability distribution of a random walk following a path between the different parts of the input multipartite graph. It starts at a given part with an initial probability distribution, then randomly follows the links of the graph between the different parts according to the input path, then stops at the last specified part. The implemented diversity measures all belong to the parametrized family of "True Diversity" measures. They can either be specified by their diversity order in [0,Inf[ or by their measure name when it corresponds to classical instances such as the richness, the Shannon entropy, the Herfindahl-Hirschman index, or the Berger-Parker index.

Usage

1
2
3
get_diversity_from_path(graph, path, type = "individual",
  mean_distribution = NULL, initial_distribution = NULL,
  initial_node = NULL, order = NULL, measure = NULL)

Arguments

graph

A multipartite graph obtained by calling the get_multipartite function.

path

A vector of character strings giving the path that the random walk should follow between the different parts of the input multipartite graph. This path can be as long as wanted, with eventual cycles, and each string it contains should refer to a label in graph$parts.

type

Either 'individual', to separately compute all individual diversities, 'mean', to compute their geometric mean, or 'collective', to compute the overall diversity.

mean_distribution

(optional, only when type == 'mean') A vector of floats in [0,1] and summing to 1 giving the probability distribution that is used to weight the diversity values when computing their geometric means. It should hence contain as many values as there are rows in the input transition. If not specified, this distribution is assumed uniform.

initial_distribution

(optional, only when type == 'collective') A vector of floats in [0,1] and summing to 1 giving the probability distribution to start with at the first part of the input path. It should hence contain as many values as there are nodes in the corresponding part. If not specified, this distribution is assumed uniform.

initial_node

(optional, only when type == 'collective') A character string giving the label of a node in the first part of the input path. This node is then considered to have probability one, thus being equivalent to specifying an initial_distribution with only zeros except for one node. If not specified, no such node is defined and the initial distribution is then assumed uniform.

order

A vector of positive floats (possibly including Inf) giving the orders of the diversity measures to be computed. If neither order nor measure is specified, a predefined list of 8 diversity measures is computed.

measure

A vector of strings giving the names of the diversity measures to compute. Possible values are richness, entropy, herfindahl, and bergerparker.

Value

A matrix (or a vector) of positive floats giving the individual diversity values of the random walks following the input path (or their mean, or the collective diversity).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data (tripartite_example)
graph <- get_multipartite (data=tripartite_example)
path <- c(1,2,3)


get_diversity_from_path (graph, path, 'individual', measure=c('entropy','herfindahl'))
get_diversity_from_path (graph, path, 'individual', order=c(0,1,Inf))

# Mean of individual diversities
get_diversity_from_path (graph, path, 'mean')
get_diversity_from_path (graph, path, 'mean', mean_distribution=c(1/3,2/3))

# Collective diversities
get_diversity_from_path (graph, path, 'collective')
get_diversity_from_path (graph, path, 'collective', initial_distribution=c(0.75,0.25))

Lamarche-Perrin/triversity documentation built on May 22, 2019, 12:36 p.m.