tests/testthat/test-theta_t.R

pacman::p_load("testthat","popgen.stats")

context("Theta_t function")

#6 pairwise diff

# test_that("Computed correctly", {
#   set.seed(2019)
#   seq <-matrix(sample(0:1, size = 15, replace = TRUE), nc = 3)
#   #8 pairwise diff, 3 pairs
#   test<-theta_t(seq)
#   expect_equal(test,6/3)
#
#   set.seed(2019)
#   seq <-matrix(sample(0:1, size = 16, replace = TRUE), nc = 4)
#   test<-theta_t(seq)
#   #10 pairwise difference, 6 pairs
#   expect_equal(test ,10/6)
#
#   set.seed(2019)
#   seq  <- matrix(sample(0:1, size = 100, replace = TRUE), nc = 4)
#   y  <- sum(as.matrix((dist(t(seq), method = "manhattan"))))/2/choose(4, 2)
#   expect_equal(theta_t(seq),y)
# })
deponent-verb/popgen.stats documentation built on Nov. 4, 2019, 10:26 a.m.