knnmi.all: Parallel Mutual Information Estimation Between All Matrix...

Description Usage Arguments Details References See Also Examples

View source: R/knnmi.R

Description

A function that computes the mutual information between all pairs of rows of matrix mat using entropy estimates from K-nearest neighbor distances.

Usage

1
knnmi.all(mat, k=3, noise=1e-12)

Arguments

mat

a numeric matrix (for the reconstruction of gene regulatory networks, genes on rows and samples on columns).

k

the number of nearest neighbors to consider to estimate the mutual information. Must be less than the number of columns of mat.

noise

the magnitude of the random noise added to break ties.

Details

The function adds a small random noise to the data in order to break ties due to limited numerical precision.

By default, the function uses all the available cores. You can set the actual number of threads used to N by exporting the environment variable OMP_NUM_THREADS=N.

References

Kraskov, Alexander and Stogbauer, Harald and Grassberger, Peter. Estimating mutual information. Phys. Rev. E, 2004.

See Also

knnmi

knnmi.cross

Examples

1
2
mat <- matrix(rnorm(1000), nrow=10)
knnmi.all(mat, 5)

Example output

             [,1]        [,2]        [,3]         [,4]         [,5]
 [1,]  0.00000000 -0.02806706  0.15003652 -0.047842810  0.039044538
 [2,] -0.02806706  0.00000000 -0.04572943  0.040993823 -0.019584718
 [3,]  0.15003652 -0.04572943  0.00000000 -0.042201791  0.011166598
 [4,] -0.04784281  0.04099382 -0.04220179  0.000000000 -0.070346334
 [5,]  0.03904454 -0.01958472  0.01116660 -0.070346334  0.000000000
 [6,]  0.06362091  0.01249793 -0.02027043 -0.038302593 -0.004138102
 [7,]  0.02180020 -0.02044123 -0.01533946  0.005473359  0.007987019
 [8,] -0.00414971  0.02471406  0.01669553 -0.026548451  0.030620576
 [9,] -0.02271794 -0.05124606  0.08074953 -0.011544480  0.002627530
[10,] -0.02696803 -0.03067395 -0.03998586 -0.054476684  0.023481760
              [,6]         [,7]        [,8]         [,9]        [,10]
 [1,]  0.063620911  0.021800205 -0.00414971 -0.022717941 -0.026968026
 [2,]  0.012497928 -0.020441228  0.02471406 -0.051246057 -0.030673951
 [3,] -0.020270428 -0.015339463  0.01669553  0.080749535 -0.039985856
 [4,] -0.038302593  0.005473359 -0.02654845 -0.011544480 -0.054476684
 [5,] -0.004138102  0.007987019  0.03062058  0.002627530  0.023481760
 [6,]  0.000000000  0.016420978 -0.02614715 -0.050245471 -0.026323080
 [7,]  0.016420978  0.000000000 -0.02469703  0.016607944 -0.040348570
 [8,] -0.026147152 -0.024697027  0.00000000 -0.034964772  0.040481345
 [9,] -0.050245471  0.016607944 -0.03496477  0.000000000  0.004130605
[10,] -0.026323080 -0.040348570  0.04048134  0.004130605  0.000000000

parmigene documentation built on Aug. 3, 2020, 5:13 p.m.