• 1 Introduction
  • 2 Authors and Acknowledgments
    • 2.1 Authors
    • 2.2 Contributors
    • 2.3 RxODE acknowledgments:
  • 3 Related R packages
    • 3.1 ODE solving
    • 3.2 PK Solved systems
      • 3.2.1 The following packages for solved PK systems are on CRAN
      • 3.2.2 Non-CRAN libraries:
  • 4 Installation
    • 4.0.1 Windows
    • 4.0.2 Mac OSX
    • 4.0.3 Linux
    • 4.1 Development Version
  • 5 Getting Started
    • 5.1 Specify ODE parameters and initial conditions
    • 5.2 Specify Dosing and sampling in RxODE
    • 5.3 Solving ODEs
  • 6 RxODE syntax
    • 6.1 Example
    • 6.2 Syntax
      • 6.2.1 Identifiers
    • 6.3 Logical Operators
    • 6.4 cmt() changing compartment numbers for states
      • 6.4.1 How RxODE numbers compartments
      • 6.4.2 Changing compartments by pre-declaring with cmt()
      • 6.4.3 Appending compartments to the model with cmt()
  • 7 RxODE events
    • 7.1 RxODE event tables
    • 7.2 Bolus/Additive Doses
    • 7.3 Infusion Doses
      • 7.3.1 Constant Infusion (in terms of duration and rate)
      • 7.3.2 Modeled Rate and Duration of Infusion
    • 7.4 Steady State
      • 7.4.1 Steady state for complex dosing
      • 7.4.2 Steady state for constant infusion or zero order processes
    • 7.5 Reset Events
    • 7.6 Turning off compartments
    • 7.7 Classic RxODE events
      • 7.7.1 Bolus Dose Examples
      • 7.7.2 Infusion Event Examples
      • 7.7.3 Steady State for classic RxODE EVID example
      • 7.7.4 Turning off a compartment with classic RxODE EVID
    • 7.8 Datasets for RxODE & nlmixr
    • 7.9 Columns Described by Type of Use
      • 7.9.1 Subject Identification Columns
      • 7.9.2 Observation Columns
      • 7.9.3 Dosing Columns
      • 7.9.4 Covariate Columns
    • 7.10 Details for Specific Dataset Columns
      • 7.10.1 AMT Column
      • 7.10.2 CENS/LIMIT Columns
      • 7.10.3 CMT Column
      • 7.10.4 DUR Column
      • 7.10.5 DV Column
      • 7.10.6 DVID Column
      • 7.10.7 EVID Column
      • 7.10.8 ID Column
      • 7.10.9 RATE Column
  • 8 Easily creating RxODE events
    • 8.1 Adding doses to the event table
    • 8.2 Adding sampling to an event table
    • 8.3 Expand the event table to a multi-subject event table.
    • 8.4 Add doses and samples within a sampling window
    • 8.5 Combining event tables
    • 8.6 Sequencing event tables
    • 8.7 Repeating event tables
    • 8.8 Combining event tables with rbind
    • 8.9 Expanding events
    • 8.10 Event tables in Rstudio Notebooks
  • 9 Solving and solving options
    • 9.1 General Solving Options
      • 9.1.1 object
      • 9.1.2 params
      • 9.1.3 events
      • 9.1.4 inits
      • 9.1.5 method
      • 9.1.6 stiff
    • 9.2 lsoda/dop solving options
      • 9.2.1 atol
      • 9.2.2 rtol
      • 9.2.3 maxsteps
      • 9.2.4 hmin
      • 9.2.5 hmax
      • 9.2.6 hmaxSd
      • 9.2.7 hini
      • 9.2.8 maxordn
      • 9.2.9 maxords
      • 9.2.10 mxhnil
      • 9.2.11 hmxi
      • 9.2.12 istateReset
    • 9.3 Inductive Linerization Options
      • 9.3.1 indLinMatExpType
      • 9.3.2 indLinMatExpOrder
      • 9.3.3 indLinPhiTol
      • 9.3.4 indLinPhiM
    • 9.4 Steady State Solving Options
      • 9.4.1 minSS
      • 9.4.2 maxSS
      • 9.4.3 strictSS
      • 9.4.4 infSSstep
      • 9.4.5 ssAtol
      • 9.4.6 ssRtol
    • 9.5 RxODE numeric stability options
      • 9.5.1 maxAtolRtolFactor
      • 9.5.2 stateTrim
      • 9.5.3 safeZero
      • 9.5.4 sumType
      • 9.5.5 prodType
      • 9.5.6 maxwhile
      • 9.5.7 transitAbs
    • 9.6 Linear compartment model sensitivity options
      • 9.6.1 sensType
      • 9.6.2 linDiff
      • 9.6.3 linDiffCentral
    • 9.7 Covariate Solving Options
      • 9.7.1 iCov
      • 9.7.2 covsInterpolation
      • 9.7.3 addCov
    • 9.8 Simulation options
      • 9.8.1 seed
      • 9.8.2 nsim
      • 9.8.3 thetaMat
      • 9.8.4 thetaLower
      • 9.8.5 thetaUpper
      • 9.8.6 thetaDf
      • 9.8.7 thetaIsChol
      • 9.8.8 nStud
      • 9.8.9 omega
      • 9.8.10 omegaIsChol
      • 9.8.11 omegaSeparation
      • 9.8.12 omegaXform
      • 9.8.13 omegaLower
      • 9.8.14 omegaUpper
      • 9.8.15 omegaDf
      • 9.8.16 nSub
      • 9.8.17 dfSub
      • 9.8.18 sigma
      • 9.8.19 sigmaLower
      • 9.8.20 sigmaUpper
      • 9.8.21 sigmaXform
      • 9.8.22 sigmaDf
      • 9.8.23 sigmaIsChol
      • 9.8.24 sigmaSeparation
      • 9.8.25 dfObs
      • 9.8.26 resample
      • 9.8.27 resampleID
    • 9.9 RxODE output options
      • 9.9.1 returnType
      • 9.9.2 addDosing
      • 9.9.3 keep
      • 9.9.4 drop
      • 9.9.5 idFactor
      • 9.9.6 subsetNonmem
      • 9.9.7 matrix
      • 9.9.8 scale
      • 9.9.9 amountUnits
      • 9.9.10 timeUnits
      • 9.9.11 theta
      • 9.9.12 eta
      • 9.9.13 from
      • 9.9.14 to
      • 9.9.15 length.out
      • 9.9.16 by
      • 9.9.17 warnIdSort
      • 9.9.18 warnDrop
    • 9.10 Internal RxODE options
      • 9.10.1 nDisplayProgress
      • 9.10.2 …
      • 9.10.3 a
      • 9.10.4 b
      • 9.10.5 updateObject
    • 9.11 Parallel/Threaded Solve
      • 9.11.1 cores
      • 9.11.2 nCoresRV
  • 10 RxODE output
    • 10.1 Using RxODE data frames
      • 10.1.1 Creating an interactive data frame
      • 10.1.2 RxODE solved object properties
      • 10.1.3 Using the solved object as a simple data frame
    • 10.2 Updating the data-set interactively
      • 10.2.1 Modifying initial conditions
      • 10.2.2 Modifying observation times for RxODE
      • 10.2.3 Modifying simulation parameters
  • 11 Simulation
    • 11.1 Single Subject solving
      • 11.1.1 Summary of Single solve vs Multiple subject solving
    • 11.2 Population Simulations with RxODE
      • 11.2.1 Simulation of Variability with RxODE
    • 11.3 Simulation of Clinical Trials
      • 11.3.1 Simulation from inverse Wishart correlations
      • 11.3.2 Simulate using variance/standard deviation standard errors
      • 11.3.3 Simulate without uncertainty in omega or sigma parameters
    • 11.4 Using prior data for solving
  • 12 Examples
    • 12.1 Prediction only models
    • 12.2 Solved compartment models
    • 12.3 Mixing Solved Systems and ODEs
    • 12.4 Weight based dosing
      • 12.4.1 Creating a 2-compartment model in RxODE
      • 12.4.2 Simulating Covariates
      • 12.4.3 Creating weight based event table
      • 12.4.4 Solving Daptomycin simulation
      • 12.4.5 Daptomycin Reference
    • 12.5 Inter-occasion and other nesting examples
      • 12.5.1 Event table
      • 12.5.2 RxODE model
      • 12.5.3 Uncertainty in Model parameters
      • 12.5.4 Nesting Variability
      • 12.5.5 Unexplained variability
      • 12.5.6 Solving the problem
    • 12.6 Transit compartment models
  • 13 Advanced & Miscellaneous Topics
    • 13.1 Covariates in RxODE
      • 13.1.1 Individual Covariates
      • 13.1.2 Time Varying Covariates
    • 13.2 Shiny and RxODE
      • 13.2.1 Facilities for generating R shiny applications
      • 13.2.2 Exploring parameter fits graphically using shiny
    • 13.3 Using RxODE with a pipeline
      • 13.3.1 Setting up the RxODE model for the pipeline
      • 13.3.2 Simulating one event table
      • 13.3.3 Simulating multiple subjects from a single event table
      • 13.3.4 Summarizing the simulation output
    • 13.4 Speeding up RxODE
      • 13.4.1 Increasing RxODE speed by multi-subject parallel solving
      • 13.4.2 A real life example
    • 13.5 Integrating RxODE models in your package
      • 13.5.1 Using Pre-compiled models in your packages
      • 13.5.2 Using Models in a already present package
    • 13.6 Stiff ODEs with Jacobian Specification

