I want to calculate condition mutual information in R and I used package called infotheo.
I used two ways to calculate I(X;Y1,Y2|Z). First is to use the following code,
condinformation(X$industry,cbind(X$ethnicity,X$education),S=X$gender, method="emp")
[1] -1.523344
And as I think the mutual information can be decomposed to two entropies: I(X;Y1,Y2|Z)=H(X|Z)-H(X|Z,Y1,Y2), I used the following codes,
hhh<-condentropy(X$industry, Y=X$gender, method="emp")
hhh1<-condentropy(X$industry,Y=cbind(X$gender,X$ethnicity,X$education))
hhh-hhh1
[1] 0.1483363
I am wondering why these two gave me different results?