rxGetModel: Get the rxode2 model variables without compiling the model

rxGetModelR Documentation

Get the rxode2 model variables without compiling the model

Description

Normalizes the input to an rxModelVars object and optionally rewrites the model text first: adding/stripping forward sensitivity equations (calcSens/calcSens2/calcSens3), adding/removing the df()/dy() Jacobian block (calcJac), dropping LHS definitions (collapseModel), or converting to an inductive linearization model (indLin).

Usage

rxGetModel(
  model,
  calcSens = NULL,
  calcJac = NULL,
  collapseModel = NULL,
  indLin = FALSE,
  calcSens2 = NULL,
  calcSens3 = NULL
)

Arguments

model

The model to get the model variables from. It can be: rxode2 model text (a character string, rxModelText, or a {} expression), a function or call whose body is the model, an rxode2 object, an rxModelVars object, an rxDll object, or anything else rxModelVars() accepts.

calcSens

boolean indicating if rxode2 will calculate the sensitivities according to the specified ODEs. May also be a character vector of the states/parameters whose first-order sensitivities (⁠rx__sens_<state>_BY_<param>__⁠) should be generated.

calcJac

boolean indicating if rxode2 will calculate the Jacobain according to the specified ODEs.

collapseModel

boolean indicating if rxode2 will remove all LHS variables when calculating sensitivities.

indLin

Calculate inductive linearization matrices and compile with inductive linearization support.

calcSens2

character vector (or NULL) requesting second-order sensitivities in addition to the first-order ones from calcSens. When supplied, rxode2 also generates the ⁠rx__sens_<state>_BY_<p>_BY_<q>__⁠ compartments (the Hessian path), where p ranges over calcSens and q over calcSens2. Used, for example, for population (THETA) second-order event sensitivities. NULL (the default) skips the second-order generation.

calcSens3

character vector (or NULL) requesting third-order sensitivities in addition to the first- and second-order ones. Requires calcSens2 to also be supplied (every calcSens3 parameter needs its own already-built second-order sensitivity compartment, from the pairing of calcSens2 with calcSens3, to reference – so calcSens3 should be a subset of calcSens2, which itself should be a subset of calcSens, mirroring how calcSens2 is used everywhere else in rxode2 today). When supplied, generates the ⁠rx__sens_<state>_BY_<p>_BY_<q>_BY_<r>__⁠ compartments, where p ranges over calcSens, q over calcSens2, and r over calcSens3, via rxExpandSens3_(). NULL (the default) skips the third-order generation.

Value

An rxModelVars object of the (possibly rewritten) model

Author(s)

Matthew L. Fidler

Examples


rxGetModel("d/dt(depot) = -ka*depot; d/dt(central) = ka*depot - kel*central")


rxode2 documentation built on July 28, 2026, 5:08 p.m.