Quentin Leirens

simulo library: an R package to facilitate analysis script writing into Simulo

Nicolas Luyckx, Quentin Leirens

SGS Exprimo

Objectives: The simulo library is an R package which is freely available online since January 2020[1]. It provides an easy interface to write post-processing analyses into Simulo, offering simple R functions the Simulo user can apply on his simulation output. The main functionalities allow to statistically summarise results, to plot these summaries using ggplot[2], to compute pharmacokinetic (PK) exposure metrics or to analyse and compare full clinical trial designs. The simulo library toolbox therefore enables straightforward visualisation and generation of tables and graphics. Ultimately, it facilitates the process from running simulations to quantitatively informing internal and regulatory decisions. The package is included in the current version of Simulo 8.0[3].

Methods: The simulo library implementation uses object-oriented programming concepts of polymorphism and encapsulation. It allows the user to use the same function form for different types of input and to not worry about details of an object since they are encapsulated behind a standard interface[4].

A first set of data structures are then defined for each type of available plots: spaghetti plots, prediction bands, boxplots, scatterplots, histograms, error bars and proportional stacked area charts. Options are also available to stratify by one or more categories, to define a specific time window or to restrict the number of subjects. All these items can be passed to the plotting function that will automatically build the desired plots. Details of the items can always be transparently accessed to generate tables.

A second set of data structures are defined for each type of PK exposure metric: area under the  curve (auc), maximum concentration (cmax), time of cmax (tmax) or minimum/trough concentration (cmin/ctrough). As for the structures previously described, similar options can be submitted, plotting function can be called and resulting tables can be saved.

In addition, the package can handle multi-replicate simulation results. A data structure is then partitioned for each single replicate and can be easily supplementary processed to create summaries and plots across replicates. Finally, the Expert version of Simulo contains advanced features such as easy import of scenarios and custom replicate analysis.

The plotting functionality at any stage in the simulo library is based on the R package ggplot2[2] meaning that it returns ggplot objects which can be further modified and enriched.

Results: Using simple and generic code, the framework provides a large collection of pre-defined post-processing methods.

The simulo library is a huge added value in Simulo for both custom plots in live view and for final post-processing analysis. In the first case, in addition to the remarkably lower number of lines of codes to be written, the user doesn’t need to handle the resulting Simulo data frame (named replicateOut) by himself anymore. In the second case, when analysis is set up and embedded in Simulo directly, advantages are identical. Analysis can also be performed independently of Simulo. The package is then capable of searching and interpreting Simulo results of the working directory automatically.

Any of the plots may be customized individually thanks to the full flexibility with ggplot (for example: adding the ggplot function facet_grid(sequence~SEX) to stratify by category or scale_y_log10() to get y axis in log scale).

Concerning the advanced features of easy import of scenarios and custom replicate analysis in the Expert version of Simulo, it especially demonstrated a significant gain of time and efficacy when performing probability of success investigations.

Finally, the simulo library comprises a function savePdf(…). It accepts both table as well as plot objects and sequentially prints them in a pdf document, which moreover eases visualization and reporting of simulation results.

Conclusions: The simulo library R package makes statistics table and plot generation more efficient when processing clinical trial simulation results of Simulo. An exhaustive documentation has been made with the R package pkgdown[5]. Proper functional testing has been designed and conducted during the project. Future plans are to enhance the package with additional standard plots based on the community feedback, to improve reporting features and to create templates directly selected by the user.

References:
[1] https://intern.exprimo.com/simulo_library/index.html
[2] https://cran.r-project.org/web/packages/ggplot2/index.html
[3] Quentin Leirens et al., Simulo – a platform for advanced model based simulations using R (https://www.page-meeting.org/default.asp?abstract=7331)
[4] Hadley Wickham, Advanced R, Chapter III Object-oriented programming (https://adv-r.hadley.nz/oo.html)
[5] https://pkgdown.r-lib.org/

Reference: PAGE () Abstr 9303 [www.page-meeting.org/?abstract=9303]

Poster: Methodology - Other topics