Fast Mutual Information based independence Test (fastmit)

Introduction

The fundamental problem for data mining and statistical analysis is:

fastmit package provides solutions for this issue. It implements the kNN method described by Kraskov, et. al (2004) to estimate the empirical mutual information and furthermore uses permutation test to detect whether two random variables are independent. The core functions in fastmit package are mi and mi.test.

These functions based on mutual information have two main advantages:

Installation

CRAN version

You can install the released version of fastmit from CRAN with:

install.packages("fastmit")

Github version

You can install the released version of fastmit from GitHub with:

library(devtools)
install_github("Mamba413/fastmit/R-package")

Windows user will need to install Rtools first.

Example

## simulate data
set.seed(1)
x <- rnorm(100)
y <- x + rnorm(100)
## estimate the empirical mutual information
mi(x, y)

In this example, the result is:

# [1] 0.3320034
## simulate data
set.seed(1)
error <- runif(50, min = -0.3, max = 0.3)
x <- runif(50, 0, 4*pi)
y <- cos(x) + error

## perform independence test via mutual information
mi.test(x, y)

In this example, the result is:

    Mutual Information test of independence

data:  x and y
number of observations = 50
replicates = 99
p-value = 0.01
alternative hypothesis: random variables are dependent
sample estimates:
       MI 
0.6953105 

If you find any bugs, or if you experience any crashes, please report to us. Also, if you have any questions, feel free to ask.

License

GPL-3

Reference