Description Usage Arguments Details Value Author(s) References Examples
Calculate the diversity of transitions using the Shannon index. Note that the formulas are conditional to omit zero probability values from the calculation.
1 | shan(p)
|
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:
|
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)
Returns a value indicating the Shannon diversity of transitions.
Bjorn J. Brooks, Lars Y. Pomara, Danny C. Lee
PAPER TITLE.
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.