mi: Calculate mutual information of transitions.

Description Usage Arguments Details Value Author(s) References Examples

View source: R/mi.R

Description

Calculate the average mutual information of transitions.

Usage

1
mi(pxy)

Arguments

pxy

a matrix indicating the joint distribution across all interactions of X and Y (must sum to 1) 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

Calculate matrix product of pxy and log base 2 of the ratio of pxy over the standard product of px and py, then 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 all 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
mi <- mi(pxy)                    # Avg mutual information of X and Y

# Now calculate MI using a second method (answers should be identical)
mi2 <- sum(pxy * log2( cpf(pxy, margin='p(col|row)') / colSums(pxy)),
           na.rm=TRUE)

bjornbrooks/landat documentation built on May 17, 2019, 7:32 p.m.