mi_matrix: Generating its Mutual Information Estimations Matrix

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/RcppExports.R

Description

The estimators in this package detect independence as well as consistently estimates the true conditional mutual information value as the length grows based on Jeffrey's prior, Bayesian Dirichlet equivalent uniform (BDeu [1]), and the MDL principle. It also estimates the conditional mutual information value even when one of the pair is continuous (see [2]). Given a data frame each column of which may be either discrete or continuous, this function generates its mutual information estimation matrix.

Usage

1
mi_matrix(df, proc=0)

Arguments

df

a data frame.

proc

given two discrete vectors of equal length, the function estimates the mutual information based on Jeffrey's prior, the MDL principle, and BDeu for proc=0,1,2, respectively. If one of the columns is continuous, proc=10 should be chosen. If the argument proc is missing, proc=0 (Jeffreys') is assumed.

Value

the estimation of mutual information between the two numeric vectors based on the selected criterion, where the natural logarithm base is assumed.

Author(s)

Joe Suzuki and Jun Kawahara

References

[1] Suzuki, J., “A theoretical analysis of the BDeu scores in Bayesian network structure learning", Behaviormetrika, 2017. [2] Suzuki, J., “An estimator of mutual information and its application to independence testing", Entropy, Vol.18, No.4, 2016. [3] Suzuki. J., “A novel Chow?Liu algorithm and its application to gene differential analysis", International Journal of Approximate Reasoning, Vol. 80, 2017.

See Also

mi

Examples

1
2
3
4
5
library(bnlearn)
mi_matrix(asia)
mi_matrix(asia,proc=1)
mi_matrix(asia,proc=2)
mi_matrix(asia,proc=3)

Example output

Loading required package: bnlearn

Attaching package: 'bnlearn'

The following object is masked from 'package:stats':

    sigma

Loading required package: igraph

Attaching package: 'igraph'

The following objects are masked from 'package:bnlearn':

    compare, degree, path, subgraph

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union

     [,1] [,2] [,3]       [,4]       [,5]        [,6]         [,7]        [,8]
[1,]    0    0    0 0.00000000 0.00000000 0.000000000 0.0000000000 0.000000000
[2,]    0    0    0 0.02432294 0.08959769 0.020643307 0.0125162376 0.048501061
[3,]    0    0    0 0.00000000 0.00000000 0.022681668 0.0186984076 0.001317185
[4,]    0    0    0 0.00000000 0.00151730 0.217081534 0.1614690846 0.016550911
[5,]    0    0    0 0.00000000 0.00000000 0.001659491 0.0008712105 0.236655752
[6,]    0    0    0 0.00000000 0.00000000 0.000000000 0.1858057825 0.018343908
[7,]    0    0    0 0.00000000 0.00000000 0.000000000 0.0000000000 0.011654488
[8,]    0    0    0 0.00000000 0.00000000 0.000000000 0.0000000000 0.000000000
     [,1] [,2] [,3]       [,4]        [,5]        [,6]         [,7]        [,8]
[1,]    0    0    0 0.00000000 0.000000000 0.000000000 0.0000000000 0.000000000
[2,]    0    0    0 0.02413943 0.089413961 0.020459710 0.0123325445 0.048317326
[3,]    0    0    0 0.00000000 0.000000000 0.022567234 0.0185839709 0.001134406
[4,]    0    0    0 0.00000000 0.001333631 0.216967282 0.1612894618 0.016367297
[5,]    0    0    0 0.00000000 0.000000000 0.001475813 0.0006875042 0.236472036
[6,]    0    0    0 0.00000000 0.000000000 0.000000000 0.1856261666 0.018160277
[7,]    0    0    0 0.00000000 0.000000000 0.000000000 0.0000000000 0.011470789
[8,]    0    0    0 0.00000000 0.000000000 0.000000000 0.0000000000 0.000000000
     [,1] [,2] [,3]       [,4]        [,5]        [,6]         [,7]        [,8]
[1,]    0    0    0 0.00000000 0.000000000 0.000000000 0.0000000000 0.000000000
[2,]    0    0    0 0.02421781 0.089321778 0.020511809 0.0123233938 0.048216504
[3,]    0    0    0 0.00000000 0.000000000 0.023055344 0.0190504478 0.001380062
[4,]    0    0    0 0.00000000 0.001365857 0.217459380 0.1615844343 0.016420481
[5,]    0    0    0 0.00000000 0.000000000 0.001497254 0.0006683543 0.236419712
[6,]    0    0    0 0.00000000 0.000000000 0.000000000 0.1859244564 0.018202218
[7,]    0    0    0 0.00000000 0.000000000 0.000000000 0.0000000000 0.011458324
[8,]    0    0    0 0.00000000 0.000000000 0.000000000 0.0000000000 0.000000000
     [,1]         [,2]         [,3]         [,4]         [,5]         [,6]
[1,]    0 0.0002304651 3.620067e-04 5.215910e-05 0.0003047694 0.0002354624
[2,]    0 0.0000000000 1.598092e-07 2.499115e-02 0.0902656804 0.0213114291
[3,]    0 0.0000000000 0.000000e+00 4.030709e-05 0.0002886040 0.0234189529
[4,]    0 0.0000000000 0.000000e+00 0.000000e+00 0.0021853507 0.2178190011
[5,]    0 0.0000000000 0.000000e+00 0.000000e+00 0.0000000000 0.0023275323
[6,]    0 0.0000000000 0.000000e+00 0.000000e+00 0.0000000000 0.0000000000
[7,]    0 0.0000000000 0.000000e+00 0.000000e+00 0.0000000000 0.0000000000
[8,]    0 0.0000000000 0.000000e+00 0.000000e+00 0.0000000000 0.0000000000
             [,7]         [,8]
[1,] 0.0002108371 0.0002668192
[2,] 0.0131842638 0.0491690458
[3,] 0.0194356902 0.0019861253
[4,] 0.1621411811 0.0172190163
[5,] 0.0015392235 0.2373237558
[6,] 0.1864778859 0.0190119960
[7,] 0.0000000000 0.0123225084
[8,] 0.0000000000 0.0000000000

BNSL documentation built on May 2, 2019, 7:58 a.m.