mi.test: Mutual Information Test

Description Usage Arguments Details Value Examples

View source: R/mi_test.R

Description

Mutual Information test of independence. Mutual Information are generic dependence measures in Banach spaces.

Usage

1
2
mi.test(x, y, k = 5, distance = FALSE, num.permutations = 99,
  seed = 1)

Arguments

x

A numeric vector, matrix, data.frame or dist object.

y

A numeric vector, matrix, data.frame or dist object.

k

Order of neighborhood to be used in the kNN method.

distance

Bool flag for considering x and y as distance matrices or not. If distance = TRUE, x and y would be considered as distance matrices, otherwise, these arguments are treated as data and Euclidean distance would be implemented for the samples in x and y. Default: distance = FALSE.

num.permutations

The number of permutation replications. If num.permutations = 0, the function just returns the Mutual Information statistic. Default: num.permutations = 99.

seed

The random seed. Default: seed = 1.

Details

If two samples are passed to arguments x and y, the sample sizes (i.e. number of rows of the matrix or length of the vector) must agree. Moreover, data being passed to x and y must not contain missing or infinite values.

mi.test utilizes the Mutual Information statistics (see mi) to measure dependence and derive a p-value via replicating the random permutation num.permutations times.

Value

If num.permutations > 0, mi.test returns a htest class object containing the following components:

statistic

Mutual Information statistic.

p.value

The p-value for the test.

replicates

Permutation replications of the test statistic.

size

Sample size.

alternative

A character string describes the alternative hypothesis.

method

A character string indicates what type of test was performed.

data.name

Description of data.

If num.permutations = 0, mi.test returns a statistic value.

Examples

1
2
3
4
5
6
7
library(fastmit)
set.seed(1)
error <- runif(50, min = -0.3, max = 0.3)
x <- runif(50, 0, 4*pi)
y <- cos(x) + error
# plot(x, y)
res <- mi.test(x, y)

fastmit documentation built on March 26, 2020, 8:50 p.m.