# How to compute AUC using in Monolix and Mlxtran

Often the Area under the PK curve (AUC) is needed as an important PK metric to link with the pharmacodymanic effect. We show here how the AUC can be computed within the mlxtran model file and be outputted for later analysis.

In the EQUATION section of the Mlxtran model you can use the following code. It is the basic implementation of the AUC for a 1-compartmental model with absorption rate ka. It will compute the AUC from the start to the end of the integration.

Notice that the calculation can be used as an output (to be matched to observations of the data set) and thus in the output={} definition, or just computed and available for post-treatment using table={} as can be seen here.

#### AUC for t=0 to t=tend and fast computation with linear ODE

input = {ka, V, Cl}

PK:
compartment(cmt=1, amount=Ac, volume=V, concentration=Cc)
elimination(cmt=1, Cl)
oral(ka, cmt=1)

EQUATION:
odeType = linear
ddt_AUC = 1/V * Ac

OUTPUT:
output = {Cc}
table = {AUC}



#### Time interval AUC

If you want to limit the computation of the AUC to a time period you can use the following code:

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)
dAUC150 = 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 will be sufficient. For cases where you need fast execution you use a special solver for linear ODE systems by specifying odeType = linear in the EQUATION section. This does not work with if statements and you will need to use the code below. In this code the AUC is computed for each dose interval. Thus, 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}