Simulating Adaptive Dosing Regimens from PK and PKPD Models Using mrgsolve
Authors: Baron Kyle 
Published: February 2025

Objective: Adaptive or dynamic dosing in pharmacokinetic (PK) or pharmacokinetic pharmacodynamic (PKPD) models allows for changes in the dose regimen in response to changes in model state variables over the course of a simulation [1]. In contrast to fixed dosing with all doses specified in the data set prior to simulating, adaptive dosing requires special handling to update the regimen at various points after the simulation starts. A common way to handle this problem is to interrupt the simulation at milestone observation times to assess the current state and history, decide what changes to the regimen are needed, implement those changes, and restart the simulation. This approach can involve additional complexity for tracking the simulation history and can be computationally inefficient. The objective of this work was to address these limitations with an extension to the mrgsolve package for R allowing the dose regimen to be completely specified in the model code.Methods: mrgsolve is a freely available open-source R package, available on GitHub [2], for simulating from compartmental PK and PKPD models commonly used in pharmacometrics. The package was developed and is maintained using a transparent, open-source software development life cycle (SDLC) process, incorporating iterative development, validation, and release. Development of the adaptive dosing extension was based on experience implementing these simulations over the course of several different modeling and simulation projects. The initial release focused on a limited feature set to help identify a stable, extensible simulation API. Unit tests for each feature were developed and the code was reviewed according to the SDLC process. Features were documented in the mrgsolve user guide [3].Results: The adaptive dosing extension was released in February 2024 (mrgsolve v1.4.1) as a plugin called evtools. When invoked, functions and objects to support adaptive dosing are made available under the evt namespace. Dosing information is specified by the user in the model code and sent back to mrgsolve package code through a C++ struct with type ev. The initial feature set included functionality to execute single doses (bolus or infusion) at arbitrary times during the simulation or as a regimen following a regular dosing interval. Single-dose objects are executable at the time of creation or retimed to happen later in the simulation. Repeated dosing was implemented through a regimen object with attributes for dose amount (amt), compartment (cmt), interval (ii), administration rate (rate), and termination time (until). A method (flagnext) was also included to ensure the simulation explicitly runs through each dose time in case the observation schedule is sparse. Conclusions: The evtools plugin to mrgsolve is a powerful tool for executing simulations involving adaptive or dynamic dosing. Because the dose regimen is managed from within the model itself, simulations remain computationally efficient.Citations: [1] https://www.ncbi.nlm.nih.gov/pmc/articles/PMC10681481/[2] https://github.com/metrumresearchgroup/mrgsolve[3] https://mrgsolve.org/user-guide/