aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/testthat/print_mmkin_biphasic_mixed.txt26
-rw-r--r--tests/testthat/print_mmkin_sfo_1_mixed.txt19
-rw-r--r--tests/testthat/setup_script.R1
-rw-r--r--tests/testthat/test_mixed.R2
-rw-r--r--tests/testthat/test_saemix_parent.R6
5 files changed, 24 insertions, 30 deletions
diff --git a/tests/testthat/print_mmkin_biphasic_mixed.txt b/tests/testthat/print_mmkin_biphasic_mixed.txt
deleted file mode 100644
index 712c813a..00000000
--- a/tests/testthat/print_mmkin_biphasic_mixed.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-Kinetic model fitted by nonlinear regression to each dataset
-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:
-507 observations of 2 variable(s) grouped in 15 datasets
-
-<mmkin> object
-Status of individual fits:
-
- dataset
-model 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
- DFOP-SFO OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK
-
-OK: No warnings
-
-Mean fitted parameters:
- parent_0 log_k_m1 f_parent_qlogis log_k1 log_k2
- 100.648 -5.380 -0.093 -2.736 -4.534
- g_qlogis
- -0.142
diff --git a/tests/testthat/print_mmkin_sfo_1_mixed.txt b/tests/testthat/print_mmkin_sfo_1_mixed.txt
new file mode 100644
index 00000000..33e5bf5c
--- /dev/null
+++ b/tests/testthat/print_mmkin_sfo_1_mixed.txt
@@ -0,0 +1,19 @@
+Kinetic model fitted by nonlinear regression to each dataset
+Structural model:
+d_parent/dt = - k_parent * parent
+
+Data:
+262 observations of 1 variable(s) grouped in 15 datasets
+
+<mmkin> object
+Status of individual fits:
+
+ dataset
+model 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ SFO OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK
+
+OK: No warnings
+
+Mean fitted parameters:
+ parent_0 log_k_parent
+ 99.9 -3.3
diff --git a/tests/testthat/setup_script.R b/tests/testthat/setup_script.R
index ca0ca313..ec96fbc2 100644
--- a/tests/testthat/setup_script.R
+++ b/tests/testthat/setup_script.R
@@ -187,7 +187,6 @@ mmkin_sfo_1 <- mmkin("SFO", ds_sfo, quiet = TRUE, error_model = "tc", cores = n_
mmkin_dfop_1 <- mmkin("DFOP", ds_dfop, quiet = TRUE, cores = n_cores)
mmkin_biphasic <- mmkin(list("DFOP-SFO" = DFOP_SFO), ds_biphasic, quiet = TRUE, cores = n_cores,
error_model = "tc")
-mmkin_biphasic_mixed <- mixed(mmkin_biphasic)
# nlme
dfop_nlme_1 <- nlme(mmkin_dfop_1)
diff --git a/tests/testthat/test_mixed.R b/tests/testthat/test_mixed.R
index 798dd01f..ae8743af 100644
--- a/tests/testthat/test_mixed.R
+++ b/tests/testthat/test_mixed.R
@@ -2,7 +2,7 @@ context("Nonlinear mixed-effects models")
test_that("Print methods work", {
expect_known_output(print(fits[, 2:3], digits = 2), "print_mmkin_parent.txt")
- expect_known_output(print(mmkin_biphasic_mixed, digits = 2), "print_mmkin_biphasic_mixed.txt")
+ 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(sfo_saem_1, digits = 1), "print_sfo_saem_1.txt")
diff --git a/tests/testthat/test_saemix_parent.R b/tests/testthat/test_saemix_parent.R
index 2f05c175..8beceba9 100644
--- a/tests/testthat/test_saemix_parent.R
+++ b/tests/testthat/test_saemix_parent.R
@@ -1,3 +1,5 @@
+context("saemix parent models")
+
test_that("Parent fits using saemix are correctly implemented", {
expect_error(saem(fits), "Only row objects")
@@ -63,9 +65,9 @@ test_that("Parent fits using saemix are correctly implemented", {
expect_true(all(rel_diff_mmkin[c("parent_0", "k1")] < 0.20))
expect_true(all(rel_diff_mmkin_tested[c("parent_0", "k1", "k2")] < 0.20))
- # We get < 15% deviations with transformations made in mkin
+ # We get < 20% deviations with transformations made in mkin
rel_diff_1 <- (s_dfop_s1$confint_back[, "est."] - dfop_pop) / dfop_pop
- expect_true(all(rel_diff_1 < 0.15))
+ expect_true(all(rel_diff_1 < 0.20))
# We get < 20% deviations with transformations made in saemix
rel_diff_2 <- (s_dfop_s2$confint_back[, "est."] - dfop_pop) / dfop_pop

Contact - Imprint