
Differentiate and expand a matrix exponential model with forward sensitivities
Source:R/indLin.R
rxSensMatExp.RdDifferentiate and expand a matrix exponential model with forward sensitivities
Usage
rxSensMatExp(
model,
calcSens,
calcSens2 = NULL,
calcSens3 = NULL,
doConst = FALSE,
env = NULL
)Arguments
- model
rxode2 model, text, or function
- calcSens
A character vector of parameter names for which sensitivities should be calculated.
- calcSens2
character vector (or
NULL) requesting second-order (Hessian-path) matrix-exponential sensitivitiesrx__sens_<x>_BY_<p>_BY_<q>__, wherepranges overcalcSensandqovercalcSens2. Every element ofcalcSens2must also appear incalcSens(its own first-order sensitivity compartment must already exist for the cross terms to reference). Mirrorsrxode2(calcSens2=)for ordinary ODE models (?rxode2); unlike that path (which reuses the generic.rxSens()/rxExpandSens2_()machinery),matExp()/indLin()models cannot containd/dt()lines, so the second-order sensitivity ODEs are expressed the same way as the first-order ones: ask_from_tomicro-constant transfers into therx__sens_<x>_BY_<p>_BY_<q>__compartments. Ignored (with no compartments generated) for any state that is part of alinCmt()compartment – linCmt sensitivities come from Stan forward-AD, not this Jacobian-based expansion.- calcSens3
character vector (or
NULL) requesting third-order sensitivitiesrx__sens_<x>_BY_<p>_BY_<q>_BY_<r>__, wherepranges overcalcSens,qovercalcSens2, androvercalcSens3. RequirescalcSens2to be supplied; every element ofcalcSens3must also appear incalcSens2. Same linCmt exclusion ascalcSens2.- doConst
Replace constants with values; By default this is
FALSE.- env
A pre-loaded symengine environment (as returned by
.rxLoadPrune()) to reuse instead of reloadingmodelfrom scratch. WhenNULL(the default), the environment is built internally frommodel/doConst. Passing an existingenvlets callers that have already loaded/pruned the model (e.g. to inject matrix-exponentiald/dt()terms or other model modifications) feed that same environment in, so the sensitivity expansion sees those modifications instead of re-deriving them from the originalmodeltext.