【发布时间】:2016-10-02 20:59:28
【问题描述】:
我想在 R 中计算条件互信息,我使用了名为 infotheo 的包。
我使用了两种方法来计算 I(X;Y1,Y2|Z)。首先是使用如下代码,
condinformation(X$industry,cbind(X$ethnicity,X$education),S=X$gender, method="emp")
[1] -1.523344
而且我认为互信息可以分解为两个熵:I(X;Y1,Y2|Z)=H(X|Z)-H(X|Z,Y1,Y2),我使用了以下代码,
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
我想知道为什么这两个给了我不同的结果?
【问题讨论】:
-
这个问题将受益于reproducible example
标签: r entropy information-theory