Try Our Open Source Tools

At Metrum Research Group, we are strong advocates of open-source software development efforts. In fact, we make several of the useful tools we’ve developed for our own work available as free, open-source software under GPL. You’ll find these tools at the links listed below. If you use these tools in your work, please acknowledge Metrum Research Group, Tariffville, CT 06081 in any derived documents. Some of the tools are also associated with peer-reviewed publications, which are indicated with each distribution, and should also be referenced.

mrgsolve facilitates simulation in R from hierarchical, ordinary differential equation (ODE) based models typically employed in drug development. The modeler creates a model specification file consisting of R and C++ code that is parsed, compiled, and dynamically loaded into the R session. Input data are passed in and simulated data are returned as R objects, so disk access is never required during the simulation cycle after compiling. Features include:

  • NMTRAN-like input data sets
  • Bolus, infusion, compartment on/off and reset functionality
  • Bioavailability, ALAG, SS, II, ADDL, MTIME
  • Multivariate normal random effects simulated using RcppArmadillo
  • Compatible with parameter estimation and design packages in R (nlme, saemix, PopED, PFIM)
  • Integration with data summary (dplyr) and plotting (ggplot, lattice) packages
  • Parallelization with existing R infrastructure (mclapply) or Sun Grid Engine (qapply)
  • Compatible with output from many different model estimation platforms
  • Easily integrated with Shiny to create model-visualization applications

mrgsolve is a powerful and efficient tool for simulation from ODE-based PK/PD and systems pharmacology models. The resulting computational efficiency facilitates model exploration and application, during both model development and decision-making phases of a drug development program.

Get mrgsolve

Torsten is a collection of Stan functions to facilitate analysis of pharmacometric data using Stan, a flexible open-source software platform for Bayesian data analysis using Hamiltonian Monte Carlo (HMC) simulation—a type of MCMC simulation. 

The current version of Torsten includes functions for:

  • Specific linear compartment models:
    • One compartment model with first-order absorption.
    • Two compartment model with elimination from and first-order absorption into central compartment.
  • General linear compartment models described by systems of first-order \underline{linear} ordinary differential equations (ODEs).
  • General compartment models described by a system of first-order ODEs.
  • Mixed compartment models with a PK forcing function described by linear one or two compartment model.

Torsten provides Stan language functions that calculate amounts in each compartment, given an event schedule and an ODE system. The models and data format are based on NONMEM®/NMTRAN/PREDPP conventions. The most recent versions of Torsten support within chain parallel computation for models that require numerical solution of ODEs.

Get Torsten


bbr is an R interface that helps scientists manage M&S workflows that involve a number of software used in the pharmaceutical sciences, including NONMEM. Users can submit models, consume outputs and diagnostics, and iterate on models. It provides workflow tools, like simple tagging of models and model inheritance trees, that make reproducibility and external review much more efficient. bbr optimizes model development by introducing efficiencies and supporting reproducibility and traceability.


pkgr is a rethinking of the way packages are managed in R. Namely, it embraces the declarative philosophy of defining ideal state of the entire system, and working towards achieving that objective. Furthermore, pkgr is built with a focus on reproducibility and auditability of what is going on, a vital component for the pharmaceutical sciences + enterprises.  More details here.

Bugs Model Library

BUGSModelLibrary is a prototype PKPD model library for use with WinBUGS 1.4.3. The current version includes specific linear compartmental models (one compartment model with first order absorption and two compartment model with elimination from and first order absorption into central compartment), general linear compartmental model described by matrix exponential, and general compartmental model described by a system of first order ODEs. The models and data are based on NONMEM/NMTRAN/PREDPP conventions including recursive calculation (this permits piecewise constant covariate values), bolus or constant rate inputs into any compartment, handles single dose, multiple dose and steady-state dosing histories, implemented NMTRAN data items including TIME, EVID, CMT, AMT, RATE, ADDL, II, and SS.

The library provides BUGS language functions that calculate amounts in each compartment.


Initially developed by MetrumRG in 2005 as an open source tool to automate NONMEM® source code patching and installation documentation, NMQual has been routinely utilized by MetrumRG and others to facilitate the installation, qualification, and running of NONMEM®. Due to vendor changes in the NONMEM® code patching and installation strategies and the adoption of alternative methods for software/computing platform qualification, MetrumRG no longer uses, develops, or supports NMQual. You may still download open-source NMQual from bitbucket, with the understanding that this tool is no longer supported. If you have any questions or comments, please feel free to contact us.


The lapply(x, FUN) function in R ( returns a list of the same length as x, with each resulting element being the result of FUN to an element of x. Open Grid Scheduler/Engine is an open source batch-queuing system, developed and based upon Sun Grid Engine. While several packages provide implementations of parallel “apply” structures in CRAN (e.g., snow, Rmpi), none utilize the scheduling capabilities of Grid Engine. The ability to queue jobs (e.g., MCMC chains) works with well with elastic variants of cluster computing. Using qapply, the user can stack the queue and load balance the computational task, adding and removing computational resources as necessary to complete the task in an efficient manner.


Plots for pharmacometrics. pmplots provide light wrappers around ‘ggplot2’ plotting code tailored for pharmacometric applications.


Tables for pharmacometrics. pmtables is an R package that allows you to summarize data sets and create publication-quality tables for inclusion in ‘tex’ documents.


Pharmacometric tools for common data preparation tasks, stratified bootstrap resampling of data sets, NONMEM control stream creation/editing, NONMEM model execution, creation of standard and user-defined diagnostic plots, execution and summary of bootstrap and predictive check results, implementation of simulations from posterior parameter distributions, reporting of output tables and creation of detailed analysis logs.

Bugs Parallel

bugsParallel is a set of R functions for distributed computing with WinBUGS. BugsParallel has been successfully installed on MS Windows and Mac OS X platforms, is a modified subset of the R2WinBugs package, uses the R package Rmpi to implement a network of Windsor workstations, and uses the rlecuyer package for parallel random number generation.

When used for a Bayesian analysis, Markov chain Monte Carlo (MCMC) simulations generate samples that approximate the joint posterior distribution of the sampled parameters. The sequential nature of MCMC simulation limits the benefits of parallel computation when applied to a single chain. However parallel computation of multiple chains is an “embarassingly parallel” problem that can substantially reduce computation time and is relatively easy to implement using bugsParallel in combination with other freely available software.


These functions provide simple wrappers around the Unix process management API calls: fork, signal, wait, waitpid, kill, and _exit. This enables the construction of programs that utilize and manage multiple concurrent processes.


Functions for managing logs of reviews of files in a subversion repository (


This package provides functions for reading, listing the contents of, and writing SAS xport format files. The functions support reading and writing of either individual data frames or sets of data frames. Further, a mechanism has been provided for customizing how variables of different data types are stored.


Tools for compiling and reporting meta-data collected during data manipulations. Changes to record and subject counts can be tracked and reported in tabular and flow-chart formats. Allows for greater transparency and accountability during data assembly.