Getting started

Installation

At current, PKPDsim is not yet on CRAN (but it will be released to there soon). So you cannot use install.packages() yet to install it. However, the package can be installed directly from GitHub when you have the devtools package installed:

First simulation

The main simulation function in PKPDsim is sim_ode(). To be able to simulate a dosing regimen for a specific drug, at least the following three arguments are required:

model: the model (created using the new_ode_model() function)

parameters: a list of parameter values for the model

regimen: the dosing regimen (created using the new_regimen() function)

The model library in PKPDsim contains a small selection of PK and PD models, but the main strength of course is it's ability to handle user-specified ODE systems. However, as a first example, let's implement the most simple example:

You probably noticed that the new_ode_model()-step took a few seconds to finish, while the simulation itself was in the order of milliseconds. In new_ode_model, the model is compiled to C++ binary code, which takes a few seconds. However, this has to be done only once. After compilation, the model is then available to be used in sim_ode() for as long as the R session is open.

So let's look at the output. PKPDsim will output data in the long format, i.e. one row per observed timepoint and split by compartment: