Function to calculate the mutual information of 2 random variables, or
between all pairs of rows of a numerical matrix.
Usage
MI(x, y=NULL, k=1)
Arguments
x
numerical matrix to calculate the MI between all pairs of
rows from x. Also, x must be a numerical vector and
y must be specified as another numerical vector of same
lenght as x and the MI value between both them are calculated.
y
optional numerical vector that must be specified if x
is a vector. Defaults to NULL.
k
integer specifying the number of the neighbours to be used in the
calculation of the MI value.
Value
If x is a matrix, the function return a square matrix with
lenght equal to the number of rows of x with MI values between
all pairs of rows from x. If x is a numerical vector,
y must be specified and the function returns a positive real
number with the MI value between the two vectors.
Details
This function implements an algorithm proposed by Kraskov et
al. (2004) that don't use estimator of the entropy.