shan: Calculate Shannon diversity of transitions.

Description Usage Arguments Details Value Author(s) References Examples

Description

Calculate the diversity of transitions using the Shannon index. Note that the formulas are conditional to omit zero probability values from the calculation.

Usage

1
shan(p)

Arguments

p

Either an array of marginal probabilities of a variable, X, or a matrix indicating the joint probabilities across all interactions of X and Y in the form:

p(x,y) X
0.06 0.06 0.06 ...
Y 0.14 0.14 0.14 ...
0.12 0.12 0.14 ...
... ... ... ...

Details

Multiply (element-wise) array (or matrix) p by logarithm base 2 p and sum.

∑ -p(x_i,y_j) * log2 p(x_i,y_j) = -p(1,1) * log2 p(1,1) + -p(1,2) * log2 p(1,2) + … + -p(i,j) * log2 p(i,j)

Value

Returns a value indicating the Shannon diversity of transitions.

Author(s)

Bjorn J. Brooks, Lars Y. Pomara, Danny C. Lee

References

PAPER TITLE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(transitions)                # Load example data
b <- brkpts(transitions$phenofr, # Find 10 probabilistically
            10)                  #  equivalent breakpoints
m <- xt(transitions,             # Make transition matrix
        fr.col=2, to.col=3,
        cnt.col=4, brk=b)
pxy <- jpmf(m)                   # Joint distribution
hxy <- shan(pxy)                 # Shannon diversity of all transitions
rmd <- rowSums(pxy)              # Row marginal distribution
hy <- shan(rmd)                  # Shannon div of all "to" transitions
cmd <- colSums(pxy)              # Column marginal distribution
hx <- shan(cmd)                  # Shannon div of all "from" transitions

LandscapeDynamics/ITmetrics documentation built on May 26, 2019, 1:35 p.m.