Nothing
library(testthat)
context("Test the simulate method with argument 'dosing' set to TRUE")
seed <- 1
source(file.path(getwd(), test_path(), "test-utils.R"))
test_that("Dose adaptations can be checked in Campsis output if dosing is TRUE", {
model <- model_suite$testing$nonmem$advan4_trans4
times <- seq(0, 7 * 24, by = 4)
dataset <- Dataset(2) %>%
add(Bolus(time = seq(0, 6) * 24, amount = 0.5)) %>% # 0.5mg / kg
add(Observations(times = times)) %>%
add(Covariate("WT", c(100, 50))) %>%
add(DoseAdaptation("AMT*WT"))
# No dosing output
expectedLength <- times %>% length() * dataset %>% length()
simulation <- expression(simulate(model = model, dataset = dataset, dest = destEngine, seed = seed))
test <- expression(
expect_equal(results %>% nrow(), expectedLength)
)
campsis_test(simulation, test, env = environment())
# With dosing output
expectedLength <- expectedLength +
(dataset@arms %>% default())@protocol@treatment %>% unwrap_treatment() %>% length() * dataset %>% length()
simulation <- expression(simulate(model = model, dataset = dataset, dest = destEngine, seed = seed, dosing = TRUE))
test <- expression(
expect_equal(results %>% nrow(), expectedLength),
expect_equal(results %>% dosing_only() %>% dplyr::pull(AMT), c(rep(50, 7), rep(25, 7))),
spaghettiPlot(results, "A_DEPOT"), # RxODE always puts dose before the observation for same time
shadedPlot(results, "A_DEPOT")
)
campsis_test(simulation, test, env = environment())
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.