-----Original Message-----
From: r-devel-bounces at r-project.org
[mailto:r-devel-bounces at r-project.org] On Behalf Of claus.henry at gmx.de
Sent: Saturday, August 29, 2009 12:35 AM
To: r-devel at stat.math.ethz.ch
Cc: R-bugs at r-project.org
Subject: [Rd] round off errors? (PR#13918)
Full_Name: Claus Pastor
Version: 2.9.2
OS: Windows XP
Submission from: (NULL) (82.113.106.4)
I use the following function to compute MutualInformation
Matrix of factorial
members of a dataframe. I use package minet for this:
my.MI = function(test) {
## die Diagonale gibt die Entropien, Teile durch entropy von
y und du erh?lst
den Zusammenhang
## kenne X und sage daraus y voraus
require(minet)
MI.matrix =
matrix(0,nrow=length(test),ncol=length(test),dimnames=list(nam
es(test),names(test)))
for (i in 1:length(test)) {
for (j in 1:length(test)) {
temp = na.omit(test[,c(i,j)])
MI = build.mim(temp)
p.i = prop.table(table(temp[,1]))
p.j = prop.table(table(temp[,2]))
H.i = sum(-p.i*log(p.i))
H.j = sum(-p.j*log(p.j))
MI.matrix[i,j] = MI[1,2]/H.j
MI.matrix[j,i] = MI[1,2]/H.i
}
}
return(MI.matrix)
}
The function works well under R 2.8.
Under R2.9.2 it produces Mutual Information values (MI) of
more than 1 (e.g.
1.000013) which are not allowed. MI is in [0:1]. I suppose
there are rounding
errors anywhere in the new R 2.9.2.