EXPORT_PNG <- FALSE
This vignette shows how a model can be appended to another. This is particularly useful when appending a PD model to a existing PK model. In this vignette, we'll demonstrate how an effect compartment model can be appended to a 2-compartment model.
The examples below require the package campismod
.
library(campsismod)
The following code will load our reference 2-compartment PK model.
pk_model <- model_suite$pk$`2cpt_fo`
The effect-compartment model can be loaded from the model library as follows:
pd_model <- model_suite$pd$effect_cmt_model pd_model
This PD model has a variable PK_CONC
, that needs to be linked with the PK concentration.
Therefore, we need to adapt it as follows:
pd_model <- pd_model %>% replace(Equation("PK_CONC", "A_CENTRAL/VC"))
Appending the PD model to the PK model is done using the add
function:
pkpd_model <- pk_model %>% add(pd_model) pkpd_model
Let's now simulate our PK/PD model:
library(campsis) dataset <- Dataset(25) %>% add(Bolus(time=0, amount=1000, compartment=1, ii=12, addl=2)) %>% add(Observations(times=0:36)) results <- pkpd_model %>% simulate(dataset=dataset, seed=1) shadedPlot(results, "CONC")
shadedPlot(results, "CONC")
ggplot2::ggsave(filename="resources/pkpd_model_concentration.png", width=7, height=3, dpi=100)
shadedPlot(results, "EFFECT")
ggplot2::ggsave(filename="resources/pkpd_model_effect.png", width=7, height=3, dpi=100)
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.