aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat/setup_script.R
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testthat/setup_script.R')
-rw-r--r--tests/testthat/setup_script.R39
1 files changed, 25 insertions, 14 deletions
diff --git a/tests/testthat/setup_script.R b/tests/testthat/setup_script.R
index fd9635d1..2071e05c 100644
--- a/tests/testthat/setup_script.R
+++ b/tests/testthat/setup_script.R
@@ -156,7 +156,7 @@ DFOP_SFO <- mkinmod(
m1 = mkinsub("SFO"),
quiet = TRUE)
dfop_sfo_pop <- list(parent_0 = 100,
- k_m1 = 0.002, f_parent_to_m1 = 0.5,
+ k_m1 = 0.005, f_parent_to_m1 = 0.5,
k1 = 0.05, k2 = 0.01, g = 0.5)
syn_biphasic_parms <- as.matrix(data.frame(
k1 = rlnorm(n_biphasic, log(dfop_sfo_pop$k1), log_sd),
@@ -178,19 +178,27 @@ ds_biphasic <- lapply(ds_biphasic_mean, function(ds) {
})
# Mixed model fits
-mmkin_sfo_1 <- mmkin("SFO", ds_sfo, quiet = TRUE, error_model = "tc")
-sfo_saem_1 <- saem(mmkin_sfo_1, quiet = TRUE, transformations = "saemix")
+saemix_available <- FALSE
+if (requireNamespace("saemix", quietly = TRUE)) {
+ if(packageVersion("saemix") > "3.1.9000") saemix_available <- TRUE
+}
+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_mixed <- mixed(mmkin_biphasic)
-mmkin_dfop_1 <- mmkin("DFOP", ds_dfop, quiet = TRUE)
-dfop_saemix_1 <- saem(mmkin_dfop_1, quiet = TRUE, transformations = "mkin")
-dfop_saemix_2 <- saem(mmkin_dfop_1, quiet = TRUE, transformations = "saemix")
dfop_nlme_1 <- nlme(mmkin_dfop_1)
-
-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)
+
+if (saemix_available) {
+ sfo_saem_1 <- saem(mmkin_sfo_1, quiet = TRUE, transformations = "saemix")
+
+ dfop_saemix_1 <- saem(mmkin_dfop_1, quiet = TRUE, transformations = "mkin")
+ 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)
+}
ds_uba <- lapply(experimental_data_for_UBA_2019[6:10],
function(x) subset(x$data[c("name", "time", "value")]))
@@ -200,7 +208,10 @@ sfo_sfo_uba <- mkinmod(parent = mkinsub("SFO", "A1"),
dfop_sfo_uba <- mkinmod(parent = mkinsub("DFOP", "A1"),
A1 = mkinsub("SFO"), quiet = TRUE)
f_uba_mmkin <- mmkin(list("SFO-SFO" = sfo_sfo_uba, "DFOP-SFO" = dfop_sfo_uba),
- ds_uba, quiet = TRUE)
+ ds_uba, quiet = TRUE, cores = n_cores)
f_uba_dfop_sfo_mixed <- mixed(f_uba_mmkin[2, ])
-f_uba_sfo_sfo_saem <- saem(f_uba_mmkin["SFO-SFO", ], quiet = TRUE, transformations = "saemix")
-f_uba_dfop_sfo_saem <- saem(f_uba_mmkin["DFOP-SFO", ], quiet = TRUE, transformations = "saemix")
+
+if (saemix_available) {
+ f_uba_sfo_sfo_saem <- saem(f_uba_mmkin["SFO-SFO", ], quiet = TRUE, transformations = "saemix")
+ f_uba_dfop_sfo_saem <- saem(f_uba_mmkin["DFOP-SFO", ], quiet = TRUE, transformations = "saemix")
+}

Contact - Imprint