aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testthat')
-rw-r--r--tests/testthat/print_mmkin_biphasic_mixed.txt26
-rw-r--r--tests/testthat/setup_script.R1
-rw-r--r--tests/testthat/test_saem.R7
3 files changed, 32 insertions, 2 deletions
diff --git a/tests/testthat/print_mmkin_biphasic_mixed.txt b/tests/testthat/print_mmkin_biphasic_mixed.txt
new file mode 100644
index 00000000..3d92b120
--- /dev/null
+++ b/tests/testthat/print_mmkin_biphasic_mixed.txt
@@ -0,0 +1,26 @@
+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:
+509 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.700 -6.299 -0.078 -3.094 -3.954
+ g_qlogis
+ 0.027
diff --git a/tests/testthat/setup_script.R b/tests/testthat/setup_script.R
index be4e4658..81f9248d 100644
--- a/tests/testthat/setup_script.R
+++ b/tests/testthat/setup_script.R
@@ -154,6 +154,7 @@ ds_biphasic <- lapply(ds_biphasic_mean, function(ds) {
mmkin_sfo_1 <- mmkin("SFO", ds_sfo, quiet = TRUE, error_model = "tc")
sfo_saemix_1 <- saem(mmkin_sfo_1, quiet = TRUE, transformations = "saemix")
mmkin_biphasic <- mmkin(list("DFOP-SFO" = DFOP_SFO), ds_biphasic, quiet = TRUE)
+mmkin_biphasic_mixed <- mixed(mmkin_biphasic)
nlme_biphasic <- nlme(mmkin_biphasic)
saem_biphasic_m <- saem(mmkin_biphasic, transformations = "mkin", quiet = TRUE)
saem_biphasic_s <- saem(mmkin_biphasic, transformations = "saemix", quiet = TRUE)
diff --git a/tests/testthat/test_saem.R b/tests/testthat/test_saem.R
index 869ca120..aa32d0b5 100644
--- a/tests/testthat/test_saem.R
+++ b/tests/testthat/test_saem.R
@@ -100,9 +100,12 @@ test_that("Parent only models can be fitted with saemix", {
expect_true(all(rel_diff_2 < 0.08))
})
-test_that("Simple models with metabolite can be fitted with saemix", {
-
+test_that("Print methods work", {
expect_known_output(print(sfo_saemix_1, digits = 1), "print_sfo_saemix_1.txt")
+ expect_known_output(print(mmkin_biphasic_mixed, digits = 2), "print_mmkin_biphasic_mixed.txt")
+})
+
+test_that("Saemix results are reproducible", {
test_summary <- summary(saem_biphasic_s)
test_summary$saemixversion <- "Dummy 0.0 for testing"

Contact - Imprint