nlmixr2.ndexr.io

Population PK/PD modelling, in R, regulatory-grade.

nlmixr2 is the open-source R stack for fitting nonlinear mixed-effects models — the workhorse of population pharmacokinetics. Same model language as rxode2 , same fit object as a pharmacometrician expects, four estimation engines, and a deliberate path toward NONMEM / Monolix parity.

Open call · April 2026
Help build the nlmixr2lib model library

Bill Denney (Human Predictions, nlmixr2 co-author and nlmixr2lib maintainer) is on a public push to re-implement every published population PK and PK/PD model that has used nlmixr2 — about 100 of a planned 10,000+ — in a freely-available, standardised, parameter-validated form inside nlmixr2lib .

If you've co-authored a manuscript with a popPK or PK/PD model in nlmixr2 — or know of regulatory drug-review documents containing one — Bill is asking you to send the paper, supplements, and (if you're allowed to share it) the model code.

Email: bdenney@humanpredictions.com · LinkedIn: billdenney · Repo: github.com/nlmixr2/nlmixr2lib . (Surfaced here April 2026 — verify the call is still active before sending, and never share material you don't have rights to redistribute.)

What it is

Pharmacometrics has been a NONMEM-shaped world for thirty years. The model file format, the QA processes, the FDA reviewer expectations — all built around it. nlmixr2 is the credible open-source alternative that keeps the modeller's mental model intact:

  • A single R function defines the ini (parameters + bounds + ETA structure) and the model (ODE / linear-CMT system + residual error).
  • Differential equations are compiled to C by rxode2 and solved with LSODA / dopri5 / Liblsoda — fast enough for SAEM with thousands of subjects.
  • Four estimation engines in one interface: SAEM, FOCEi, FO, and nlme — switch with a string.
  • Standard popPK objects : parameter table, OFV, condition number, EBE / IPRED, NPDE, CWRES, GOF plots, VPC.
  • Bridges out : babelmixr2 runs the same model through NONMEM or Monolix; xpose.nlmixr2 feeds the fit into Xpose for diagnostics; nonmem2rx / monolix2rx import existing legacy models.

Project home: nlmixr2.org . Code: github.com/nlmixr2 . Lead author: Matthew Fidler (Novartis), with Bill Denney, Wenping Wang, Rik Schoemaker, John Harrold, and others.

A complete fit, end to end

The classic Theophylline example: one-compartment first-order absorption, between-subject variability on Ka / Cl / V, additive residual error, fit by SAEM. Lifted from ?nlmixr2est::addNpde — runs unchanged against the version we mirror.

                library(nlmixr2)

# A one-compartment, first-order absorption model.
# Parameters are population means (theta, log scale) and between-subject
# random effects (eta) on each. Residual additive error on the linear-CMT
# concentration prediction.
one.cmt <- function() {
  ini({
    tka <- 0.45                          # log Ka
    tcl <- log(c(0, 2.7, 100))           # log Cl, with bounds
    tv  <- 3.45;            label('log V')
    eta.ka ~ 0.6
    eta.cl ~ 0.3
    eta.v  ~ 0.1
    add.sd <- 0.7
  })
  model({
    ka <- exp(tka + eta.ka)
    cl <- exp(tcl + eta.cl)
    v  <- exp(tv  + eta.v)
    linCmt() ~ add(add.sd)
  })
}

# Fit it. theo_sd is bundled in nlmixr2data — Theophylline single-dose, 12 subjects.
fit <- nlmixr2(one.cmt, theo_sd, est = 'saem')

# Diagnostics
fit                         # parameter table, OFV, condition number
plot(fit)                   # GOF panels via nlmixr2plot
fit <- addNpde(fit)         # normalised prediction-distribution errors
fit <- addCwres(fit)        # conditional weighted residuals
              

Install from our mirror: install.packages("nlmixr2", repos = "https://repo.ndexr.io/cran", dependencies = TRUE) . Compilers required (RTools on Windows, Xcode + gfortran on macOS) — rxode2 compiles the ODE system at fit time.

Packages we mirror
Live mirror state →
nlmixr2 5.0.0

Umbrella package — attaches the whole stack and resolves conflicts.

nlmixr2est 5.0.2

Estimation engines: SAEM, FOCEi, FO, nlme, nlm wrappers, fit-object machinery.

nlmixr2extra 5.0.0

Bootstrap, profile likelihood, covariate selection, model averaging.

nlmixr2plot 5.0.1

GOF panels, VPCs, residual plots — the diagnostics expected on a popPK report.

nlmixr2data 2.0.9

Reference datasets: theo_sd / theo_md, warfarin, mavoglurant, pheno_sd, oral / bolus / infusion 1- and 2-CPT.

nlmixr2lib 0.3.2

Library of pre-built model templates — PK, PK/PD, target-mediated, Emax.

nlmixr2auto 1.0.0

Automated covariate selection (SCM-style stepwise).

nlmixr2autoinit 1.0.0

Automated initial-estimate generation from naive-pooled fits.

nlmixr2rpt 0.2.2

PowerPoint / Word reporting — drop a fit object in, get a regulatory-style deck.

xpose.nlmixr2 0.4.1

Adapter from a fit object into the Xpose diagnostic framework.

rxode2 5.0.2

ODE solver + model language. Compiles your model to C, dosing record machinery, simulation.

lotri 1.0.3

Block-diagonal random-effects matrices written as a + b ~ c(.,.,.) .

babelmixr2 0.1.11

Run the same nlmixr2 model through NONMEM or Monolix; bridge to PKNCA and PopED.

PreciseSums 0.7

Numerically stable summation primitives used by the SAEM kernel.

n1qn1 6.0.1-14

Quasi-Newton optimiser used as a FOCEi fallback.

symengine 0.2.11

Symbolic differentiation backend for analytic gradients.

PopED 0.7.0

Optimal experimental design — companion package, same fit-object idiom.

Estimation engines

Switch between methods by changing one string. All are documented in ?nlmixr2AllEst ; SAEM is the default for new fits because it converges reliably on stiff popPK problems.

est = "saem"
Stochastic Approximation EM

Robust to bad initial estimates, handles many ETAs, the workhorse for popPK. Default tuning works for most one- and two-compartment models.

est = "focei"
First-Order Conditional Estimation w/ Interaction

NONMEM's classic — fastest on well-conditioned problems, requires reasonable inits. Same OFV as NONMEM to within numerical tolerance.

est = "foce"
FOCE without interaction

Closed-form when residual error is independent of inter-individual variability.

est = "fo"
First-Order

The original NONMEM method. Kept for compatibility with legacy submissions.

est = "nlme"
Nonlinear mixed-effects (Lindstrom-Bates)

Calls nlme::nlme under the hood — useful when you want the closed-form Laplace approximation and reproducibility against legacy R workflows.

est = "nlm/nlminb/n1qn1"
Pure-likelihood optimisers

For non-mixed (single-subject) models or quick sanity checks. Wraps base R optimisers in the nlmixr2 fit-object idiom.

Bundled datasets

Shipped in nlmixr2data and used as reference examples across the documentation. Every model in nlmixr2lib is exercised against one of these so you can run the whole library locally.

theo_sd / theo_md

Theophylline, single- and multiple-dose, 12 subjects. The Hello-World of popPK.

warfarin

PK/PD, S-warfarin concentrations and prothrombin-complex activity. PD with effect compartment.

mavoglurant

Mavoglurant clinical PK — irregular sampling, many subjects, real-world messy.

pheno_sd

Phenobarbital in neonates — body weight as a covariate on clearance.

Oral_1CPT / 2CPT

Simulated oral PK, one- and two-compartment. Linear and Michaelis-Menten variants.

Bolus_1CPT / 2CPT

Simulated IV bolus PK — clean reference cases for comparing estimators.

Infusion_1CPT / 2CPT

Simulated IV infusion PK — for testing rate / dur encoding.

rats / pump

Classic NLME teaching datasets — survival / failure-time, non-PK.

wbcSim / metabolite / nimoData

PD-only and parent-metabolite simulations for testing more elaborate models.

Where it lives in our mirror

Every package above is in our CRAN mirror at s3://ndexr/cran/src/contrib/ . Verified at write time:

                s3://ndexr/cran/src/contrib/nlmixr2_5.0.0.tar.gz
s3://ndexr/cran/src/contrib/nlmixr2est_5.0.2.tar.gz
s3://ndexr/cran/src/contrib/nlmixr2extra_5.0.0.tar.gz
s3://ndexr/cran/src/contrib/nlmixr2plot_5.0.1.tar.gz
s3://ndexr/cran/src/contrib/nlmixr2data_2.0.9.tar.gz
s3://ndexr/cran/src/contrib/nlmixr2lib_0.3.2.tar.gz
s3://ndexr/cran/src/contrib/nlmixr2auto_1.0.0.tar.gz
s3://ndexr/cran/src/contrib/nlmixr2autoinit_1.0.0.tar.gz
s3://ndexr/cran/src/contrib/nlmixr2rpt_0.2.2.tar.gz
s3://ndexr/cran/src/contrib/xpose.nlmixr2_0.4.1.tar.gz
s3://ndexr/cran/src/contrib/rxode2_5.0.2.tar.gz
s3://ndexr/cran/src/contrib/lotri_1.0.3.tar.gz
s3://ndexr/cran/src/contrib/babelmixr2_0.1.11.tar.gz
s3://ndexr/cran/src/contrib/PopED_0.7.0.tar.gz
s3://ndexr/cran/src/contrib/PreciseSums_0.7.tar.gz
s3://ndexr/cran/src/contrib/n1qn1_6.0.1-14.tar.gz
s3://ndexr/cran/src/contrib/symengine_0.2.11.tar.gz
              

Live coverage at repo.ndexr.io (filter nlmixr2 , rxode2 , babelmixr2 in the package column).