tests/testthat/test_il_correl.R

test_that("IL_correl()", {
  set.seed(1)
  data("Tarragona", package = "sdcMicro")
  res1 <- addNoise(obj = Tarragona, variables = colnames(Tarragona), noise = 100)
  
  expect_equivalent(as.numeric(IL_correl(x = as.data.frame(res1$x), xm = as.data.frame(res1$x))), 0)

  erg1 <- IL_correl(x = as.data.frame(res1$x), xm = as.data.frame(res1$xm))
  expect_equivalent(as.numeric(erg1), 0.462347410776)
  

  res2 <- addNoise(obj = Tarragona, variables = colnames(Tarragona), noise = 25) 
  erg2 <- IL_correl(x = as.data.frame(res2$x), xm = as.data.frame(res2$xm))
  expect_equivalent(as.numeric(erg2), 0.229297771144)
})

Try the sdcMicro package in your browser

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

sdcMicro documentation built on Sept. 27, 2023, 5:07 p.m.