First import the campsis
package:
library(campsis)
Load 2-compartment PK model from built-in model library:
model <- model_suite$pk$`2cpt_fo`
Create your dataset in CAMPSIS. For instance, let's give 1000mg QD for 3 days and observe every hour.
dataset <- Dataset(10) %>% add(Bolus(time=0, amount=1000, ii=24, addl=2)) %>% add(Observations(times=seq(0,72, by=1)))
Simulate this very simple protocol:
results <- model %>% simulate(dataset, seed=1) head(results)
Plot these results:
spaghettiPlot(results, "CONC")
A shaded plot may also be used:
shadedPlot(results, "CONC")
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 arm1 <- Arm(subjects=50, label="1000 mg QD") %>% add(Bolus(time=0, amount=1000, ii=24, addl=2)) %>% add(Observations(times=seq(0,72, by=1))) # Second treatment arm arm2 <- Arm(subjects=50, label="2000 mg QD") %>% add(Bolus(time=0, amount=2000, ii=24, addl=2)) %>% add(Observations(times=seq(0,72, by=1))) dataset <- Dataset() %>% add(c(arm1, arm2)) results <- model %>% simulate(dataset, seed=1) shadedPlot(results, "CONC", colour="ARM")
We invite you to check out the other vignettes. Have fun with CAMPSIS!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.