Learn R Programming

babelmixr2

The goal of babelmixr2 is to convert nlmixr2 syntax to other commonly used tools.

Installation

You can install the released version of babelmixr2 from CRAN with:

install.packages("babelmixr2")

You can install from r-universe by:

# Download and install babelmixr2 in R
install.packages('babelmixr2',
                 repos = c(
                   nlmixr2 = 'https://nlmixr2.r-universe.dev',
                   CRAN = 'https://cloud.r-project.org'))

Otherwise you can always install from GitHub:

What you can do with babelmixr2

Babelmixr2 can help you by:

  • Running your nlmixr2 model in a commercial nonlinear mixed effects modeling tool like NONMEM or Monolix

  • Convert your NONMEM model to a nlmixr2 model (in conjunction with nonmem2rx)

  • Convert you Monolix model to a nlmixr2 model (in conjunction with monolix2rx)

  • Calculate scaling factors and automatically add initial conditions based on non-compartmental analysis (using PKNCA)

  • Perform Optimal design using nlmixr2 as an interface to PopED

Monolix Setup

While not required, you can get/install the R ‘lixoftConnectors’ package in the ‘Monolix’ installation, as described at the following url https://monolixsuite.slp-software.com/r-functions/2024R1/installation-and-initialization. When ‘lixoftConnectors’ is available, R can run ‘Monolix’ directly instead of using a command line.

PKNCA Example

After installed, if you use the standard interface, you can obtain new initial estimates with PKNCA:

mod <-
  nlmixr2(
    nlmixrFun, nlmmixrData, est = "pknca",
    control = pkncaControl(concu = "ng/mL", doseu = "mg", timeu = "hr", volumeu = "L")
  )

Monolix example

With babelmixr2 loaded, you can use nlmixr2 to convert a nlmixr2 model to Monolix, run with monolix, and import back to nlmixr2 with the following:

mod <- nlmixr(nlmixrFun, nlmmixrData, est="monolix")

NONMEM example

With babelmixr2 loaded you can use nlmixr2 to convert a nlmixr2 model to NONMEM, run NONMEM and import back to nlmixr2 with the following:

mod <- nlmixr(nlmixrFun, nlmmixrData, est="nonmem")

Copy Link

Version

Install

install.packages('babelmixr2')

Monthly Downloads

640

Version

0.1.9

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Matthew Fidler

Last Published

August 31st, 2025

Functions in babelmixr2 (0.1.9)

nlmixr2Est.pknca

Estimate starting parameters using PKNCA
.popedSolveIdME

Solve poped problem for appropriate times with single/multiple endpoint models
modelUnitConversion

Unit conversion for pharmacokinetic models
.setupPopEDdatabase

Setup the poped database
fmeMcmcControl

Control for fmeMcmc estimation method in nlmixr2
getStandardColNames

Determine standardized rxode2 column names from data
monolixControl

Monolix Controller for nlmixr2
.pseudoOptimF

When the model is loaded, this function is called to evaluate the -2* log-likelihood value for FME::modMCMC()
nmGetDistributionMonolixLines

This is a S3 method for getting the distribution lines for a base rxode2 saem problem
.popedW

Get the weight from the rxode2 solve
popedMultipleEndpointResetTimeIndex

Reset the Global Time Indexer for Multiple Endpoint Modeling
pkncaControl

PKNCA estimation control
reexports

Objects exported from other packages
popedGetMultipleEndpointModelingTimes

Get Multiple Endpoint Modeling Times
popedMultipleEndpointParam

Populates Multiple Endpoint Parameters for internal solving
nmGetDistributionNonmemLines

This is a S3 method for getting the distribution lines for a base rxode2 saem problem
nonmemControl

NONMEM estimation control
rxToMonolix

Convert RxODE syntax to monolix syntax
pseudoOptimControl

Control for fmeMcmc estimation method in nlmixr2
popedControl

Control for a PopED design task
rxToNonmem

Convert RxODE syntax to NONMEM syntax
simplifyUnit

Simplify units by removing repeated units from the numerator and denominator
.popedCluster

Internal function to use with PopED to run PopED in parallel on Windows
babelBpopIdx

Get the bpop_idx by variable name for a poped database created by babelmixr2
as.nlmixr2

Convert an object to a nlmixr2 fit object
.popedRxRunSetup

Setup poped if needed
.fmeMcmcF

When the model is loaded, this function is called to evaluate the -2* log-likelihood value for FME::modMCMC()
.popedF

Get the function value from the rxode2 solve
.popedSetup

Setup the PopED environment
babel.poped.database

Expand a babelmixr2 PopED database
.popedFree

Free Poped memory (if any is allocated)
bblDatToMonolix

Convert nlmixr2-compatible data to other formats (if possible)