Preface

In pharmacometrics there are several population pharmacokinetic and pharmacodynamic modeling software packages. The nlmixr R package was developed for fitting general dynamic models, pharmacokinetic (PK) models and pharmacokinetic-pharmacodynamic (PKPD) models in particular, with either individual data or population data. The interesting part about nlmixr is that it is open-source and the entire workflow of modeling can be done solely in R !

nlmixr has its roots in RxODE. Once RxODE was built it was soon recognized that by combining RxODE with a nonlinear mixed-effect model (nlme) estimation tool, one greatly expands an existing nlme tool to include fitting a population PK/PD model described by a set of ordinary differential equations (ODEs) and by allowing complex and arbitrary dosing history.

The first attempt was to combine RxODE with the nlme() function in R, resulting in two efficient and useful functions for population PK/PD: nlme_lin_cmpt() and nlme_ode(). After the initial success of these functions, Stochastic Approximation EM (SAEM) was soon added to the nlmixr toolbox. While maintaining fidelity to the original SAEM algorithm, the nlmixr implementation of SAEM was written from scratch using C++ with many optimization and re-factorization than the original implementation. The resulting SAEM code is compact and efficient. Since execution of nlmixr’s SAEM is in compiled C++ mode, the speed of the implementation is very fast.

Because of actual projects’ needs, a function for the Generalized Nonlinear Mixed-Effect Model (gnlmm) was developed. This function gnlmm() takes an arbitrary user-defined log-likelihood function and hence is able to fit odd types of data like binary data, count data, heavy tail data and bounded clinical endpoints via beta-regression. Structure models can be optionally defined by user-defined ODEs.

These population PK/PD functions, plus a few ancillary functions to aid model building (e.g., vpc, bootstrap and forward selection of covariate serach), comprise the functionality of the first public release of nlmixr in October 2016.

In early 2017, a publication on First-Order Conditional Estimate with interaction (FOCEi) was brought to the attention of the nlmixr team. A proof-of-concept implementation was soon put in place. A full production version then followed. This FOCEi algorithm expands NONMEM’s FOCEi implementation prior to Version 7.4.

nlmixr’s population PK/PD functions are highly optimized and efficient. However, due to historic reasons (e.g., nlme’s original user interface) and specific input-output needs, different algorithms in nlmixr have a similar but different user-interface. To reduce the learning curve of population PK/PD modeling, the nlmixr team proposed and implemented a unified user-interface (UUI) across all fitting algorithms in mid-2017. The result is a minimalist, intuitive, expressive, domain-specific population PK/PD modeling language. A comprehensive collection of nlme algorithms with the UUI marked the first CRAN release of nlmixr in October 2017.

nlmixr is under active and intensive development. Exciting features and functionality emerge on a daily basis. For instance, parallel computing was recently available in RxODE using openmp. This parallel computing capability is the industry’s first among the current population PK/PD simulators to our best knowledge. Clinical trial simulation (CTS) was added to nlmixr in May 2018. This simulator can do extensive and sophisticated CTS right after a population PK/PD model with nlmixr.

Enjoy nlmixr !

Wenping Wang

About this book

This book provides guidance on the use of nlmixr and serves as a first reference manual, without the intent to cover every aspect of modeling or nlmixr.

We assume readers have a background in pharmacometric modeling and know how to use R. Basic knowledge is required and assumed on installing other software packages, such as Python. The installation of nlmixr and related software and packages is described in Chapter 2.

Acknowledgements

We are thankful for the time people are willing to spend on this project. There have been various interactions and contributions on GitHub. We would like to thank James Cavenaugh, Ron Keizer and Jack Miller.