From a5746dcc0e5a018548bf977f4ac61f0ad2a4dd2d Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 9 Dec 2020 19:12:38 +0100 Subject: Some test fixes --- test.log | 45 ++++++----------------------------- tests/testthat/print_sfo_saem_1.txt | 21 ++++++++++++++++ tests/testthat/print_sfo_saemix_1.txt | 23 ------------------ tests/testthat/test_mixed.R | 2 +- tests/testthat/test_plot.R | 6 ++--- 5 files changed, 32 insertions(+), 65 deletions(-) create mode 100644 tests/testthat/print_sfo_saem_1.txt delete mode 100644 tests/testthat/print_sfo_saemix_1.txt diff --git a/test.log b/test.log index f39791ae..6105128f 100644 --- a/test.log +++ b/test.log @@ -6,7 +6,7 @@ Testing mkin ✔ | 2 | Export dataset for reading into CAKE ✔ | 14 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [1.0 s] ✔ | 4 | Calculation of FOCUS chi2 error levels [0.5 s] -✔ | 7 | Fitting the SFORB model [3.6 s] +✔ | 7 | Fitting the SFORB model [3.5 s] ✔ | 5 | Analytical solutions for coupled models [3.2 s] ✔ | 5 | Calculation of Akaike weights ✔ | 14 | Confidence intervals and p-values [1.2 s] @@ -14,33 +14,7 @@ Testing mkin ✔ | 3 | Time step normalisation ✔ | 4 | Test fitting the decline of metabolites from their maximum [0.3 s] ✔ | 1 | Fitting the logistic model [0.2 s] -⠏ | 8 2 | Nonlinear mixed effects models -LL by is "-1333.17 (df=13)" - -LL by is "-1333.17 (df=13)" - -LL by is "-1336.30 (df=13)" - ✖ | 11 2 | Nonlinear mixed effects models [6.4 s] -──────────────────────────────────────────────────────────────────────────────── -ERROR (test_mixed.R:11:3): Parent only models can be fitted using nonlinear mixed effects models -Error: object 'sfo_saem_1' not found -Backtrace: - 1. base::summary(sfo_saem_1) test_mixed.R:11:2 - -FAILURE (test_mixed.R:91:3): Print methods work -Results have changed from known value recorded in 'print_sfo_saemix_1.txt'. - -old[6:11] vs new[6:13] - "Data:" - "264 observations of 1 variable(s) grouped in 15 datasets" - "" - "Likelihood computed by importance sampling" -+ " " -+ "LL by is \"-653.97 (df=6)\"" - " AIC BIC logLik" - " 1320 1324 -654" - "" -──────────────────────────────────────────────────────────────────────────────── +✔ | 31 | Nonlinear mixed effects models [27.5 s] ✔ | 2 | Test dataset classes mkinds and mkindsg ✔ | 1 | mkinfit features [0.3 s] ✔ | 12 | Special cases of mkinfit calls [0.8 s] @@ -48,21 +22,16 @@ old[6:11] vs new[6:13] ✔ | 3 | Model predictions with mkinpredict [0.4 s] ✔ | 16 | Evaluations according to 2015 NAFTA guidance [1.6 s] ✔ | 9 | Nonlinear mixed-effects models [7.8 s] -✖ | 15 1 | Plotting [1.9 s] -──────────────────────────────────────────────────────────────────────────────── -FAILURE (test_plot.R:39:3): Plotting mkinfit and mmkin objects is reproducible -Figures don't match: mixed-model-fit-for-nlme-object.svg - -──────────────────────────────────────────────────────────────────────────────── +✔ | 16 | Plotting [1.9 s] ✔ | 4 | Residuals extracted from mkinfit models -✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [1.6 s] +✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [1.5 s] ✔ | 4 | Summary [0.1 s] ✔ | 1 | Summaries of old mkinfit objects ✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [2.3 s] ✔ | 9 | Hypothesis tests [7.3 s] -✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.3 s] +✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.4 s] ══ Results ═════════════════════════════════════════════════════════════════════ -Duration: 48.1 s +Duration: 69.3 s -[ FAIL 3 | WARN 0 | SKIP 0 | PASS 183 ] +[ FAIL 0 | WARN 0 | SKIP 0 | PASS 204 ] diff --git a/tests/testthat/print_sfo_saem_1.txt b/tests/testthat/print_sfo_saem_1.txt new file mode 100644 index 00000000..d341e9e7 --- /dev/null +++ b/tests/testthat/print_sfo_saem_1.txt @@ -0,0 +1,21 @@ +Kinetic nonlinear mixed-effects model fit by SAEM +Structural model: +d_parent/dt = - k_parent * parent + +Data: +264 observations of 1 variable(s) grouped in 15 datasets + +Likelihood computed by importance sampling + AIC BIC logLik + 1320 1324 -654 + +Fitted parameters: + estimate lower upper +parent_0 1e+02 98.78 1e+02 +k_parent 4e-02 0.03 4e-02 +Var.parent_0 8e-01 -1.76 3e+00 +Var.k_parent 9e-02 0.03 2e-01 +a.1 9e-01 0.70 1e+00 +b.1 4e-02 0.03 4e-02 +SD.parent_0 9e-01 -0.57 2e+00 +SD.k_parent 3e-01 0.20 4e-01 diff --git a/tests/testthat/print_sfo_saemix_1.txt b/tests/testthat/print_sfo_saemix_1.txt deleted file mode 100644 index 9dd4f175..00000000 --- a/tests/testthat/print_sfo_saemix_1.txt +++ /dev/null @@ -1,23 +0,0 @@ -Kinetic nonlinear mixed-effects model fit by SAEM -Structural model: -d_parent/dt = - k_parent * parent - -Data: -264 observations of 1 variable(s) grouped in 15 datasets - -Likelihood computed by importance sampling - -LL by is "-653.97 (df=6)" - AIC BIC logLik - 1320 1324 -654 - -Fitted parameters: - estimate lower upper -parent_0 1e+02 98.78 1e+02 -k_parent 4e-02 0.03 4e-02 -Var.parent_0 8e-01 -1.76 3e+00 -Var.k_parent 9e-02 0.03 2e-01 -a.1 9e-01 0.70 1e+00 -b.1 4e-02 0.03 4e-02 -SD.parent_0 9e-01 -0.57 2e+00 -SD.k_parent 3e-01 0.20 4e-01 diff --git a/tests/testthat/test_mixed.R b/tests/testthat/test_mixed.R index 6fc6c2f0..7798be8a 100644 --- a/tests/testthat/test_mixed.R +++ b/tests/testthat/test_mixed.R @@ -88,7 +88,7 @@ test_that("Print methods work", { expect_known_output(print(fits, digits = 2), "print_mmkin_parent.txt") expect_known_output(print(mmkin_biphasic_mixed, digits = 2), "print_mmkin_biphasic_mixed.txt") expect_known_output(print(nlme_biphasic, digits = 1), "print_nlme_biphasic.txt") - expect_known_output(print(sfo_saemix_1, digits = 1), "print_sfo_saemix_1.txt") + expect_known_output(print(sfo_saem_1, digits = 1), "print_sfo_saem_1.txt") }) test_that("nlme results are reproducible", { diff --git a/tests/testthat/test_plot.R b/tests/testthat/test_plot.R index b0bf2c8f..22f4307f 100644 --- a/tests/testthat/test_plot.R +++ b/tests/testthat/test_plot.R @@ -35,14 +35,14 @@ test_that("Plotting mkinfit and mmkin objects is reproducible", { plot_biphasic_mmkin <- function() plot(f_uba_dfop_sfo_mixed) vdiffr::expect_doppelganger("mixed model fit for mmkin object", plot_biphasic_mmkin) - plot_biphasic_nlme <- function() plot(dfop_nlme_1) - vdiffr::expect_doppelganger("mixed model fit for nlme object", plot_biphasic_nlme) - plot_biphasic_saem_s <- function() plot(f_uba_dfop_sfo_saem) vdiffr::expect_doppelganger("mixed model fit for saem object with saemix transformations", plot_biphasic_saem_s) skip_on_travis() + plot_biphasic_nlme <- function() plot(dfop_nlme_1) + vdiffr::expect_doppelganger("mixed model fit for nlme object", plot_biphasic_nlme) + #plot_biphasic_mmkin <- function() plot(mixed(mmkin_biphasic)) # Biphasic fits with lots of data and fits have lots of potential for differences plot_biphasic_nlme <- function() plot(nlme_biphasic) -- cgit v1.2.1