diff options
| -rw-r--r-- | tests/testthat/setup_script.R | 7 | ||||
| -rw-r--r-- | tests/testthat/summary_nlmixr_saem_biphasic.txt | 97 | ||||
| -rw-r--r-- | tests/testthat/test_mixed.R | 14 | 
3 files changed, 118 insertions, 0 deletions
| diff --git a/tests/testthat/setup_script.R b/tests/testthat/setup_script.R index 4688b7d7..08d899a1 100644 --- a/tests/testthat/setup_script.R +++ b/tests/testthat/setup_script.R @@ -201,6 +201,13 @@ dfop_saemix_2 <- saem(mmkin_dfop_1, quiet = TRUE, transformations = "saemix")  saem_biphasic_m <- saem(mmkin_biphasic, transformations = "mkin", quiet = TRUE)  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))) +# The FOCEI fit takes too long... +#tmp <- capture_output(nlmixr_focei_biphasic <- nlmixr(mmkin_biphasic, est = "focei", +#    control = nlmixr::foceiControl(print = 0))) +  # UBA datasets  ds_uba <- lapply(experimental_data_for_UBA_2019[6:10],    function(x) subset(x$data[c("name", "time", "value")])) diff --git a/tests/testthat/summary_nlmixr_saem_biphasic.txt b/tests/testthat/summary_nlmixr_saem_biphasic.txt new file mode 100644 index 00000000..c5c1fe78 --- /dev/null +++ b/tests/testthat/summary_nlmixr_saem_biphasic.txt @@ -0,0 +1,97 @@ +nlmixr version used for fitting:    2.0.6  +mkin version used for pre-fitting:  Dummy 0.0 for testing  +R version used for fitting:         Dummy R version for testing  +Date of fit:     Dummy date for testing  +Date of summary: Dummy date for testing  + +Equations: +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: +508 observations of 2 variable(s) grouped in 15 datasets + +Degradation model predictions using RxODE + +Fitted in test time 0 s + +Variance model: Constant variance  + +Mean of starting values for individual parameters: +       parent_0        log_k_m1 f_parent_qlogis          log_k1          log_k2  +         100.74           -5.43           -0.05           -2.85           -4.57  +       g_qlogis  +          -0.15  + +Mean of starting values for error model parameters: +sigma_parent     sigma_m1  +           3            3  + +Fixed degradation parameter values: +None + +Results: + +Likelihood calculated by gauss3_1.6   +   AIC  BIC logLik +  2465 2525  -1219 + +Optimised parameters: +                  est. lower  upper +parent_0        100.54  99.7 101.40 +log_k_m1         -5.44  -5.6  -5.24 +f_parent_qlogis  -0.06  -0.2   0.05 +log_k1           -2.81  -3.0  -2.65 +log_k2           -4.62  -4.8  -4.41 +g_qlogis         -0.14  -0.4   0.17 + +Correlation:  +                prnt_0 lg_k_1 f_prn_ log_k1 log_k2 +log_k_m1        -0.224                             +f_parent_qlogis -0.401  0.335                      +log_k1           0.119  0.083  0.019               +log_k2          -0.019  0.237  0.142  0.395        +g_qlogis         0.083 -0.282 -0.218 -0.532 -0.544 + +Random effects (omega): +                    eta.parent_0 eta.log_k_m1 eta.f_parent_qlogis eta.log_k1 +eta.parent_0                0.05          0.0                0.00       0.00 +eta.log_k_m1                0.00          0.1                0.00       0.00 +eta.f_parent_qlogis         0.00          0.0                0.03       0.00 +eta.log_k1                  0.00          0.0                0.00       0.05 +eta.log_k2                  0.00          0.0                0.00       0.00 +eta.g_qlogis                0.00          0.0                0.00       0.00 +                    eta.log_k2 eta.g_qlogis +eta.parent_0              0.00          0.0 +eta.log_k_m1              0.00          0.0 +eta.f_parent_qlogis       0.00          0.0 +eta.log_k1                0.00          0.0 +eta.log_k2                0.08          0.0 +eta.g_qlogis              0.00          0.1 + +Variance model: +sigma_parent     sigma_m1  +           4            1  + +Backtransformed parameters: +                est. lower upper +parent_0       1e+02 1e+02 1e+02 +k_m1           4e-03 4e-03 5e-03 +f_parent_to_m1 5e-01 5e-01 5e-01 +k1             6e-02 5e-02 7e-02 +k2             1e-02 8e-03 1e-02 +g              5e-01 4e-01 5e-01 + +Resulting formation fractions: +             ff +parent_m1   0.5 +parent_sink 0.5 + +Estimated disappearance times: +       DT50 DT90 DT50back DT50_k1 DT50_k2 +parent   27  170       51      12      70 +m1      160  532       NA      NA      NA diff --git a/tests/testthat/test_mixed.R b/tests/testthat/test_mixed.R index 130d4596..2e241931 100644 --- a/tests/testthat/test_mixed.R +++ b/tests/testthat/test_mixed.R @@ -72,3 +72,17 @@ test_that("saemix results are reproducible for biphasic fits", {    expect_true(all(ci_dfop_sfo_s_d[no_k2, "lower"] < dfop_sfo_pop[no_k2]))    expect_true(all(ci_dfop_sfo_s_d[no_k1, "upper"] > dfop_sfo_pop[no_k1]))  }) + +test_that("nlmixr results are reproducible for biphasic fits", { + +  test_summary <- summary(nlmixr_saem_biphasic) +  test_summary$saemixversion <- "Dummy 0.0 for testing" +  test_summary$mkinversion <- "Dummy 0.0 for testing" +  test_summary$Rversion <- "Dummy R version for testing" +  test_summary$date.fit <- "Dummy date for testing" +  test_summary$date.summary <- "Dummy date for testing" +  test_summary$time <- c(elapsed = "test time 0") + +  expect_known_output(print(test_summary, digits = 1), "summary_nlmixr_saem_biphasic.txt") +}) + | 
