Automated simulation with parameter uncertainty from R with NONMEM and NMsim_NWPRI

Read full text
Authors: Brian Reilly, Robert J. Bauer, Philip Delff
Cited by: 0

Abstract

Objectives: The R package `NMsim` provides functionality to simulate NONMEM models directly using R without the need to reimplement or translate the model using only the path to a model control stream and a user supplied simulation dataset [ 1]. With NMsim and NONMEM 7.6.0 it is possible to perform full clinical trial simulations using the parametric parameter uncertainty estimated from a NONMEM covariance step in just a few lines of R code without ever leaving the R console. NONMEM provides functionality to simulate parameters from an uncertainty distribution through the $PRIOR NWPRI subroutine, and with the release of NONMEM 7.6.0 this method accurately reproduces inverse-Wishart distributed OMEGAS and SIGMAS. Here we describe a new NMsim method called ‘NMsim_NWPRI’ which automates construction and execution of NONMEM simulation control streams using $PRIOR NWPRI for seamless simulation using inverse-Wishart distributed variance parameters. The method requires just a few lines of R code, a simulation dataset, and a NONMEM model to enable the execution of a range of analyses commonly performed in drug development which rely on model parameter uncertainty, including full clinical trial simulation or forest plots of covariate effects. Methods: NMsim_NWPRI is a simulation method provided by NMsim which requires only the path to an executed NONMEM model and will use the ‘.cov’ and ‘.ext’ files to generate and execute a simulation control stream with all required elements for the $PRIOR NWPRI subroutine for simulation with uncertainty. Key pieces of this method are: (1) automatic construction of $THETAP, $OMEGAP, and $SIGMAP from ‘.ext’; (2) automatic construction of the $THETAPV block matrix from ‘.cov’; (3) automatic calculation of inverse-Wishart degrees of freedom ($OMEGADF and $SIGMADF) using ‘.ext’ and ‘.cov’; and (4) automatic calculation and updating of $SIZES to accommodate $PRIOR parameters. Results: We demonstrate the use of NMsim_NWPRI with example R code showing the inputs and outputs of the workflow. We compare simulated parameter distributions using NMsim_NWPRI to what is obtained from a multivariate normal distribution for OMEGA and SIGMA parameters. We examine how different parametric forms of parameter distributions (multivariate normal versus inverse-Wishart for OMEGAS and SIGMAS) can impact clinical trial simulations. We also demonstrate how NMsim_NWPRI can be used to rapidly and accurately generate the elements of $PRIOR required for Bayesian or other estimations using prior information from previously estimated models. All code to reproduce the analysis will be shared via a GitHub repository. Conclusions: Using the NMsim simulation interface between R and NONMEM, NMsim_NWPRI enables simulation with parameter uncertainty. A full clinical trial simulation with inverse-Wishart distributed parameter uncertainty of variance parameters can be completed with just a few lines of R code. Under the hood, the workflow takes advantage of improvements in NONMEM 7.6.0 for simulations using $PRIOR NWPRI, demonstrating the powerful capabilities of NMsim for simulations with parameter uncertainty from NONMEM models.

Fields of Study & Subjects

Statistical Methods in Clinical Trials Pharmaceutical studies and practices Statistical Methods and Bayesian Inference

Publication details

Publication date
1 January 2026
Language
EN