aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-12-09 10:05:00 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2020-12-09 10:05:00 +0100
commit107ddb89a4a6e0e15d9f82eafcf9eebecf4904ba (patch)
tree964c72141c0376f44ccd81ca5c77fc157d7eff69
parentf33ce936323d9afc884f9254fb57d19744cadf75 (diff)
Make tests more robust, remove two redundant ones
-rw-r--r--tests/testthat/print_saem_biphasic_s.txt37
-rw-r--r--tests/testthat/print_sfo_saemix_1.txt21
-rw-r--r--tests/testthat/test_plot.R6
-rw-r--r--tests/testthat/test_saem.R2
4 files changed, 22 insertions, 44 deletions
diff --git a/tests/testthat/print_saem_biphasic_s.txt b/tests/testthat/print_saem_biphasic_s.txt
deleted file mode 100644
index 3c07b715..00000000
--- a/tests/testthat/print_saem_biphasic_s.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-Kinetic nonlinear mixed-effects model fit by SAEM
-Structural model:
-d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
- time)) / (g * exp(-k1 * time) + (1 - g) * exp(-k2 * time)))
- * parent
-d_m1/dt = + f_parent_to_m1 * ((k1 * g * exp(-k1 * time) + k2 * (1 - g)
- * exp(-k2 * time)) / (g * exp(-k1 * time) + (1 - g) *
- exp(-k2 * time))) * parent - k_m1 * m1
-
-Data:
-509 observations of 2 variable(s) grouped in 15 datasets
-
-Likelihood computed by importance sampling
- AIC BIC logLik
- 2692 2702 -1333
-
-Fitted parameters:
- estimate lower upper
-parent_0 1e+02 99.303 1e+02
-k_m1 2e-03 0.002 3e-03
-f_parent_to_m1 5e-01 0.448 5e-01
-k1 4e-02 0.024 6e-02
-k2 2e-02 0.009 2e-02
-g 5e-01 0.381 6e-01
-Var.parent_0 2e+00 -0.551 4e+00
-Var.k_m1 2e-02 -0.151 2e-01
-Var.f_parent_to_m1 8e-02 0.018 1e-01
-Var.k1 5e-01 0.095 9e-01
-Var.k2 6e-01 0.125 1e+00
-Var.g 7e-02 -0.245 4e-01
-a.1 3e+00 2.569 3e+00
-SD.parent_0 1e+00 0.390 2e+00
-SD.k_m1 1e-01 -0.478 8e-01
-SD.f_parent_to_m1 3e-01 0.175 4e-01
-SD.k1 7e-01 0.422 1e+00
-SD.k2 8e-01 0.471 1e+00
-SD.g 3e-01 -0.326 9e-01
diff --git a/tests/testthat/print_sfo_saemix_1.txt b/tests/testthat/print_sfo_saemix_1.txt
new file mode 100644
index 00000000..d341e9e7
--- /dev/null
+++ b/tests/testthat/print_sfo_saemix_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/test_plot.R b/tests/testthat/test_plot.R
index 4d815d33..4b830fe4 100644
--- a/tests/testthat/test_plot.R
+++ b/tests/testthat/test_plot.R
@@ -32,12 +32,6 @@ test_that("Plotting mkinfit and mmkin objects is reproducible", {
plot_err_sfo_sfo <- function() plot_err(f_sfo_sfo_desolve)
vdiffr::expect_doppelganger("plot_err for FOCUS D", plot_err_sfo_sfo)
- plot_errmod_fit_tc_1 <- function() plot_err(fit_tc_1, sep_obs = FALSE)
- vdiffr::expect_doppelganger("plot_errmod with SFO_lin_a_tc", plot_errmod_fit_tc_1)
-
- plot_errmod_fit_obs_1 <- function() plot_err(fit_obs_1, sep_obs = FALSE)
- vdiffr::expect_doppelganger("plot_errmod with SFO_lin_a_obs", plot_errmod_fit_obs_1)
-
skip_on_travis()
# Biphasic fits with lots of data and fits have lots of potential for differences
diff --git a/tests/testthat/test_saem.R b/tests/testthat/test_saem.R
index 37456ed4..869ca120 100644
--- a/tests/testthat/test_saem.R
+++ b/tests/testthat/test_saem.R
@@ -102,7 +102,7 @@ test_that("Parent only models can be fitted with saemix", {
test_that("Simple models with metabolite can be fitted with saemix", {
- expect_known_output(print(saem_biphasic_s, digits = 1), "print_saem_biphasic_s.txt")
+ expect_known_output(print(sfo_saemix_1, digits = 1), "print_sfo_saemix_1.txt")
test_summary <- summary(saem_biphasic_s)
test_summary$saemixversion <- "Dummy 0.0 for testing"

Contact - Imprint