RxODE user manual

Chapter 3 Related R packages

3.1 ODE solving

This is a brief comparison of pharmacometric ODE solving R packages to RxODE.

There are several R packages for differential equations. The most popular is deSolve.

However for pharmacometrics-specific ODE solving, there are only 2 packages other than RxODE released on CRAN. Each uses compiled code to have faster ODE solving.

  • mrgsolve, which uses C++ lsoda solver to solve ODE systems. The user is required to write hybrid R/C++ code to create a mrgsolve model which is translated to C++ for solving.

    In contrast, RxODE has a R-like mini-language that is parsed into C code that solves the ODE system.

    Unlike RxODE, mrgsolve does not currently support symbolic manipulation of ODE systems, like automatic Jacobian calculation or forward sensitivity calculation (RxODE currently supports this and this is the basis of nlmixr’s FOCEi algorithm)

  • dMod, which uses a unique syntax to create “reactions”. These reactions create the underlying ODEs and then created c code for a compiled deSolve model.

    In contrast RxODE defines ODE systems at a lower level. RxODE’s parsing of the mini-language comes from C, whereas dMod’s parsing comes from R.

    Like RxODE, dMod supports symbolic manipulation of ODE systems and calculates forward sensitivities and adjoint sensitivities of systems.

    Unlike RxODE, dMod is not thread-safe since deSolve is not yet thread-safe.

And there is one package that is not released on CRAN:

  • PKPDsim which defines models in an R-like syntax and converts the system to compiled code.

    Like mrgsolve, PKPDsim does not currently support symbolic manipulation of ODE systems.

    PKPDsim is not thread-safe.

The open pharmacometrics open source community is fairly friendly, and the RxODE maintainers has had positive interactions with all of the ODE-solving pharmacometric projects listed.

3.2 PK Solved systems

RxODE supports 1-3 compartment models with gradients (using stan math’s auto-differentiation). This currently uses the same equations as PKADVAN to allow time-varying covariates.

RxODE can mix ODEs and solved systems.

3.2.1 The following packages for solved PK systems are on CRAN

  • mrgsolve currently has 1-2 compartment (poly-exponential models) models built-in. The solved systems and ODEs cannot currently be mixed.
  • pmxTools currently have 1-3 compartment (super-positioning) models built-in. This is a R-only implementation.
  • PKPDmodels has a one-compartment model with gradients.

3.2.2 Non-CRAN libraries:

  • PKADVAN Provides 1-3 compartment models using non-superpositioning. This allows time-varying covariates.