Initial conditions"

if (campsis::onCran()) {
  cat("This vignette was not built on CRAN. Please check out the online version [here](https://calvagone.github.io/campsis.doc/articles/v08_initial_conditions.html).")
  knitr::knit_exit()
}
library(campsis)

This vignette shows how initial conditions may be used in CAMPSIS.

Init central compartment

Assume the following 2-compartment model is used.

model <- model_suite$nonmem$advan3_trans4

We'd like to init the central compartment to a predefined value, e.g. 1000.
This can be achieved as follows.

model <- model %>% add(InitialCondition(compartment=1, rhs="1000"))

The resulting model has now a new block [INIT] which describes the initial condition:

model

Let's now create a dataset with observations-only.

ds <- Dataset(50) %>%
  add(Observations(times=seq(0,72, by=0.5)))

We can now simulate this model:

results <- model %>% simulate(dataset=ds, seed=1)
shadedPlot(results, "CONC")


Try the campsis package in your browser

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

campsis documentation built on April 12, 2025, 1:52 a.m.