tests/testthat/test-sim-pants-mediation.R

context("sim pants w/ & w/o mediation")

# increase alpha to get more hits
# sd(X)= w/ alpha=0.2 = sqrt(N*0.2*0.8/N) = 0.4
# test-pants, test_pants-mediation, & test-pants-core test sim w/ kernel; here we test w/o kernel

test_that("sim_pants contrasts size and power", {
  sp <- sim_pants(Gmat=G, phenotype=pheno, alpha=0.2, nperm=5, nsim=5)[1,]
  expect_lte(sp[1], 0.28)
  expect_gte(sp[2], 0.2)
})

test_that("sim_pants_mediation size and power", {
  sp <- sim_pants_mediation(Gmat=G, exposure=pheno.num, alpha=0.2, nperm=10, nsim=5)[1,]
  expect_lte(sp[1], 0.28)
  expect_gte(sp[2], 0.28)
})
jdreyf/PANTS documentation built on July 18, 2019, 10:12 a.m.