## $software
## [1] "simulx"
## $path
## [1] "C:/ProgramData/Lixoft/MonolixSuite2019R2"
## $version
## [1] "2019R2"
## $status
## [1] TRUE



Create a Shiny application for longitudinal data model.



a Mlxtran or PharmML model used for the simulation.
a vector, or a list of shiny widgets
a list with fields
a list with fields
Remark: Input argument of simulx can also be used, i.e. a list with fields time, amount, rate, tinf, type, target.
a datafile to display with the plot
the title of the application
the name of the application (and possibly its path)
the style of the Shiny app
a list of settings


A directory tempdir with files ui.R, server.R and model.txt


Example 1: introductory example

R script: doc_shinymlx1.R

We want to compare zero-order and first-order absorption processes for a single dose administration.

The model is implemented as an inline model:

Let us start using simulx for computing and plotting \(f_1\) and \(f_2\)

We can now run shinymlx with the same input arguments. Sliders will be automatically created for the 4 parameters. By default, the minimum and maximum values of a slider are the value of the parameter multiplied, respectively, by 0.5 and 2. The step is the range (max-min) divided by 15.

It is possible to customize the widgets used for each parameters. Available widgets are “slider”, “numeric” (enter a numerical value) and “select” (select between possible choices). No widget will be created by defining widget=“none”.

In the example below, A slider is created for \(ka\), a numeric input control for \(Tk0\) and a select list input control for \(k\). \(V=10\) is constant.

By default, style = “basic” is used to create a basic application. Other styles are available, including “dashboard1” to create a Shiny dashboard. You can then, for instance, tick the checkbox Reference to display a reference curve (i.e. which is not modified when you modify the parameters values) or reset this reference curve. You can also select the outputs to be displayed, select which variable use for the x-axis, use a log scale for the y-axis, display the R codes, the model code…

Several display settings can be modified (see the shinymlx help for the list of display settings). In the example below, the list of variables available for the x-axis and the log scale option are not displayed.

Using style = “navbar1” will create a Shiny application with a navigation bar and 2 tabPanels: the parameters and the outputs.

Using style = “navbar2” will create a Shiny application with the widgets and the output options side-by-side.

Example 2: load and display data

R script: doc_shinymlx2.R

in this example, we want to display the predicted concentration provided by a model together with some PK data.

Data is stored in the file data/pkdata1.txt:

time  y
0.5   0.451
1     0.552
2     0.676
4     0.568
6     0.334
8     0.205
12    0.126
16    0.187
20    0.098
24    0.043

We can then select this datafile with the input argument data and plot the data.

Note that in this example, each parameter is defined as a vector of length 4: then a slider will be automatically created for each of these parameters, using the information in the vector: (value, min, max, step).

Example 3: PK model - combine multiple administrations

R script: doc_shinymlx3.R

In this example, we consider a basic one compartment PK model. Here, input argument treatment is defined as a combination of oral and iv administrations, as it would be defined for simulx.

We may also want to modify the dosage regimen interactively. We thus define the time of first dose (tfd), the number of doses (nd) and the interdose interval (ii). We create sliders for these parameters, for the amount and for the rate of infusion by defining for each a vector (value, minimum, maximum, step). We can also interactively modify the route of administration by creating a list of possible values for type: 1=oral, 2=iv.

Two panels are then created for the two types of administration: adm1 and adm2. The parameters of the model can still be modified in the panel param