From a14237fc1580b09f8772cd3330b0a445785e48ac Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 18 Nov 2022 10:09:28 +0100 Subject: Round parameters with signif() before printing This will hopefully make the test pass on all relevant platforms. --- NEWS.md | 4 +++- log/build.log | 2 +- log/test.log | 20 ++++++++++---------- tests/testthat/print_dfop_saemix_1.txt | 8 ++++---- tests/testthat/test_mixed.R | 7 ++++++- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/NEWS.md b/NEWS.md index a72a0d13..245a3973 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,8 @@ # mkin 1.2.1 (unreleased) -- 'tests/testthat/setup_script.R': Excluded another ill-defined random effect for the DFOP fit with 'saem', in an attempt to avoid a platform dependence that surfaced on Fedora systems on the CRAN check farm. +- 'tests/testthat/setup_script.R': Excluded another ill-defined random effect for the DFOP fit with 'saem', in an attempt to avoid a platform dependence that surfaced on Fedora systems on the CRAN check farm + +- 'tests/testthat/test_mixed.R': Round parameters found by saemix to two significant digits before printing, to also help to avoid platform dependence of tests - 'R/saem.R': Fix a bug that prevented that 'error.ini' is passed to 'saemix_model', and set default to c(1, 1) to avoid changing test results diff --git a/log/build.log b/log/build.log index c4f9b8a2..6be01938 100644 --- a/log/build.log +++ b/log/build.log @@ -5,5 +5,5 @@ * creating vignettes ... OK * checking for LF line-endings in source and make files and shell scripts * checking for empty or unneeded directories -* building ‘mkin_1.2.0.tar.gz’ +* building ‘mkin_1.2.1.tar.gz’ diff --git a/log/test.log b/log/test.log index af8e52fd..87d24690 100644 --- a/log/test.log +++ b/log/test.log @@ -1,38 +1,38 @@ ℹ Testing mkin ✔ | F W S OK | Context ✔ | 5 | AIC calculation -✔ | 5 | Analytical solutions for coupled models [3.2s] +✔ | 5 | Analytical solutions for coupled models [3.3s] ✔ | 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 [31.4s] +✔ | 1 12 | Dimethenamid data from 2018 [31.5s] ──────────────────────────────────────────────────────────────────────────────── 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 [4.9s] +✔ | 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] -✔ | 10 | Batch fitting and diagnosing hierarchical kinetic models [23.9s] +✔ | 10 | Batch fitting and diagnosing hierarchical kinetic models [24.4s] ✔ | 1 12 | Nonlinear mixed-effects models [0.3s] ──────────────────────────────────────────────────────────────────────────────── -Skip ('test_mixed.R:74'): saemix results are reproducible for biphasic fits +Skip ('test_mixed.R:79'): 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.5s] ✔ | 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 [37.0s] +✔ | 3 | Model predictions with mkinpredict [0.3s] +✔ | 9 | Multistart method for saem.mmkin models [36.2s] ✔ | 16 | Evaluations according to 2015 NAFTA guidance [2.5s] ✔ | 9 | Nonlinear mixed-effects models with nlme [8.8s] -✔ | 16 | Plotting [10.1s] +✔ | 16 | Plotting [10.0s] ✔ | 4 | Residuals extracted from mkinfit models -✔ | 1 36 | saemix parent models [66.0s] +✔ | 1 36 | saemix parent models [65.8s] ──────────────────────────────────────────────────────────────────────────────── 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 @@ -47,7 +47,7 @@ Reason: This still takes almost 2.5 minutes although we do not solve ODEs ✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.2s] ══ Results ═════════════════════════════════════════════════════════════════════ -Duration: 211.3 s +Duration: 210.4 s ── Skipped tests ────────────────────────────────────────────────────────────── • Fitting this ODE model with saemix takes about 15 minutes on my system (1) diff --git a/tests/testthat/print_dfop_saemix_1.txt b/tests/testthat/print_dfop_saemix_1.txt index bdc40065..1d399a52 100644 --- a/tests/testthat/print_dfop_saemix_1.txt +++ b/tests/testthat/print_dfop_saemix_1.txt @@ -13,11 +13,11 @@ Likelihood computed by importance sampling Fitted parameters: estimate lower upper -parent_0 99.92 98.77 101.06 -log_k1 -2.72 -2.95 -2.50 -log_k2 -4.14 -4.27 -4.01 +parent_0 100.00 99.00 100.00 +log_k1 -2.70 -3.00 -2.50 +log_k2 -4.10 -4.30 -4.00 g_qlogis -0.35 -0.53 -0.16 -a.1 0.92 0.68 1.16 +a.1 0.92 0.68 1.20 b.1 0.05 0.04 0.06 SD.log_k1 0.37 0.23 0.51 SD.log_k2 0.23 0.14 0.31 diff --git a/tests/testthat/test_mixed.R b/tests/testthat/test_mixed.R index 646b6110..2d53c6dd 100644 --- a/tests/testthat/test_mixed.R +++ b/tests/testthat/test_mixed.R @@ -11,7 +11,12 @@ test_that("Print methods work", { expect_known_output(print(mixed(mmkin_sfo_1), digits = 2), "print_mmkin_sfo_1_mixed.txt") expect_known_output(print(dfop_nlme_1, digits = 1), "print_dfop_nlme_1.txt") - expect_known_output(print(dfop_saemix_1, digits = 1), "print_dfop_saemix_1.txt") + # In order to address the platform dependence of the results, we round to two + # significant digits before printing + dfop_saemix_1_print <- dfop_saemix_1 + dfop_saemix_1_print$so@results@conf.int[c("estimate", "lower", "upper")] <- + signif(dfop_saemix_1_print$so@results@conf.int[c("estimate", "lower", "upper")], 2) + expect_known_output(print(dfop_saemix_1_print, digits = 1), "print_dfop_saemix_1.txt") }) test_that("nlme results are reproducible to some degree", { -- cgit v1.2.1