aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2022-03-01 10:42:56 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2022-03-01 10:42:56 +0100
commitc013e35de82825786a12fa98a202219dd241257e (patch)
treed0bf144328f1a43b5cd5b5b33ed319829c8eab9d
parent1d581d24bc85402770a195b44e453a1449597faf (diff)
Some more tests for nlmixr.mmkin
-rw-r--r--print_nlmixr_saem_biphasic.txt35
-rw-r--r--print_nlmixr_saem_biphasic_tc.txt39
-rw-r--r--tests/testthat/setup_script.R4
-rw-r--r--tests/testthat/test_mixed.R2
4 files changed, 80 insertions, 0 deletions
diff --git a/print_nlmixr_saem_biphasic.txt b/print_nlmixr_saem_biphasic.txt
new file mode 100644
index 00000000..5cf80f0f
--- /dev/null
+++ b/print_nlmixr_saem_biphasic.txt
@@ -0,0 +1,35 @@
+Kinetic nonlinear mixed-effects model fit by saem using nlmixr
+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
+
+Likelihood:
+ AIC BIC logLik
+ 2510 2569 -1241
+
+Fitted parameters:
+ Est. SE %RSE Back-transformed(95%CI) BSV(CV% or SD)
+parent_0 100 0.444 0.442 100 (99.6, 101) 0.461
+log_k_m1 -5.36 0.0804 1.5 0.00472 (0.00403, 0.00552) 21.5
+f_parent_qlogis -0.0909 0.0868 95.5 0.477 (0.435, 0.52) 0.308
+log_k1 -2.78 0.0977 3.51 0.0618 (0.0511, 0.0749) 30.1
+log_k2 -4.51 0.08 1.77 0.011 (0.00941, 0.0129) 16.6
+g_qlogis -0.121 0.17 141 0.47 (0.388, 0.553) 0.373
+sigma_parent 3.72 3.72
+sigma_m1 1.44 1.44
+ Shrink(SD)%
+parent_0 69.2%>
+log_k_m1 19.6%<
+f_parent_qlogis -0.136%>
+log_k1 6.71%<
+log_k2 23.7%=
+g_qlogis 19.5%<
+sigma_parent
+sigma_m1
diff --git a/print_nlmixr_saem_biphasic_tc.txt b/print_nlmixr_saem_biphasic_tc.txt
new file mode 100644
index 00000000..ad59005d
--- /dev/null
+++ b/print_nlmixr_saem_biphasic_tc.txt
@@ -0,0 +1,39 @@
+Kinetic nonlinear mixed-effects model fit by saem using nlmixr
+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
+
+Likelihood:
+ AIC BIC logLik
+ 2400 2468 -1184
+
+Fitted parameters:
+ Est. SE %RSE Back-transformed(95%CI) BSV(CV% or SD)
+parent_0 100 0.685 0.682 100 (99, 102) 0.278
+log_k_m1 -5.35 0.0812 1.52 0.00477 (0.00407, 0.00559) 13.7
+f_parent_qlogis -0.091 0.096 106 0.477 (0.431, 0.524) 0.320
+log_k1 -2.76 0.0969 3.5 0.063 (0.0521, 0.0762) 29.9
+log_k2 -4.49 0.0658 1.47 0.0113 (0.00991, 0.0128) 18.6
+g_qlogis -0.167 0.142 85.3 0.458 (0.39, 0.528) 0.339
+sigma_low_parent 1.04 1.04
+rsd_high_parent 0.0531 0.0531
+sigma_low_m1 0.819 0.819
+rsd_high_m1 0.058 0.058
+ Shrink(SD)%
+parent_0 87.7%>
+log_k_m1 44.8%>
+f_parent_qlogis -0.375%>
+log_k1 6.76%<
+log_k2 10.4%<
+g_qlogis 20.3%=
+sigma_low_parent
+rsd_high_parent
+sigma_low_m1
+rsd_high_m1
diff --git a/tests/testthat/setup_script.R b/tests/testthat/setup_script.R
index 08d899a1..bfa70005 100644
--- a/tests/testthat/setup_script.R
+++ b/tests/testthat/setup_script.R
@@ -186,6 +186,8 @@ ds_biphasic <- lapply(ds_biphasic_mean, function(ds) {
mmkin_sfo_1 <- mmkin("SFO", ds_sfo, quiet = TRUE, error_model = "tc", cores = n_cores)
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)
+mmkin_biphasic_tc <- mmkin(list("DFOP-SFO" = DFOP_SFO), ds_biphasic, quiet = TRUE, cores = n_cores,
+ error_model = "tc")
mmkin_biphasic_mixed <- mixed(mmkin_biphasic)
# nlme
@@ -204,6 +206,8 @@ saem_biphasic_s <- saem(mmkin_biphasic, transformations = "saemix", quiet = TRUE
# nlmixr saem
tmp <- capture_output(nlmixr_saem_biphasic <- nlmixr(mmkin_biphasic, est = "saem",
control = nlmixr::saemControl(nBurn = 300, nEm = 100, nmc = 9, print = 0)))
+tmp <- capture_output(nlmixr_saem_biphasic_tc <- nlmixr(mmkin_biphasic_tc, est = "saem",
+ control = nlmixr::saemControl(nBurn = 300, nEm = 100, nmc = 9, print = 0)))
# The FOCEI fit takes too long...
#tmp <- capture_output(nlmixr_focei_biphasic <- nlmixr(mmkin_biphasic, est = "focei",
# control = nlmixr::foceiControl(print = 0)))
diff --git a/tests/testthat/test_mixed.R b/tests/testthat/test_mixed.R
index 2e241931..d30dcaa8 100644
--- a/tests/testthat/test_mixed.R
+++ b/tests/testthat/test_mixed.R
@@ -83,6 +83,8 @@ test_that("nlmixr results are reproducible for biphasic fits", {
test_summary$date.summary <- "Dummy date for testing"
test_summary$time <- c(elapsed = "test time 0")
+ expect_known_output(print(nlmixr_saem_biphasic, digits = 1), "print_nlmixr_saem_biphasic.txt")
+ expect_known_output(print(nlmixr_saem_biphasic_tc, digits = 1), "print_nlmixr_saem_biphasic_tc.txt")
expect_known_output(print(test_summary, digits = 1), "summary_nlmixr_saem_biphasic.txt")
})

Contact - Imprint