Nothing
if (campsis::on_cran()) { cat( "This vignette was not built on CRAN. Please check out the online version [here](https://calvagone.github.io/campsis.doc/articles/v11_scenarios.html)." ) knitr::knit_exit() }
library(campsis)
This vignette shows how scenarios can be implemented.
Using treatment arms:
model <- model_suite$nonmem$advan4_trans4 arm1 <- Arm(subjects = 3, label = "1000 mg SD") %>% add(Bolus(time = 0, 1000)) %>% add(Observations(times = seq(0, 24, by = 0.1))) arm2 <- Arm(subjects = 5, label = "1500 mg SD") %>% add(Bolus(time = 0, 1500)) %>% add(Observations(times = seq(0, 24, by = 0.1))) arm3 <- Arm(subjects = 10, label = "2000 mg SD") %>% add(Bolus(time = 0, 2000)) %>% add(Observations(times = seq(0, 24, by = 0.1))) results <- simulate( model = model, dataset = Dataset() %>% add(c(arm1, arm2, arm3)), seed = 1 ) spaghetti_plot(results, "CONC") + ggplot2::facet_wrap(~ARM)
Using scenarios:
model <- model_suite$nonmem$advan4_trans4 dataset <- Dataset() %>% add(Observations(times = seq(0, 24, by = 0.1))) scenarios <- Scenarios() %>% add(Scenario( "1000 mg SD", dataset = ~ .x %>% set_subjects(3) %>% add(Bolus(time = 0, 1000)) )) %>% add(Scenario( "1500 mg SD", dataset = ~ .x %>% set_subjects(5) %>% add(Bolus(time = 0, 1500)) )) %>% add(Scenario( "2000 mg SD", dataset = ~ .x %>% set_subjects(10) %>% add(Bolus(time = 0, 2000)) )) results <- simulate( model = model, dataset = dataset, scenarios = scenarios, seed = 1 ) spaghetti_plot(results, "CONC") + ggplot2::facet_wrap(~SCENARIO)
Assume we want to test different values of THETA_KA:
model <- model_suite$nonmem$advan4_trans4 ds <- Dataset(50) %>% add(Bolus(time = 0, amount = 1000)) %>% add(Observations(times = seq(0, 24, by = 0.1))) scenarios <- Scenarios() %>% add(Scenario( "THETA_KA=1", model = ~ .x %>% replace(Theta(name = "KA", value = 1)) )) %>% add(Scenario( "THETA_KA=3", model = ~ .x %>% replace(Theta(name = "KA", value = 3)) )) %>% add(Scenario( "THETA_KA=6", model = ~ .x %>% replace(Theta(name = "KA", value = 6)) )) results <- model %>% simulate(dataset = ds, scenarios = scenarios, seed = 1) shaded_plot(results, "CONC")
Assume we want to compare different distributions of body weight BW:
model <- model_suite$nonmem$advan1_trans2 %>% replace(Equation("CL", "THETA_CL*exp(ETA_CL)*pow(BW/70, 0.75)")) %>% disable("IIV") ds <- Dataset(50) %>% add(Bolus(time = 0, amount = 1000)) %>% add(Observations(times = seq(0, 24, by = 0.1))) %>% add(Covariate("BW", 70)) scenarios <- Scenarios() %>% add(Scenario("Constant BW")) %>% add(Scenario( "BW ∼ Uniform distribution", dataset = ~ .x %>% replace(Covariate("BW", UniformDistribution(min = 60, max = 80))) )) %>% add(Scenario( "BW ∼ Normal distribution", dataset = ~ .x %>% replace(Covariate("BW", NormalDistribution(mean = 70, sd = 10))) )) results <- simulate( model = model, dataset = ds, scenarios = scenarios, seed = 1 ) shaded_plot(results, "CONC") + ggplot2::facet_wrap(~SCENARIO, ncol = 1)
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.