# mutual information and maximual infomation coffecient

I am interested in calculating the strength between random variables. I found that the maximal information coefficient is one of the good methods to use and it is robust to the mutual information method. However, I need to calculate the conditional maximal information coefficient. However, based on my search, I found nothing regarding the maximal information coefficient. Is there is an R package that can do this calculation? or any published article regarding this point?

Mutual information is well known, sklearn has a good implementation here and in R package entropy.

Regarding MIC, MICtools and minerva are Python/R good implementations. See references given in MICtools repo description for further papers.

Edit: This is a dummy example how to compute MIC score for $$x$$ and $$y$$ conditionally given that $$z=1$$.

from minepy import MINE
import numpy as np
mine = MINE(alpha=0.6, c=15)

np.random.seed(42)

x = np.random.random(100)
y = np.random.random(100)
z = np.random.binomial(1, 0.5, 100)

condition_z_is_one = np.where(z > 0)[0]
mine.compute_score(x[condition_z_is_one],
y[condition_z_is_one])

mic_score = mine.mic() # 0.21421355042023246

• Thanks a lot for your help. It is appreciated. However, these packages did not count for conditional (the strength between x and y given z. Commented Jun 21, 2021 at 9:55
• You could condition x and y simultaneously given set of z values, before passing to these implementations. Meaning we use the subset of x and y given z condition. Commented Jun 21, 2021 at 9:59
• Could you please show me an example to do so and update your answer in order to accept it? As my problem is within the conditional case. Commented Jun 21, 2021 at 11:26
• @Maryam One dummy example is added using minepy but using mictools is recommended for production. Commented Jun 21, 2021 at 15:33