diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2020-12-10 09:24:35 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2020-12-10 09:24:35 +0100 |
commit | c58c14078f6a30c22863b7b9730f4afc39db4577 (patch) | |
tree | 89b9f1f42aa1a97240e130b3e3d6ceed2399aa1c /tests/testthat | |
parent | b8b60ef92c605e862294fd29c51e20e31e0ded81 (diff) |
Add a test for saemix with deSolve
But skip the test as it takes too long to always run
Diffstat (limited to 'tests/testthat')
-rw-r--r-- | tests/testthat/setup_script.R | 7 | ||||
-rw-r--r-- | tests/testthat/test_mixed.R | 17 |
2 files changed, 16 insertions, 8 deletions
diff --git a/tests/testthat/setup_script.R b/tests/testthat/setup_script.R index 4a343bc5..cfdc9277 100644 --- a/tests/testthat/setup_script.R +++ b/tests/testthat/setup_script.R @@ -34,9 +34,10 @@ f_1_mkin_notrans <- mkinfit("SFO", FOCUS_2006_A, quiet = TRUE, # mmkin object of parent fits for tests models <- c("SFO", "FOMC", "DFOP", "HS") -fits <- mmkin(models, - list(FOCUS_A = FOCUS_2006_A, FOCUS_C = FOCUS_2006_C, FOCUS_D = FOCUS_2006_D), - quiet = TRUE, cores = n_cores) +fits <- suppressWarnings( # FOCUS A FOMC was, it seems, in testthat output + mmkin(models, + list(FOCUS_A = FOCUS_2006_A, FOCUS_C = FOCUS_2006_C, FOCUS_D = FOCUS_2006_D), + quiet = TRUE, cores = n_cores)) # One metabolite SFO_SFO <- mkinmod(parent = mkinsub("SFO", to = "m1"), diff --git a/tests/testthat/test_mixed.R b/tests/testthat/test_mixed.R index 7798be8a..05632c6f 100644 --- a/tests/testthat/test_mixed.R +++ b/tests/testthat/test_mixed.R @@ -122,17 +122,24 @@ test_that("saem results are reproducible for biphasic fits", { expect_known_output(print(test_summary, digits = 2), "summary_saem_biphasic_s.txt") dfop_sfo_pop <- as.numeric(dfop_sfo_pop) + no_k1 <- c(1, 2, 3, 5, 6) + no_k2 <- c(1, 2, 3, 4, 6) + ci_dfop_sfo_s_s <- summary(saem_biphasic_s)$confint_back expect_true(all(ci_dfop_sfo_s_s[, "lower"] < dfop_sfo_pop)) expect_true(all(ci_dfop_sfo_s_s[, "upper"] > dfop_sfo_pop)) - # The following does not work, as k1 and k2 are not fitted well + # k1 and k2 are not fitted well ci_dfop_sfo_s_m <- summary(saem_biphasic_m)$confint_back - # expect_true(all(ci_dfop_sfo_s_m[, "lower"] < dfop_sfo_pop)) - # expect_true(all(ci_dfop_sfo_s_m[, "upper"] > dfop_sfo_pop)) + expect_true(all(ci_dfop_sfo_s_m[no_k2, "lower"] < dfop_sfo_pop[no_k2])) + expect_true(all(ci_dfop_sfo_s_m[no_k1, "upper"] > dfop_sfo_pop[no_k1])) - # Somehow this does not work at the moment. But it took forever (~ 10 min) anyways... - #saem_biphasic_2 <- saem(mmkin_biphasic, solution_type = "deSolve", quiet = TRUE) + skip("Fitting with saemix takes around 10 minutes when using deSolve") + saem_biphasic_2 <- saem(mmkin_biphasic, solution_type = "deSolve", quiet = TRUE) + # As with the analytical solution, k1 and k2 are not fitted well + ci_dfop_sfo_s_d <- summary(saem_biphasic_2)$confint_back + expect_true(all(ci_dfop_sfo_s_d[no_k2, "lower"] < dfop_sfo_pop[no_k2])) + expect_true(all(ci_dfop_sfo_s_d[no_k1, "upper"] > dfop_sfo_pop[no_k1])) }) |