Model changes in DES
In the section of ODE and dosing, we saw that a finite infusion dose changes the ODE system by adding the infusion rate on the RHS. NONMEM provides a general way to extend this concept of system changes at given time, through random variable MTIME.
Consider the Enterohepatic Recycling (EHC) model below ("examples/mtimehill").
|
|
The model has drug transfer from compartment 4 to 1 that only appears during a certain period of time (to reflect EHC). To estimate the beginning and end of this period, we model them as MTIME(1) and MTIME(2), respectively. Then values of the internal indicator variable MNEXT, MPAST, and MNOW is shown in the follow scheme.
|
|
In other words, MNEXT(i) and MPAST(i) flag the "before" and "after" of MTIME(i), and MNOW stores the counter of MNEXT. Therefore, we define FLAG on line 40 such that FLAG=1 during time interval (MTIME(1), MTIME(2)], indicating the transfer between the two compartments.
Note that MTIME variables are ignored during Steady-State calculation.
This is because steady states are intended for
a single repeated dose with no changes in the status of the system.
Hence the $INPUT... SS=DROP option.
Smooth changes of DES
In the above example, the derivative DADT is discontinuous at MTIME(1) and MTIME(2), i.e., the changes to the ODEs is instataneous (though the states A stays continuous). To make DADT continuous, we can use a smooth function that changes between 0 and 1 as FLAG. Consider the following alternative implementation of the EHC model ("examples/mtimehill").
|
|
Here we construct two Hill functions of the independent time variable T
that change their values in the neighborhood of time mt1 and mt2, and use their
differences as the smooth FLAG that rises from 0 to 1 around mt1 and
back to 0 around mt2. THETA(10), the exponent in the Hill
functions, represents how fast the derivatives change. The greater it
is the closer the system approache the earlier model using MTIME for
instataneous changes.
Note unlike the model using MTIME, stead-state dose is allowed here. But keep in mind the changes in differential equations do not act retroactively: the action of FLAG in the future does not affect the steady-state calculations. Specifically, with data (the first a few records of the data file for "examples/mtimehill")
|
|
that specifies II=12, the $DES changes at THETA(8) and
THETA(8)+THETA(9) after the the start of the begin of intervals (0, 12),
(12, 24), etc, when the system is steady-state. This is done by using
INT (integer function)
|
|
Periodic discontinuities in $DES
Changes in $DES could be periodic. One classical example is circadian
rhythm. Consider the following model that has a change in $DES every
24 hours ("examples/step_circexa").
|
|
Simlar to the first model earlier, FLAG is the difference of MPAST
variables. The MTIME(1) and MTIME(2) variables respectively define the times at
which FLAG is set to 1 and 0, such as MTIME(2)-MTIME(1)=DUR. After
MTIME(2) is reached, both variables are incremented by 24, and the
FLAG update process perpetuates itself every 24 hours. Compartment 1
is a dummy compartment intended to monitor the
FLAG variable: the amount A1 starts at 0 and is incremented by DUR
every day. A related information is the time at which the current
state vector was computed, i.e. the time to which the system was most
recently advanced. It is reported in the reserved variable TSTATE.
Both $TABLE and WRITE are used in to report the values of the
variables of interest. WRITE statements are used because $TABLE
functions only for event records, but not for nonevent times such as
Model times.
For an extension of the above example, consider the following biological response
\begin{equation} R(t) = R_{\text{min}} + a\sin(z(t)), \quad t\in [t_{\text{shift}}+24n, t_{\text{shift}}+t_{\text{dur}} + 24n]. ) \end{equation}Here \(R_{\text{min}}\) is the flat baseline, \(n\) the counter, \(z(t)\) the circadian function of time \(t\) that scales the sinusoidal response interval to \([0, \pi]\). This model can be used to describe the response baseline of a drug that influences circadian rhythms related biological processes, e.g. metabolic effects of corticoids. If the effect of the drug is not direct, one can express the biological response and the drug effect in terms of an indirect response model. For example, assume an agonist that stimulates the formation of the said biological processes, we can model the response as
$$ \frac{dR}{dt} = k_{\text{in}}(t)(1+s(C)) - k_{\text{out}}R. $$ where \(k_{\text{out}}\) is the constant elimination rate of the response, \(k_{\text{in}}\) the time-varying formation rate, and \(s(C)\) the stimulation that depends on drug concentration \(C\). The Eq.(1) then describes the response baseline in the absence of drug, $$ \frac{dR}{dt} = k_{\text{in}}(t), $$ where \(K_{\text{in}}\) is sinusoidal inside certain intervals and constant otherwise. Again we use a FLAG variable to model it ("examples/idr_circexa").
|
|
The $DES block describes the response as the state variable. Line 120
defines a continuous 24h clock time, through the circadian reset of
the MTIME(3) variable in $PK. Note that here \(z(t)\) is implemented
using the INTMTIME variable that records MTIME(1).