shannon_mutual_info: Shannon Mutual Information

Description Usage Arguments Value Examples

View source: R/shannon.R

Description

Compute the base-b mutual information between two random variables.

Usage

1
shannon_mutual_info(p_xy, p_x, p_y, b = 2)

Arguments

p_xy

Dist specifying the joint distribution.

p_x

Dist specifying the x-marginal distribution.

p_y

Dist specifying the y-marginal distribution.

b

Numeric giving the base of the logarithm.

Value

Numeric giving the Shannon mutual information.

Examples

1
2
3
4
5
6
xy <- Dist(c(10, 70, 15, 5))
x  <- Dist(c(80, 20))
y  <- Dist(c(25, 75))
shannon_mutual_info(xy, x, y)           # 0.2141709
shannon_mutual_info(xy, x, y, b = 3)    # 0.1351268
shannon_mutual_info(xy, x, y, b = 0)    # 0

rinform documentation built on April 1, 2018, 12:12 p.m.