[R] mutualInfo() from bioDist package

Runxuan Zhang zhangrunxuan at gmail.com
Mon Jun 15 17:57:35 CEST 2009


Hi,

I try to find a function that calculates the mutual information between 
two arrays and i found mutualInfo() from bioDist package.

when i run the example:

x <- matrix(rnorm(100),nrow=5)
mutualInfo(x, nbin=3)

Then just to try out, i have assigned all the rest rows to the same 
values as the first row.
x[2,]<-x[1,]
x[3,]<-x[1,]
x[4,]<-x[1,]
x[5,]<-x[1,]

 > x
           [,1]      [,2]     [,3]     [,4]      [,5]       [,6]       
[,7]       [,8]      [,9]     [,10]
[1,] -0.7542452 0.8033849 1.513750 1.143666 -1.815935 -0.3781354 
0.02026738 -0.8870625 0.3354863 -1.775121
[2,] -0.7542452 0.8033849 1.513750 1.143666 -1.815935 -0.3781354 
0.02026738 -0.8870625 0.3354863 -1.775121
[3,] -0.7542452 0.8033849 1.513750 1.143666 -1.815935 -0.3781354 
0.02026738 -0.8870625 0.3354863 -1.775121
[4,] -0.7542452 0.8033849 1.513750 1.143666 -1.815935 -0.3781354 
0.02026738 -0.8870625 0.3354863 -1.775121
[5,] -0.7542452 0.8033849 1.513750 1.143666 -1.815935 -0.3781354 
0.02026738 -0.8870625 0.3354863 -1.775121
         [,11]     [,12]    [,13]     [,14]        [,15]      [,16]     
[,17]     [,18]     [,19]      [,20]
[1,] -1.264028 0.9292861 1.592756 0.5829724 -0.004288089 0.03062974 
0.3517299 0.4434983 -1.622165 -0.2684567
[2,] -1.264028 0.9292861 1.592756 0.5829724 -0.004288089 0.03062974 
0.3517299 0.4434983 -1.622165 -0.2684567
[3,] -1.264028 0.9292861 1.592756 0.5829724 -0.004288089 0.03062974 
0.3517299 0.4434983 -1.622165 -0.2684567
[4,] -1.264028 0.9292861 1.592756 0.5829724 -0.004288089 0.03062974 
0.3517299 0.4434983 -1.622165 -0.2684567
[5,] -1.264028 0.9292861 1.592756 0.5829724 -0.004288089 0.03062974 
0.3517299 0.4434983 -1.622165 -0.2684567

Then i expect the output of mutualInfo to be all zeros. However,
 > mutualInfo(x, nbin=3, diag=T)
       1      2      3      4      5
1 0.0000                           
2 1.0889 0.0000                    
3 1.0889 1.0889 0.0000             
4 1.0889 1.0889 1.0889 0.0000      
5 1.0889 1.0889 1.0889 1.0889 0.0000

Has anyone come across problem like this when using this function? Is 
there any recommendations for other functions calculating pairwise 
mutual information between two arrays?

Thanks a lot,

Best,

Runxuan




More information about the R-help mailing list