Overview

Description

Convert a Monolix Project into an executable R script for the simulator Simulx

Usage

monolix2simulx(project, parameter = NULL)

Arguments

model
a Mlxtran or PharmML model used for the simulation.
parameter
string, the type of specific parameters to use: “mode” or “mean”
project
the name of a Monolix project

Value

A folder containing the executable R code for simulx and the data files used for the simulation (parameters, observation design, dosage regimen, covariates).


Examples


R script: doc_monolix2simulx.R

Monolix project: monolixRuns


The theophylline example is used to illustrate how to directly simulate the model just by providing the Monolix project as an input to simulx.

project.file <- 'monolixRuns/theophylline_project.mlxtran'
res <- simulx(project = project.file)

We can alternatively use monolix2simulx to create an independent folder with a simulx script for simulation that can easily modified or shared with others.

monolix2simulx(project = project.file)

A new folder theophylline_project_simulx is automatically created in the current working directory. It contains the following files:

# File generated automatically on 2015-04-15 22:21:02
 
library(mlxR)  
 
setwd(dirname(parent.frame(2)$ofile)) 

# model 
model<-"theophylline_project_model.txt"

# treatment
trt <- read.table("treatment.txt", header = TRUE) 

# parameters 
covariate<- read.table("covariate.txt", header = TRUE) 
pop <- read.vector("parameter.txt") 
param <- list(pop,covariate)
 
# output 
name<-"y1"
time<-read.table("output.txt",header=TRUE)
out<-list(name=name,time=time) 
out<-list(out)

# call the simulator 
res <- simulx(model=model,treatment=trt,parameter=param,output=out)

It is then possible to modify this R script as any simulx script.




Three other demo examples, with different types of model and data, are available:

project.file <- 'monolixRuns/warfarin_project.mlxtran'
monolix2simulx(project = project.file, parameter="mode")
project.file <- 'monolixRuns/pkcat_project.mlxtran'
monolix2simulx(project = project.file)
project.file <- 'monolixRuns/pkrtte_project.mlxtran'
monolix2simulx(project = project.file)