Computing additional outputs such as AUC and Cmax in the structural model is possible but requires a particular syntax, because it is not possible to redefine a variable in Mlxtran. For example, it would not be possible to directly update the variable Cmax = Cc when Cc>Cmax. But it is possible to compute Cmax via an ODE, where Cmax increases like Cc at each time where Cc>Cmax. This page gives detailed examples for the AUC on full time interval or specific interval, Cmax, nadir, and other derived variables such as duration above a threshold.

- AUC on full time interval and fast computation with linear ODE
- Time interval AUC
- Fast computation with linear ODE and dose interval AUC (AUCtau)
- Cmax or nadir
- Time above a threshold
- Time since disease progression

Often the Area under the PK curve (AUC) is needed as an important PK metric to link with the pharmacodynamic effect. We show here how to:

- compute the AUC within the mlxtran model file
- output the AUC calculations for later analysis.

Calculation of the AUC can be done in the EQUATION section of the Mlxtran model. If a dataset contains the AUC observations, then the calculation in the EQUATION section can be used as an output in the output={} definition (matched to observations of the data set). Or it can be saved for post-treatment using table={}, as described here.

## AUC for t=0 to t=tend

The following code is the basic implementation of the AUC for a 1-compartmental model with the absorption rate ka. It integrates the concentration profile from the start to the end of the observation period.

input = {ka, V, Cl} PK: compartment(cmt=1, amount=Ac, volume=V, concentration=Cc) elimination(cmt=1, Cl) oral(ka, cmt=1) EQUATION: ddt_AUC = 1/V * Ac OUTPUT: output = {Cc} table = {AUC}

## AUC in a time interval

The following code computes the AUC to a specific time period 50 < t < 100:

input = {ka, V, Cl} PK: depot(ka, target=Ac) EQUATION: odeType = stiff Ac_0 = 0 ddt_Ac = -Cl/V*Ac Cc = Ac/V AUC50_0 = 0 if(t < 50) dAUC50 = 1/V * Ac else dAUC50 = 0 end ddt_AUC50 = dAUC50 AUC100_0 = 0 if(t < 100) dAUC100 = 1/V * Ac else dAUC100 = 0 end ddt_AUC100 = dAUC100 AUC50_100 = AUC100 - AUC50 OUTPUT: output = {Cc} table = {AUC50_100}

*Note that the t==tDose would not work because the integrator does not necessarily evaluate the time exactly at the times of doses. Thus the test t==tDose might not be tested at all during the computation.*

## Fast computation with linODE and dose interval AUC (AUCtau)

In many cases the mlxtran code above is sufficient. To increase the speed of calculation, you can use a special solver for linear ODE systems by specifying odeType = linear in the EQUATION section. But remember that is reduces the accuracy of the computations. Also it does not work with the “if statements”.

The following code compute the AUC for each dose interval. At each dose the AUC is set to zero and the concentration is integrated until the next administration.

input = {ka, V, Cl} PK: compartment(cmt=1, amount=Ac, volume=V, concentration=Cc) elimination(cmt=1, Cl) oral(ka, cmt=1) ; Create a separate dummy compartment for the AUC compartment(cmt=2, amount=AUCtau) iv(cmt=2, p= - AUCtau/amtDose) EQUATION: odeType = linear ddt_AUCtau = 1/V * Ac OUTPUT: output = {Cc} table = {AUC}

## Computing the Cmax or nadir in the structural model

### Cmax

Cmax can be calculated directly in the structural model by integrating the increase of the concentration. The following example shows how to do it in case of a one-compartment model with first-order absorption and linear elimination:

[LONGITUDINAL] input = {Cl, ka, V} PK: depot(target=Ad) EQUATION: ; initial conditions t_0 = 0 Ad_0 = 0 Ac_0 = 0 ddt_Ad = -ka*Ad ddt_Ac = ka*Ad - k*Ac Cc = Ac/V ; Calculation of Cmax slope = ka*Ad -k*Ac Cmax_0 = 0 if slope > 0 && Cc > Cmax x = slope/V else x = 0 end

ddt_Cmax = x

If the dose is administered as bolus, it is necessary to add in the model a very short infusion. This prevents from the instantaneous increase of the concentration. The following example shows this situations in case of a three-compartments model with linear elimination. The duration of the “short infusion” can be adapted with respect to the time scale by modifying dT=0.1.

If you prefer to keep strict bolus administrations, then you can re-simulate the project with simulx and post-process the result in R to extract the Cmax.

If the doses are administered via iv infusion, then dT=0.1 can be replaced by dT = inftDose, which reads the infusion duration from the data.

