tests/testthat/test_mi.R

library(testthat)
library(fastmit)

context("mi and mi.test function")
skip_on_cran()

test_that("Error if computation result for mutual information is wrong!", {
  target_value <- 0.3856349
  names(target_value) <- "MI"
  expect_equal(mi(1:10, 1:10), target_value)
  expect_equal(mi.test(1:10, 1:10, num.permutations = 0), target_value)
  dx <- dist(1:10)
  dy <- dist(1:10)
  expect_equal(mi(dx, dy, distance = TRUE), target_value)
  expect_equal(mi.test(dx, dy, distance = TRUE, num.permutations = 0), target_value)
})

Try the fastmit package in your browser

Any scripts or data that you put into this service are public.

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