The R codes and the Mlxtran model files can be found here
simulx
can be easily integrated in a workflow:
modeling of the theophylline PK data is performed first with Monolix
,
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.
Define the project to be used for the simulations (relative paths)
project.file <- 'monolixRuns/theophylline_project.mlxtran'
Simulate model with individual parameters sampled from the estimated population distribution
sim.res1 <- simulx(project = project.file)
plot the results ‘’as usual’’
print(ggplot(data=sim.res1$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"))
sim.param <- c(b=0)
out <- list(name = 'Cc', time = seq(0, 25, by=0.1))
sim.res2 <- simulx(project = project.file,
output = out,
parameter = sim.param)
print(ggplot() +
geom_point(data=sim.res2$y1, aes(x=time, y=y1, colour=id)) +
geom_line(data=sim.res2$Cc, aes(x=time, y=Cc, colour=id)) +
scale_x_continuous("Time") + scale_y_continuous("Concentration"))
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"))
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"))
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"))