get_diversity_from_transition: Compute the diversity of a transition matrix, that is the...

Description Usage Arguments Value Examples

Description

get_diversity_from_transition either computes the individual diversity values associated to the rows of the input transition matrix, or the geometric means of these values, optionally weighting them according to the input mean_distribution. This hence allows to compute conditional diversity values associated to a transition matrix.

Usage

1
2
get_diversity_from_transition(transition, type = "individual",
  mean_distribution = NULL, order = NULL, measure = NULL)

Arguments

transition

A matrix of floats in [0,1], with all lines summing to 1, giving the transition matrix from which the individual diversity values are computed.

type

Either 'individual', to separately compute all individual diversities, or 'mean', to compute their geometric mean.

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.

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 (or their geometric mean) of the row of the input transition matrix.

Examples

1
2
3
4
5
transition <- matrix (c (1/3, 1/3, 1/3, 0.9, 0.1, 0), nrow=2, ncol=3, byrow=TRUE)

get_diversity_from_transition (transition, type='individual', order=c(0,Inf), measure='entropy')
get_diversity_from_transition (transition, type='mean')
get_diversity_from_transition (transition, type='mean', mean_distribution=c(1/4,3/4))

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