library(campsis)

This vignette shows how a simulation can be replicated.

Simulate uncertainty on percentiles

Assume the following model is used. This model is a 2-compartment model without absorption compartment which has been fitted on some data.

model <- model_suite$testing$other$my_model1

It contains a variance-covariance matrix with the uncertainty on all the estimated parameters.

model

We are interested to see the uncertainty on the simulated concentration percentiles over time. Let's mimic the protocol that was implemented in the study.

ds <- Dataset(50) %>%
  add(Infusion(time=(0:6)*24, amount=1000, compartment=1)) %>%
  add(Observations(times=seq(0, 7*24)))

Let's now simulate this model with parameter uncertainty.
Argument replicates specifies how many times the simulation is replicated.
Argument outfun is a function that is going to be called after each simulation on the output data frame.

results <- model %>% simulate(dataset=ds, replicates=10, outfun=~PI(.x, output="Y"), seed=1)
results %>% head()

Function vpcPlot allows to quickly visualize such results.

vpcPlot(results)


Calvagone/campsis documentation built on April 17, 2024, 5:33 a.m.