Computes the mutual information (MI) between two variables from a contingency table.
Arguments
- x
a contingency table, matrix, or vector that can be coerced into a contingency table
- y
an optional second variable used together with
xto create a contingency table viatable(x, y, ...)- base
logarithm base. Defaults to
2(bits).- normalize
logical. If
TRUE, returns normalized mutual information (NMI).- ...
additional arguments passed to
table()
Details
Mutual information quantifies the amount of information obtained about one variable through observing the other.
It is defined as:
$$ I(X;Y) = H(X) + H(Y) - H(X,Y) $$
where \(H(X)\) and \(H(Y)\) are marginal entropies and \(H(X,Y)\) is the joint entropy.
Mutual information is always nonnegative:
$$ I(X;Y) \ge 0 $$
Larger values indicate stronger dependence.
If normalize = TRUE, the returned value is:
$$ \frac{I(X;Y)} {\sqrt{H(X)H(Y)}} $$
which approximately scales the measure to \([0,1]\).
See also
Other assoc.nominal:
contCoef(),
cramerV(),
gkTau(),
lambda(),
phi(),
tschuprowT(),
uncertCoef(),
yule
