A Model Library for 'nlmixr2'

A model library for 'nlmixr2'. The models include (and plan to include) pharmacokinetic, pharmacodynamic, and disease models used in pharmacometrics. Where applicable, references for each model are included in the meta-data for each individual model. The package also includes model composition and modification functions to make model updates easier.


R-CMD-check Codecov test coverage CRAN status

nlmixr2lib

This is a model library for nlmixr2. The package allows a few ways to interact with the model library:

# See all available models
modellib()
# Load the "PK_1cmt" model
modellib(name="PK_1cmt")
# Switch residual error to additive
modellib(name="PK_1cmt", reserr = "addSd")
# Add inter-individual variability on ka and v and switch residual error to
# additive and proportional
modellib(name="PK_1cmt", eta = c("lka", "lv"), reserr = c("addSd", "propSd"))

Modifying models by piping

You may also modify any model from the library (or your own models) with a piping interface. The code below adds inter-individual variability on ka and v and then switches residual error to additive and proportional.

modellib(name="PK_1cmt") |>
  addEta(c("lka", "lv") |>
  addResErr(c("addSd", "propSd"))

Possible extensions

The modellib function is set-up in way that it can be easily extended and used in other applications. A possible extension could be implementation in a shiny app. An app can be created to easily add new models to the model library database (curated?), and directly make these models available for other users. I believe there can be added value in having a base model library that can be easily extended by the community this way.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("nlmixr2lib")

0.3.2 by Bill Denney, 9 months ago


https://github.com/nlmixr2/nlmixr2lib, https://nlmixr2.github.io/nlmixr2lib/


Browse source code at https://github.com/cran/nlmixr2lib


Authors: Richard Hooijmaijers [aut] , Matthew Fidler [aut] , Bill Denney [aut, cre] , Kiranmayi Vedantham [aut] (ORCID:


Documentation:   PDF Manual  


GPL (>= 2) license


Imports checkmate, cli, methods, nlmixr2est, rxode2

Suggests covr, dplyr, knitr, rmarkdown, testthat, qs2, tidyr, ggplot2, withr


Suggested by nlmixr2, nlmixr2extra, ruminate.


See at CRAN