@@ -65,8 +65,23 @@ test_that("MAP works with linear steady state equations", {
6565 # ############################
6666
6767 # # Set up model and regimen
68- # covariates <- list(WT = new_covariate(c(70, 80), times = c(0, 120)))
69- covariates <- list (WT = PKPDsim :: new_covariate(c(70 , 120 ), times = c(0 , 120 )))
68+ par_true <- list (CL = 2.5 , V = 45 , KA = 0.5 )
69+ par <- list (CL = 2 , V = 30 , KA = 0.5 )
70+ interval <- 24
71+ reg <- PKPDsim :: new_regimen(amt = 1000 , n = 30 , interval = interval , type = " oral" )
72+ t_tdm <- max(reg $ dose_times ) + c(1 , 3 , 6 , 8 , 12 )
73+ covariates <- list (
74+ WT = PKPDsim :: new_covariate(
75+ value = c(70 , 120 ),
76+ times = max(reg $ dose_times ) + c(0 , 120 )
77+ )
78+ )
79+ covariates_ss <- list (
80+ WT = PKPDsim :: new_covariate(
81+ value = c(70 , 120 ),
82+ times = c(0 , 120 )
83+ )
84+ )
7085 model2 <- PKPDsim :: new_ode_model(
7186 code = "
7287 CLi = CL * pow(WT/70.0, 0.75)
@@ -78,19 +93,13 @@ test_that("MAP works with linear steady state equations", {
7893 dose = list (cmt = 1 ),
7994 covariates = covariates
8095 )
81-
82- par_true <- list (CL = 2.5 , V = 45 , KA = 0.5 )
83- par <- list (CL = 2 , V = 30 , KA = 0.5 )
84- interval <- 24
85- reg <- PKPDsim :: new_regimen(amt = 1000 , n = 30 , interval = interval , type = " oral" )
86- t_tdm <- max(reg $ dose_times ) + c(1 , 3 , 6 , 8 , 12 )
8796 tdm <- PKPDsim :: sim(
8897 model2 ,
8998 parameters = par_true ,
9099 covariates = covariates ,
91100 regimen = reg ,
92101 t_obs = t_tdm ,
93- only_obs = TRUE
102+ only_obs = TRUE
94103 )
95104
96105 # # plot
@@ -125,7 +134,7 @@ test_that("MAP works with linear steady state equations", {
125134 model = model2 ,
126135 data = tdm2 ,
127136 regimen = reg_ss ,
128- covariates = covariates ,
137+ covariates = covariates_ss , # time rezeroed
129138 fixed = c(" KA" ),
130139 omega = c(0.1 , 0.05 , 0.1 ),
131140 error = list (prop = 0.1 , add = 0.1 )
@@ -143,7 +152,7 @@ test_that("MAP works with linear steady state equations", {
143152 data = tdm2 ,
144153 regimen = reg_ss ,
145154 fixed = c(" KA" ),
146- covariates = covariates ,
155+ covariates = covariates_ss ,
147156 omega = c(0.1 , 0.05 , 0.1 ),
148157 error = list (prop = 0.1 , add = 0.1 ),
149158 steady_state_analytic = list (
0 commit comments