Compute Shannon's Mutual Information based on the identity \(I(X,Y) = H(X) + H(Y) - H(X,Y)\) based on a given joint-probability vector \(P(X,Y)\) and probability vectors \(P(X)\) and \(P(Y)\).
MI(x, y, xy, unit = "log2")
a numeric probability vector \(P(X)\).
a numeric probability vector \(P(Y)\).
a numeric joint-probability vector \(P(X,Y)\).
a character string specifying the logarithm unit that shall be used to compute distances that depend on log computations.
Shannon's Mutual Information in bit.
This function might be useful to fastly compute Shannon's Mutual Information for any given joint-probability vector and probability vectors.
Shannon, Claude E. 1948. "A Mathematical Theory of Communication". Bell System Technical Journal 27 (3): 379-423.
#>  3.311973