First import the campsis
package:
library(campsis)
Load 2-compartment PK model from built-in model library:
<- model_library$advan4_trans4 model
Create your dataset in CAMPSIS. For instance, let’s give 1000mg QD for 3 days and observe every hour.
<- Dataset(10) %>%
dataset add(Bolus(time=0, amount=1000, ii=24, addl=2)) %>%
add(Observations(times=seq(0,72, by=1)))
Simulate this very simple protocol:
<- model %>% simulate(dataset, seed=1)
results head(results)
## # A tibble: 6 × 17
## ID TIME ARM KA CL V2 V3 Q S2 F CP OBS_CP Y
## <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 0 0 0.974 6.20 92.5 25.4 3.62 92.5 0 0 0 0
## 2 1 1 0 0.974 6.20 92.5 25.4 3.62 92.5 6.34 6.34 5.42 5.42
## 3 1 2 0 0.974 6.20 92.5 25.4 3.62 92.5 8.12 8.12 9.14 9.14
## 4 1 3 0 0.974 6.20 92.5 25.4 3.62 92.5 8.28 8.28 10.4 10.4
## 5 1 4 0 0.974 6.20 92.5 25.4 3.62 92.5 7.89 7.89 8.13 8.13
## 6 1 5 0 0.974 6.20 92.5 25.4 3.62 92.5 7.35 7.35 10.2 10.2
## # … with 4 more variables: A_DEPOT <dbl>, A_CENTRAL <dbl>, A_PERIPHERAL <dbl>,
## # A_OUTPUT <dbl>
Plot these results:
spaghettiPlot(results, "CP")
A shaded plot may also be used:
shadedPlot(results, "CP")
We can also simulate two different treatment arms. Say the first arm receives 1000mg QD and the second arm 2000mg QD. This can be implemented as follows:
# First treatment arm
<- Arm(subjects=50, label="1000 mg QD") %>%
arm1 add(Bolus(time=0, amount=1000, ii=24, addl=2)) %>%
add(Observations(times=seq(0,72, by=1)))
# Second treatment arm
<- Arm(subjects=50, label="2000 mg QD") %>%
arm2 add(Bolus(time=0, amount=2000, ii=24, addl=2)) %>%
add(Observations(times=seq(0,72, by=1)))
<- Dataset() %>% add(c(arm1, arm2))
dataset
<- model %>% simulate(dataset, seed=1)
results shadedPlot(results, "CP", scenarios="ARM")
We invite you to check out the other vignettes. Have fun with CAMPSIS!