# How to compute AUC and Cmax in Monolix

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 in the structural model

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

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}