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.R30
1 files changed, 28 insertions, 2 deletions
diff --git a/tests/testthat/setup_script.R b/tests/testthat/setup_script.R
index 9da8b90d..4a343bc5 100644
--- a/tests/testthat/setup_script.R
+++ b/tests/testthat/setup_script.R
@@ -95,7 +95,6 @@ fit_tc_1 <- mkinfit(m_synth_SFO_lin, SFO_lin_a, error_model = "tc", quiet = TRUE
error_model_algorithm = "threestep")
# Mixed models data and
-set.seed(123456)
sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120)
n <- n_biphasic <- 15
log_sd <- 0.3
@@ -103,6 +102,7 @@ err_1 = list(const = 1, prop = 0.05)
tc <- function(value) sigma_twocomp(value, err_1$const, err_1$prop)
const <- function(value) 2
+set.seed(123456)
SFO <- mkinmod(parent = mkinsub("SFO"))
k_parent = rlnorm(n, log(0.03), log_sd)
ds_sfo <- lapply(1:n, function(i) {
@@ -111,6 +111,19 @@ ds_sfo <- lapply(1:n, function(i) {
add_err(ds_mean, tc, n = 1)[[1]]
})
+set.seed(123456)
+FOMC <- mkinmod(parent = mkinsub("FOMC"))
+fomc_pop <- list(parent_0 = 100, alpha = 2, beta = 8)
+fomc_parms <- as.matrix(data.frame(
+ alpha = rlnorm(n, log(fomc_pop$alpha), 0.4),
+ beta = rlnorm(n, log(fomc_pop$beta), 0.2)))
+ds_fomc <- lapply(1:3, function(i) {
+ ds_mean <- mkinpredict(FOMC, fomc_parms[i, ],
+ c(parent = 100), sampling_times)
+ add_err(ds_mean, tc, n = 1)[[1]]
+})
+
+set.seed(123456)
DFOP <- mkinmod(parent = mkinsub("DFOP"))
dfop_pop <- list(parent_0 = 100, k1 = 0.06, k2 = 0.015, g = 0.4)
dfop_parms <- as.matrix(data.frame(
@@ -124,6 +137,19 @@ ds_dfop <- lapply(1:n, function(i) {
})
set.seed(123456)
+HS <- mkinmod(parent = mkinsub("HS"))
+hs_pop <- list(parent_0 = 100, k1 = 0.08, k2 = 0.01, tb = 15)
+hs_parms <- as.matrix(data.frame(
+ k1 = rlnorm(n, log(hs_pop$k1), log_sd),
+ k2 = rlnorm(n, log(hs_pop$k2), log_sd),
+ tb = rlnorm(n, log(hs_pop$tb), 0.1)))
+ds_hs <- lapply(1:10, function(i) {
+ ds_mean <- mkinpredict(HS, hs_parms[i, ],
+ c(parent = hs_pop$parent_0), sampling_times)
+ add_err(ds_mean, const, n = 1)[[1]]
+})
+
+set.seed(123456)
DFOP_SFO <- mkinmod(
parent = mkinsub("DFOP", "m1"),
m1 = mkinsub("SFO"),
@@ -152,7 +178,7 @@ ds_biphasic <- lapply(ds_biphasic_mean, function(ds) {
# Mixed model fits
mmkin_sfo_1 <- mmkin("SFO", ds_sfo, quiet = TRUE, error_model = "tc")
-sfo_saemix_1 <- saem(mmkin_sfo_1, quiet = TRUE, transformations = "saemix")
+sfo_saem_1 <- saem(mmkin_sfo_1, quiet = TRUE, transformations = "saemix")
mmkin_dfop_1 <- mmkin("DFOP", ds_dfop, quiet = TRUE)
dfop_saemix_1 <- saem(mmkin_dfop_1, quiet = TRUE, transformations = "mkin")

Contact - Imprint