Complex PK/PD models from literature"

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/v14_complex_pkpd_models.html)."
  )
  knitr::knit_exit()
}
library(campsis)

This vignette intends to demonstrate that Campsis can be used to implement almost any PK/PD model, including complex ones.

Filgrastim PK/PD model

Load the filgrastim PK/PD model from the model library as follows. Please note that this model was translated from NONMEM code. The original model file can be found on the DDMORE repository (reference: DDMODEL00000077). Eventually, this model was updated with the final parameters from the corresponding publication (Krzyzanski et al., 2010).

pkpd <- model_suite$literature$filgrastim_pkpd_krzyzanski
pkpd

Let's create a simple demonstration dataset of 250 subjects:

base_dataset <- Dataset(250) %>%
  add(Covariate("BAS", 0.02)) %>%
  add(Covariate("WT", UniformDistribution(50, 100))) %>%
  add(DoseAdaptation("WT*AMT")) %>% # per kilo dosing
  add(Observations(0:216)) %>%
  add(Covariate("ROUT", 0)) # subcutaneous route (SC)

Assume we want to compare the following subcutaneous administrations of filgrastim:

We define the following scenarios:

scenarios <- Scenarios() %>%
  add(Scenario(
    name = "2.5 μg/kg SC",
    dataset = ~ .x %>%
      add(Bolus(time = 0, amount = 2.5, compartment = 1, ii = 24, addl = 6))
  )) %>%
  add(Scenario(
    name = "5 μg/kg SC",
    dataset = ~ .x %>%
      add(Bolus(time = 0, amount = 5, compartment = 1, ii = 24, addl = 6))
  )) %>%
  add(Scenario(
    name = "10 μg/kg SC",
    dataset = ~ .x %>%
      add(Bolus(time = 0, amount = 10, compartment = 1, ii = 24, addl = 6))
  ))

A quick simulation gives us the plasma concentration of filgrastim, as well as the absolute neutrophil count (ANC):

library(ggplot2)

results <- simulate(
  model = pkpd,
  dataset = base_dataset,
  scenarios = scenarios,
  outvars = "CP",
  seed = 1
) %>%
  dplyr::mutate(SCENARIO = factor(SCENARIO, levels = unique(SCENARIO)))

p1 <- shaded_plot(results, "CP") +
  facet_wrap(~SCENARIO) +
  scale_y_log10(breaks = c(.01, .1, 1, 10, 100)) +
  ylab("G-CSF Serum Concentration (ng/mL)")
p2 <- shaded_plot(results, "A_14") +
  facet_wrap(~SCENARIO) +
  ylab("ANC (10^3 cells/μL)")

gridExtra::grid.arrange(p1, p2, nrow = 2)


Try the campsis package in your browser

Any scripts or data that you put into this service are public.

campsis documentation built on Aug. 5, 2026, 9:07 a.m.