The R codes and the Mlxtran model files can be found here


# Introduction

simulx can be easily integrated in a workflow:

1. modeling of the theophylline PK data is performed first with Monolix,

2. simulation of PK data is then performed with simulx, using the parameters estimated by Monolix.

In this example we show how to simulate a model where the parameters have been estimated with Monolix. The Modelling and Simulation (M&S) workflow allows us to directly simulate the model just by providing the Monolix project as an input to simulx. Without any other inputs simulx will simulate the exact study design underlying the input data for parameter estimation. simulx gives us the flexibility to change any of the study design variables. We will demonstrate this by first simulating the original study design and then by changing observations, dosing regimens, number of patients and the patient covariates. Finally, we will show how to simulate a dose-concentration curve and how to do Monte Carlo simulations to assess how the number of patients affects the SE error of the concentration levels.

# Examples

Define the project to be used for the simulations (relative paths)

project.file <- 'monolixRuns/theophylline_project.mlxtran'

## 1. Simulate a trial using the original design

Simulate model with individual parameters sampled from the estimated population distribution

• Covariate WEIGHT is taken from data set
• Dosage regimen and observation times are taken from data set
sim.res1  <- simulx(project = project.file)

plot the results ‘’as usual’’

geom_line(data=sim.res2$Cc, aes(x=time, y=Cc, colour=id)) + scale_x_continuous("Time") + scale_y_continuous("Concentration")) ## 3. Simulate a trial with N individuals • The designs and the weights of these N patients are sampled from the original dataset N <- 50 sim.res3 <- simulx(project = project.file, group = list(size = N)) print(ggplot(data=sim.res3$y1) +
geom_point(aes(x=time, y=y1, colour=id)) +
geom_line(aes(x=time, y=y1, colour=id)) +
scale_x_continuous("Time") + scale_y_continuous("Concentration") +
theme(legend.position="none"))

## 4. Define new observation times

• Covariate WEIGHT and dosage regimen are taken from data set
out  <- list(name = 'y1', time = (0:12))

sim.res4  <- simulx(project = project.file,
output = out)

print(ggplot(data=sim.res4$y1) + geom_point(aes(x=time, y=y1, colour=id)) + geom_line(aes(x=time, y=y1, colour=id)) + scale_x_continuous("Time") + scale_y_continuous("Concentration")) ## 5. Output the predicted concentrations, the individual parameters and the covariates • Covariate WEIGHT and dosage regimen are taken from data set out1 <- list(name = 'y1', time = seq(0, 24, by=2)) out2 <- list(name = 'Cc', time = seq(0, 24, by=0.1)) out3 <- list(name = c('V', 'Cl', 'WEIGHT')) sim.res5 <- simulx(project = project.file, output = list(out1, out2, out3)) print(sim.res5$parameter)
##    id        V       Cl WEIGHT
## 1   1 32.99802 4.898956   79.6
## 2   2 32.63807 3.875025   72.4
## 3   3 28.69185 2.621612   70.5
## 4   4 35.09865 3.101235   72.7
## 5   5 27.93620 1.629150   54.6
## 6   6 36.72302 2.674799   80.0
## 7   7 30.95468 5.271731   64.6
## 8   8 34.88231 3.673450   70.5
## 9   9 36.42052 3.723640   86.4
## 10 10 28.39625 2.811044   58.2
## 11 11 30.57689 2.425945   65.0
## 12 12 25.83735 2.642265   60.5
print(ggplot() +
geom_point(data=sim.res5$y1,aes(x=time, y=y1, colour=id)) + geom_line(data=sim.res5$Cc,aes(x=time, y=Cc, colour=id)) +
scale_x_continuous("Time") + scale_y_continuous("Concentration"))