Director, Modeling & Simulation Vertex Pharmaceuticals, United States
Objectives: While Nonmem is widely used for its strengths and flexibility in estimation of pharmacometrics models, post-processing including simulation is often preferably handled in R. The new R package NMsim (available on CRAN) fills this gap by allowing simulation of Nonmem models directly from R. In contrast to other powerful simulation packages, NMsim relies on Nonmem to perform the simulation, hence eliminates the need for translating to other software.
NMsim aims at providing a seamless and close to model-independent R interface to simulation of Nonmem models only dependent on estimation control stream and a simulation data set.
NMsim works on both ADVAN subroutines and $PRED models and can currently perform the following types of simulations: • New subjects (default) • Typical subject (ETAs equal 0) • Subjects already estimated in Nonmem model (EBE’s) • Simulation with parameter uncertainty
Moreover, NMsim provides an interface to modify control streams. This can among other things be used to modify parameter values.
Methods: NMsim does not simulate, translate or otherwise interpret a Nonmem model. Instead, it automates the Nonmem simulation workflow (including execution of Nonmem). In the example given above, NMsim will do the following: • Save the simulation input data in a csv file for Nonmem • Create a simulation input control stream based on file.mod matching the saved simulation data set • Update and fix initial values based on estimate (from file.ext) • Run Nonmem on the generated simulation control stream • Collect output data tables, combine them, and merge with the simulation input data • Return the collected data in R
NMsim is written in R and data.table leveraging functionality from the NMdata R package.
Results: NMsim provides a simulation interface that does not require reimplementation of a Nonmem model. This reduces amount of work and risk of errors. It allows for simulation of all intermediate model steps simplifying simulation-based model qualification, and for automation of a wide range of simulation based analyses.
In this poster presentation, we showcase the capabilities of NMsim through examples of different types of simulations of a popPK model. From the information provided on the poster and the freely available R package, the audience will be able to perform simulations on their own models without any further model coding.
Conclusions: By bridging the gap between Nonmem’s powerful modeling capabilities and the readily availability of a simulation interface in R, NMsim expedites model development and evaluation. We believe that our package will facilitate collaboration and innovation in the pharmacometrics community, ultimately advancing drug development efforts.
Citations: [1] 2024. NMdata: Preparation, Checking and Post-Processing Data for PK/PD Modeling. https://cran.rproject. org/package=NMdata [2] 2024. NMsim: Simulate Nonmem models from R. https://philipdelff.github.io/NMsim [3] 2024. NMsim: Seamless ‘Nonmem’ Simulation Platform. https://cran.r-project.org/web/packages/NMsim