[LONGITUDINAL] input = {Cl, V1, Q2, V2, Q3, V3} EQUATION: ; Parameter transformations V = V1 k = Cl/V1 k12 = Q2/V1 k21 = Q2/V2 k13 = Q3/V1 k31 = Q3/V3 ; initial conditions t_0 = 0 Ac_0 = 0 A2_0 = 0 A3_0 = 0 ;short pseudo-infusion duration dT = 0.1 ; use dT=inftDose if the administration is infusion: inftDose is the infusion duration from the last dose read from the data ; infusion input to Ac if t < tDose+dT input = amtDose/dT ;amtDose is the last dose amount read from the data else input = 0 end dAc = input -k*Ac - k12*Ac - k13*Ac + k21*A2 + k31*A3 ddt_Ac = dAc ddt_A2 = k12*Ac - k21*A2 ddt_A3 = k13*Ac - k31*A3 Cc = Ac/V ; Calculation of AUC AUC_0 = 0 ddt_AUC = Cc ; Calculation of Cmax Cmax_0 = 0 if dAc > 0 && Cc > Cmax x = dAc/V else x = 0 end ddt_Cmax = x OUTPUT: output = {Ac, Cc} table = {Cmax, AUC}

#### Nadir

This example shows how to compute tumor size (variable TS) at time of nadir:

[LONGITUDINAL] input = {ka, Vl, Cl, TS0, kge, kkill, lambda} EQUATION: odeType=stiff Cc = pkmodel(ka, V, Cl) ; ODE system for tumor growth dynamics t_0 = 0 TS_0 = TS0 TSDynamics = (kge*TS)-kkill*TS*Cc*exp(-lambda*t) ddt_TS = TSDynamics ; ===== computing TS at nadir if TSDynamics < 0 && TS < TS_atNadir x = TSDynamics else x = 0 end TS_atNadir_0 = TS0 ddt_TS_atNadir = x OUTPUT: output = {TS} table = {TS_atNadir}

Here is an example of simulation for TS and TS_atNadir with a multiple dose schedule:

## Time above a threshold

Here we compute the time that a variable C spends above some threshold, which could be a toxicity threshold for example. This piece of code comes in the structural model, after the dynamics of the variable C has already been defined.

TimeAboveThreshold_0 = 0 if C > Cthreshold xTime = 1 else xTime = 0 end ddt_TimeAboveThreshold = xTime

## Time since disease progression

In this full structural model example, tumor size TS is described with an exponential growth, and a constant treatment effect since time=0 with a log-kill killing hypothesis and a Claret exponential resistance term. Several additional variables are computed:

- TS_atNadir: the tumor size at the time of nadir,
- PC_from_Nadir: the percent change of TS between the time of nadir and the current time,
- DP: predicted disease progression status (1 if TS has increased more than >20% and >5-mm from last nadir, 0 otherwise),
- TDP: time since disease progression (duration since last time when DP is switched from 0 to 1)

[LONGITUDINAL] input = {TS0, kge, kkill, lambda} EQUATION: odeType=stiff ;initial conditions: ;t_0 = 0 ;this should be uncommented if the initial time is 0 for all subjects TS_0 = TS0 K = kkill*exp(-lambda*t) ;Saturation for TS at 1e12 to avoid infinite values if TS>1e12 TSDynamics = 0 else if t<0 ; before treatment TSDynamics = (kge*TS) else ; after treatment TSDynamics = (kge*TS)-K*TS end end ddt_TS = TSDynamics ; Computing TS at time of nadir if TSDynamics < 0 & TS < TS_atNadir x1 = TSDynamics else x1 = 0 end TS_atNadir_0 = TS0 ddt_TS_atNadir = x1 ; x1 is used as intermediate variable because it is not possible to define an ODE inside an if/else statement ; Computing DP: predicted disease progression status at the previous visit (1 if TS has increased more than >20% and >5-mm from last nadir, 0 otherwise) PC_from_Nadir = (TS/TS_atNadir-1)*100 if t>TimeToNadir & PC_from_Nadir > 20 & (TS-TS_atNadir) > 5 DP = 1 else DP = 0 end ; Computing TDP = time since disease progression: duration since last time DP was switched from 0 to 1 if DP==1 x2 = 1 else x2 = 0 end TDP_0 = 0 ddt_TDP = x2 OUTPUT: output = {TS} table = {TS_atNadir, PC_from_Nadir, DP, TDP}

Simulx can be conveniently used to simulate each intermediate variable with typical parameters (the example model and Simulx project can be downloaded here):