From 6b910647d22e54a8c0b9c7f837af8dce150d5ee2 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 26 Oct 2022 01:17:30 +0200 Subject: Try to make multistart (more) reproducible --- log/test.log | 18 +- .../multistart/llhist-for-biphasic-saemix-fit.svg | 42 ++-- .../multistart/parhist-for-biphasic-saemix-fit.svg | 239 ++++++++++----------- tests/testthat/test_multistart.R | 1 + 4 files changed, 148 insertions(+), 152 deletions(-) diff --git a/log/test.log b/log/test.log index 3de5a60a..4515f383 100644 --- a/log/test.log +++ b/log/test.log @@ -5,18 +5,18 @@ ✔ | 5 | Calculation of Akaike weights ✔ | 3 | Export dataset for reading into CAKE ✔ | 12 | Confidence intervals and p-values [1.0s] -✔ | 1 12 | Dimethenamid data from 2018 [33.0s] +✔ | 1 12 | Dimethenamid data from 2018 [32.3s] ──────────────────────────────────────────────────────────────────────────────── Skip (test_dmta.R:98:3): 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.1s] +✔ | 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.8s] ✔ | 4 | Test fitting the decline of metabolites from their maximum [0.4s] ✔ | 1 | Fitting the logistic model [0.2s] -✔ | 7 | Batch fitting and diagnosing hierarchical kinetic models [14.9s] +✔ | 7 | Batch fitting and diagnosing hierarchical kinetic models [14.3s] ✔ | 1 12 | Nonlinear mixed-effects models [0.3s] ──────────────────────────────────────────────────────────────────────────────── Skip (test_mixed.R:74:3): saemix results are reproducible for biphasic fits @@ -27,12 +27,12 @@ Reason: Fitting with saemix takes around 10 minutes when using deSolve ✔ | 3 | mkinfit features [0.7s] ✔ | 8 | mkinmod model generation and printing [0.2s] ✔ | 3 | Model predictions with mkinpredict [0.3s] -✔ | 3 | Multistart method for saem.mmkin models [19.1s] -✔ | 16 | Evaluations according to 2015 NAFTA guidance [2.0s] +✔ | 3 | Multistart method for saem.mmkin models [18.4s] +✔ | 16 | Evaluations according to 2015 NAFTA guidance [1.8s] ✔ | 9 | Nonlinear mixed-effects models with nlme [8.5s] -✔ | 16 | Plotting [10.6s] +✔ | 16 | Plotting [10.2s] ✔ | 4 | Residuals extracted from mkinfit models -✔ | 1 35 | saemix parent models [71.6s] +✔ | 1 35 | saemix parent models [72.5s] ──────────────────────────────────────────────────────────────────────────────── Skip (test_saemix_parent.R:143:3): We can also use mkin solution methods for saem Reason: This still takes almost 2.5 minutes although we do not solve ODEs @@ -43,11 +43,11 @@ Reason: This still takes almost 2.5 minutes although we do not solve ODEs ✔ | 1 | Summaries of old mkinfit objects ✔ | 5 | Summary [0.2s] ✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [2.2s] -✔ | 9 | Hypothesis tests [8.2s] +✔ | 9 | Hypothesis tests [8.0s] ✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.2s] ══ Results ═════════════════════════════════════════════════════════════════════ -Duration: 191.7 s +Duration: 189.5 s ── Skipped tests ────────────────────────────────────────────────────────────── • Fitting this ODE model with saemix takes about 15 minutes on my system (1) diff --git a/tests/testthat/_snaps/multistart/llhist-for-biphasic-saemix-fit.svg b/tests/testthat/_snaps/multistart/llhist-for-biphasic-saemix-fit.svg index 154eb60d..4767e229 100644 --- a/tests/testthat/_snaps/multistart/llhist-for-biphasic-saemix-fit.svg +++ b/tests/testthat/_snaps/multistart/llhist-for-biphasic-saemix-fit.svg @@ -19,26 +19,24 @@ Frequency of log likelihoods - - - - - - - --1190 --1185 --1180 --1175 --1170 --1165 + + + + + +-1190 +-1180 +-1170 +-1160 - + + 0 -1 -2 +1 +2 +3 @@ -46,13 +44,11 @@ - - - - - - - + + + + + original log likelihood diff --git a/tests/testthat/_snaps/multistart/parhist-for-biphasic-saemix-fit.svg b/tests/testthat/_snaps/multistart/parhist-for-biphasic-saemix-fit.svg index aa2bc3d4..75519b07 100644 --- a/tests/testthat/_snaps/multistart/parhist-for-biphasic-saemix-fit.svg +++ b/tests/testthat/_snaps/multistart/parhist-for-biphasic-saemix-fit.svg @@ -25,106 +25,105 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -164,26 +163,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/test_multistart.R b/tests/testthat/test_multistart.R index e0b1ecd7..8408413f 100644 --- a/tests/testthat/test_multistart.R +++ b/tests/testthat/test_multistart.R @@ -1,6 +1,7 @@ context("Multistart method for saem.mmkin models") test_that("multistart works for saem.mmkin models", { + set.seed(123456) saem_biphasic_m_multi <- multistart(saem_biphasic_m, n = 8, cores = n_cores) expect_known_output(print(saem_biphasic_m_multi), -- cgit v1.2.1