The sim()
function will combine the model, the parameters, and the regimen, and simulate out the ODE system. It will return a data.frame
in the long format, i.e. one observation per row, and split by compartment and individual. The command for sim()
looks e.g. like this:
library("PKPDsim")
dat <- sim( ode = model, # created using new_ode_model() parameters = parameters, # a named list of parameter values regimen = regimen # created using new_regimen )
Here is a minimal example using real code:
model <- new_ode_model("pk_1cmt_iv") parameters <- list(CL = 5, V = 50) regimen <- new_regimen( amt = 100, n = 3, interval = 12, type = "infusion", t_inf = 2 ) dat1 <- sim( ode = model, parameters = parameters, regimen = regimen ) head(dat1)
By default, the observation times will include an observation every 1 hour. However, you can specify a vector of observation times to get only those observations:
dat2 <- sim( ode = model, parameters = parameters, regimen = regimen, t_obs = c(0.5, 2, 4, 8, 12, 16, 24) ) head(dat2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.