Load a PK model from the built-in model library or load your own one.
Create a dataset of 10 individuals in Campsis For instance, let’s give 1000 mg QD for 3 days and observe every hour.
Simulate this very simple protocol:
## using C compiler: 'gcc.exe (GCC) 13.2.0'
Plot all simulated profiles using a spaghetti plot:
Or use a shaded plot to see the simulated 90% prediction interval:
The dataset can contain more than one treatment arm. In the example below, we explicitly create two arms. The first arm receives a dose of 1000 mg QD, while the second arm receives twice this dose amount.
arm1 <- Arm(subjects=50, label="1000 mg QD") %>%
add(Bolus(time=0, amount=1000, ii=24, addl=2)) %>%
add(Observations(times=0:72))
arm2 <- Arm(subjects=50, label="2000 mg QD") %>%
add(Bolus(time=0, amount=2000, ii=24, addl=2)) %>%
add(Observations(times=0:72))
dataset <- Dataset() %>%
add(c(arm1, arm2))
results <- model %>% simulate(dataset, seed=1)
shadedPlot(results, "CONC", colour="ARM")
Scenarios derived from the base model and/or dataset can be easily implemented. Below, we’d like to see what happens if the clearance of this model is multiplied by two.
scenarios <- Scenarios() %>%
add(Scenario("Base model")) %>% # Original CL is 5
add(Scenario("Increased clearance", model=~.x %>% replace(Theta(name="CL", value=10))))
results <- model %>% simulate(dataset, scenarios=scenarios, seed=1)
shadedPlot(results, "CONC", colour=c("ARM"), strat_extra="SCENARIO") + ggplot2::facet_wrap(~SCENARIO)