# Overview

### Description

Easy simulation of basic PK models

### Usage

pkmodel(time, treatment, parameter)

### Arguments

time
a vector of observation times
treatment
a list with fields
• time : a vector of input times,
• amount : a scalar or a vector of amounts,
• rate : a scalar or a vector of infusion rates (default=$$\infty$$),
• tinf : a scalar or a vector of infusion times (default=0),
parameter
vector of parameters with their names and values

### Details

The PK model is defined by the names of the input parameters of the pkmodel function. These names are reserved keywords.

Absorption
• p : Fraction of dose which is absorbed
• ka : absorption constant rate (first order absorption)
• or, Tk0 : absorption duration (zero order absorption)
• Tlag : lag time before absorption
• or, Mtt, Ktr: mean transit time & transit rate constant
Distribution
• V : Volume of distribution of the central compartment
• k12, k21 : Transfer rate constants between compartments 1 (central) & 2 (peripheral)
• or V2, Q2 : Volume of compartment 2 (peripheral) & inter compartment clearance, between compartments 1 and 2,
• k13, k31 : Transfer rate constants between compartments 1 (central) & 3 (peripheral)
• or V3, Q3 : Volume of compartment 3 (peripheral) & inter compartment clearance, between compartments 1 and 3.
Elimination
• k : Elimination rate constant
• or Cl : Clearance
• Vm, Km : Michaelis Menten elimination parameters
Effect compartment
• ke0 : Effect compartment transfer rate constant

# Examples

## Example 1

adm <- list(time=c(2,14,20), amount=40)
t   <- seq(0, 30, by=0.1)
param   <- c(V=10, k=0.05, k12=0.3, k21=0.2)

res   <- pkmodel(time = t, treatment = adm, parameter = param)

print(ggplot(data=res, aes(x=time, y=cc)) + geom_line(size=1) +
xlab("time (h)") + ylab("concentration (mg/L)"))

We can use parameterization $$(V_2,Q_2)$$ instead of $$(k_{12}, k_{21})$$:

param   <- c(V=10, Cl=0.5, Q2=3, V2=15)
res   <- pkmodel(time = t, treatment = adm, parameter = param)
print(ggplot(data=res, aes(x=time, y=cc)) + geom_line(size=1) +
xlab("time (h)") + ylab("concentration (mg/L)"))

## Example 2

adm <- list(time = c(1,23,37,45), amount = c(1,0.5,2,0.3))
param <- c(Mtt=5, Ktr=1, ka=0.5, V=10, Vm=1, Km=0.6, p=0.5)
t <- seq(0, 80, by=0.1)

print(ggplot(data=res, aes(x=time, y=cc)) + geom_line(size=1) +
xlab("time (h)") + ylab("concentration (mg/L)"))

## Example 3

adm <- list( time = 2, amount = 40)

param <- inlineDataFrame("
id   ka   V    Cl
1   0.5   4     1
2     1   6     1
3   1.5   6   1.5
")

t <- seq(0, 30, by=0.1)

print(ggplot(data=res, aes(x=time, y=cc, colour=id)) + geom_line(size=1) +
xlab("time (h)") + ylab("concentration (mg/L)"))

## Example 4

library("reshape2")

adm <- list(time=seq(2, 100, by=24), amount=40, rate=5)
param <- c(V=8, Cl=0.5, k12=0.3, k21=0.2, ke0=0.2)
t <- seq(0, 50, by=0.1)

theme(legend.position=c(.9, .8)))