Nonmem via bbr/bbi


Scope

bbr is an open-source R package, developed by MetrumRG, that serves three primary purposes:

  • Submit NONMEM models, particularly for execution in parallel and/or on a high-performance compute (HPC) cluster (e.g., Metworx).
  • Parse NONMEM outputs into R objects to facilitate model evaluation and diagnostics in R.
  • Annotate the model development process for easier and more reliable traceability and reproducibility.

The most complete example of using bbr for NONMEM modeling is the Model Management page in our MeRGE Expo. Briefly, the MeRGE Expo demonstrates how to proceed step-by-step through a population pharmacokinetic (pop PK) modeling and simulation (M&S) analysis, using the same process and suite of tools we use at MetrumRG. There is an accompanying Expo GitHub repository that includes example code and models that can be run using bbr.

More detail on how to utilize all of bbr’s functionality is available in the package's public documention. Some helpful vignettes include:

Setup

The Metworx 21.08 (or later) blueprint comes with bbr pre-installed. On blueprints prior to 21.08 you can install bbr via the latest MPN snapshot.

bbr relies on a command line utility called bbi for some functionality. Again, this comes pre-installed on Metworx 22.09. You can check bbr is finding the bbi installation at any time by running bbr::bbi_version() in your R console.

For project analysis work, we encourage you to install bbi inside your project directory and to point to this installation in your .Rprofile. This allows different projects to use different versions of bbi. The advantage of this approach is newer projects can use newer features, while older projects can ensure reproducibility by remaining “pinned” to the original version for the length of the project. This is similar to the process we describe in R Package Management for R packages.

An example of how to do this is available in our MeRGE Expo repository. Simply add this line to your projects .Rprofile, then restart R and run bbr::use_bbi() in the R console. This prompts you to install the current version of bbi to /path/to/your/project/bin/bbi.

Bootstrap Simulations

Currently bbr does not have any direct functionality for running bootstraps, however, it is possible to do so using bbr::submit_models(). An example of this approach can be seen on the Bootstrap generate and collect page of the MeRGE Expo.

Stepwise Covariate Modeling (SCM)

SCM is not automated in bbi/bbr. In general, we discourage use of the SCM approach due to its many documented faults (see for example, Harrell, F. E. (2001). Regression modeling strategies: With applications to linear models, logistic regression, and survival analysis. Springer-Verlag.). Alternative methods for covariate modeling are suggested instead, for example, Gastonguay 2011.

If you require automated SCM we suggest using the functionality in PsN.