aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2022-11-18 22:11:02 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2022-11-18 22:11:02 +0100
commit5ec8e1bad1aa7d79ee9c19bdd50be07f81a14278 (patch)
tree26aaa01d53bac4e2b04de6d04385e34d3a246606
parentb6b7e387261e5483f1bdfafaaa975e2f24c6567c (diff)
Move two saem fits from setup script to skipped tests
Save winbuilder/CRAN check time...
-rw-r--r--log/test.log44
-rw-r--r--tests/testthat/_snaps/multistart/mixed-model-fit-for-saem-object-with-mkin-transformations.svg (renamed from tests/testthat/_snaps/plot/mixed-model-fit-for-saem-object-with-mkin-transformations.svg)0
-rw-r--r--tests/testthat/setup_script.R3
-rw-r--r--tests/testthat/test_mixed.R8
-rw-r--r--tests/testthat/test_multistart.R15
-rw-r--r--tests/testthat/test_plot.R4
6 files changed, 40 insertions, 34 deletions
diff --git a/log/test.log b/log/test.log
index 8fdaec48..897bf896 100644
--- a/log/test.log
+++ b/log/test.log
@@ -1,53 +1,53 @@
ℹ Testing mkin
✔ | F W S OK | Context
✔ | 5 | AIC calculation
-✔ | 5 | Analytical solutions for coupled models [3.4s]
+✔ | 5 | Analytical solutions for coupled models [3.5s]
✔ | 5 | Calculation of Akaike weights
✔ | 3 | Export dataset for reading into CAKE
✔ | 12 | Confidence intervals and p-values [1.2s]
-✔ | 1 12 | Dimethenamid data from 2018 [34.0s]
+✔ | 1 12 | Dimethenamid data from 2018 [33.2s]
────────────────────────────────────────────────────────────────────────────────
Skip ('test_dmta.R:98'): Different backends get consistent results for SFO-SFO3+, dimethenamid data
Reason: Fitting this ODE model with saemix takes about 15 minutes on my system
────────────────────────────────────────────────────────────────────────────────
-✔ | 14 | Error model fitting [5.4s]
+✔ | 14 | Error model fitting [5.0s]
✔ | 5 | Time step normalisation
✔ | 4 | Calculation of FOCUS chi2 error levels [0.6s]
-✔ | 14 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [0.9s]
-✔ | 4 | Test fitting the decline of metabolites from their maximum [0.4s]
-✔ | 1 | Fitting the logistic model [0.3s]
-✔ | 10 | Batch fitting and diagnosing hierarchical kinetic models [25.8s]
-✔ | 1 13 | Nonlinear mixed-effects models [0.4s]
+✔ | 14 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [0.8s]
+✔ | 4 | Test fitting the decline of metabolites from their maximum [0.3s]
+✔ | 1 | Fitting the logistic model [0.2s]
+✔ | 10 | Batch fitting and diagnosing hierarchical kinetic models [24.7s]
+✔ | 1 11 | Nonlinear mixed-effects models [13.1s]
────────────────────────────────────────────────────────────────────────────────
-Skip ('test_mixed.R:79'): saemix results are reproducible for biphasic fits
+Skip ('test_mixed.R:77'): saemix results are reproducible for biphasic fits
Reason: Fitting with saemix takes around 10 minutes when using deSolve
────────────────────────────────────────────────────────────────────────────────
✔ | 3 | Test dataset classes mkinds and mkindsg
-✔ | 10 | Special cases of mkinfit calls [0.6s]
+✔ | 10 | Special cases of mkinfit calls [0.4s]
✔ | 3 | mkinfit features [0.7s]
✔ | 8 | mkinmod model generation and printing [0.2s]
-✔ | 3 | Model predictions with mkinpredict [0.4s]
-✔ | 9 | Multistart method for saem.mmkin models [38.2s]
-✔ | 16 | Evaluations according to 2015 NAFTA guidance [2.4s]
-✔ | 9 | Nonlinear mixed-effects models with nlme [9.2s]
-✔ | 16 | Plotting [10.5s]
+✔ | 3 | Model predictions with mkinpredict [0.3s]
+✔ | 12 | Multistart method for saem.mmkin models [49.5s]
+✔ | 16 | Evaluations according to 2015 NAFTA guidance [2.3s]
+✔ | 9 | Nonlinear mixed-effects models with nlme [8.8s]
+✔ | 15 | Plotting [10.3s]
✔ | 4 | Residuals extracted from mkinfit models
-✔ | 1 36 | saemix parent models [75.0s]
+✔ | 1 36 | saemix parent models [72.5s]
────────────────────────────────────────────────────────────────────────────────
Skip ('test_saemix_parent.R:143'): We can also use mkin solution methods for saem
Reason: This still takes almost 2.5 minutes although we do not solve ODEs
────────────────────────────────────────────────────────────────────────────────
-✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [1.6s]
+✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [1.4s]
✔ | 11 | Processing of residue series
-✔ | 10 | Fitting the SFORB model [4.0s]
+✔ | 10 | Fitting the SFORB model [3.8s]
✔ | 1 | Summaries of old mkinfit objects
✔ | 5 | Summary [0.2s]
-✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [2.5s]
-✔ | 9 | Hypothesis tests [9.0s]
-✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.3s]
+✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [2.2s]
+✔ | 9 | Hypothesis tests [8.2s]
+✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.2s]
══ Results ═════════════════════════════════════════════════════════════════════
-Duration: 229.5 s
+Duration: 246.1 s
── Skipped tests ──────────────────────────────────────────────────────────────
• Fitting this ODE model with saemix takes about 15 minutes on my system (1)
diff --git a/tests/testthat/_snaps/plot/mixed-model-fit-for-saem-object-with-mkin-transformations.svg b/tests/testthat/_snaps/multistart/mixed-model-fit-for-saem-object-with-mkin-transformations.svg
index 69fa6a4d..69fa6a4d 100644
--- a/tests/testthat/_snaps/plot/mixed-model-fit-for-saem-object-with-mkin-transformations.svg
+++ b/tests/testthat/_snaps/multistart/mixed-model-fit-for-saem-object-with-mkin-transformations.svg
diff --git a/tests/testthat/setup_script.R b/tests/testthat/setup_script.R
index 2448886d..4e2f76ab 100644
--- a/tests/testthat/setup_script.R
+++ b/tests/testthat/setup_script.R
@@ -109,7 +109,4 @@ sfo_saem_1_reduced <- update(sfo_saem_1, no_random_effect = "parent_0")
dfop_saem_1 <- saem(mmkin_dfop_1, quiet = TRUE, transformations = "mkin",
no_random_effect = c("parent_0", "g_qlogis"))
-saem_dfop_sfo_m <- saem(mmkin_dfop_sfo, transformations = "mkin", quiet = TRUE)
-saem_dfop_sfo_s <- saem(mmkin_dfop_sfo, transformations = "saemix", quiet = TRUE)
-
parallel::stopCluster(cl)
diff --git a/tests/testthat/test_mixed.R b/tests/testthat/test_mixed.R
index ab8dfc27..8c257738 100644
--- a/tests/testthat/test_mixed.R
+++ b/tests/testthat/test_mixed.R
@@ -46,6 +46,9 @@ test_that("nlme results are reproducible to some degree", {
test_that("saemix results are reproducible for biphasic fits", {
+ skip_on_cran()
+ saem_dfop_sfo_s <- saem(mmkin_dfop_sfo, transformations = "saemix", quiet = TRUE)
+
test_summary <- summary(saem_dfop_sfo_s)
test_summary$saemixversion <- "Dummy 0.0 for testing"
test_summary$mkinversion <- "Dummy 0.0 for testing"
@@ -65,11 +68,6 @@ test_that("saemix results are reproducible for biphasic fits", {
expect_true(all(ci_dfop_sfo_s_s[, "lower"] < dfop_sfo_pop))
expect_true(all(ci_dfop_sfo_s_s[, "upper"] > dfop_sfo_pop))
- # k2 is not fitted well
- ci_dfop_sfo_s_m <- summary(saem_dfop_sfo_m)$confint_back
- 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]))
-
# I tried to only do few iterations in routine tests as this is so slow
# but then deSolve fails at some point (presumably at the switch between
# the two types of iterations)
diff --git a/tests/testthat/test_multistart.R b/tests/testthat/test_multistart.R
index 3a511e06..91ef71f0 100644
--- a/tests/testthat/test_multistart.R
+++ b/tests/testthat/test_multistart.R
@@ -4,6 +4,7 @@ test_that("multistart works for saem.mmkin models", {
skip_on_cran() # Save CRAN time
set.seed(123456)
saem_sfo_s_multi <- multistart(sfo_saem_1_reduced, n = 8, cores = n_cores)
+
anova_sfo <- anova(sfo_saem_1,
sfo_saem_1_reduced,
best(saem_sfo_s_multi),
@@ -13,6 +14,17 @@ test_that("multistart works for saem.mmkin models", {
expect_equal(round(anova_sfo, 1)["best(saem_sfo_s_multi)", "AIC"], 1302.2)
expect_true(anova_sfo[3, "Pr(>Chisq)"] > 0.2) # Local: 1, win-builder: 0.4
+ saem_dfop_sfo_m <- saem(mmkin_dfop_sfo, transformations = "mkin", quiet = TRUE)
+ dfop_sfo_pop <- attr(ds_dfop_sfo, "pop")
+
+ # k2 is not fitted well (compare saem_dfop_sfo_s in test_mixed.R)
+ ci_dfop_sfo_s_m <- summary(saem_dfop_sfo_m)$confint_back
+ no_k1 <- c(1, 2, 3, 5, 6)
+ no_k2 <- c(1, 2, 3, 4, 6)
+ 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]))
+
+
set.seed(123456)
saem_dfop_sfo_m_multi <- multistart(saem_dfop_sfo_m, n = 8,
cores = n_cores)
@@ -28,6 +40,9 @@ test_that("multistart works for saem.mmkin models", {
tolerance = 1e-4)
skip_on_travis() # Plots are platform dependent
+ plot_dfop_sfo_saem_m <- function() plot(saem_dfop_sfo_m)
+ vdiffr::expect_doppelganger("mixed model fit for saem object with mkin transformations", plot_dfop_sfo_saem_m)
+
llhist_sfo <- function() llhist(saem_sfo_s_multi)
parplot_sfo <- function() parplot(saem_sfo_s_multi, ylim = c(0.5, 2))
vdiffr::expect_doppelganger("llhist for sfo fit", llhist_sfo)
diff --git a/tests/testthat/test_plot.R b/tests/testthat/test_plot.R
index 01b0c1ee..f5da5982 100644
--- a/tests/testthat/test_plot.R
+++ b/tests/testthat/test_plot.R
@@ -41,7 +41,6 @@ test_that("Plotting mkinfit, mmkin and mixed model objects is reproducible", {
f_uba_mmkin <- mmkin(list("DFOP-SFO" = dfop_sfo_uba),
ds_uba, quiet = TRUE, cores = n_cores)
f_uba_dfop_sfo_mixed <- mixed(f_uba_mmkin["DFOP-SFO", ])
-
f_uba_dfop_sfo_saem <- saem(f_uba_mmkin["DFOP-SFO", ], quiet = TRUE, transformations = "saemix")
plot_dfop_sfo_mmkin <- function() plot(f_uba_dfop_sfo_mixed, pop_curve = TRUE)
@@ -59,9 +58,6 @@ test_that("Plotting mkinfit, mmkin and mixed model objects is reproducible", {
# Biphasic fits with lots of data and fits have lots of potential for differences
plot_dfop_sfo_nlme <- function() plot(nlme_dfop_sfo)
#plot_dfop_sfo_saem_s <- function() plot(saem_dfop_sfo_s)
- plot_dfop_sfo_saem_m <- function() plot(saem_dfop_sfo_m)
-
- vdiffr::expect_doppelganger("mixed model fit for saem object with mkin transformations", plot_dfop_sfo_saem_m)
# different results when working with eigenvalues
plot_errmod_fit_D_obs_eigen <- function() plot_err(fit_D_obs_eigen, sep_obs = FALSE)

Contact - Imprint