# Nonmem Advan1,2,3,4,11,12 to PoPy analytic compartment models

Table 47 shows how to convert each Nonmem inbuilt ADVAN analytic functions to PoPy equivalents.

See ADVAN 1,2,3,4,11,12 Example for info on Nonmem $SUBROUTINES section.

Note to use the analytic compartment models in PoPy you should always set ODE_SOLVER as follows:-

    ODE_SOLVER: {ANALYTIC:{}}

For more information on PoPy analytic functions see Analytic Compartment Functions.

Table 47 Nonmem to PoPy Analytic ODEs
Nonmem | PoPy | Parameters
--- | --- | ---
ADVAN1 | @iv_one_cmp_k | dose/KE
ADVAN1 TRANS2 | @iv_one_cmp_cl | dose/CL/V
ADVAN2 | @dep_one_cmp_k | dose/KA/KE
ADVAN2 TRANS2 | @dep_one_cmp_cl | dose/KA/CL/V
ADVAN3 | @iv_two_cmp_k | dose/KE/K12/K21
ADVAN3 TRANS4 | @iv_two_cmp_cl | dose/KA/CL/V1/Q/V2
ADVAN4 | @dep_two_cmp_k | dose/KA/KE/K12/K21
ADVAN4 TRANS4 | @dep_two_cmp_cl | dose/KA/CL/V1/Q/V2
ADVAN11 | @iv_three_cmp_k | dose/KE/K12/K21/K13/K31
ADVAN11 TRANS4 | @iv_three_cmp_cl | dose/CL/V1/Q2/V2/Q3/V3
ADVAN12 | @dep_three_cmp_k | dose/KA/KE/K12/K21/K13/K31
ADVAN12 TRANS4 | @dep_three_cmp_cl | dose/KA/CL/V1/Q2/V2/Q3/V3

## ADVAN1

In Nonmem:-

    $SUBROUTINES  ADVAN1

Equivalent PoPy DERIVATIVES section:-

    DERIVATIVES: |
        s[CEN] = @iv_one_cmp_k{dose: @bolus{amt:c[AMT]}, KE: m[KE]}

See @iv_one_cmp_k.

## ADVAN1 TRANS2

In Nonmem:-

    $SUBROUTINES  ADVAN1 TRAN2

Equivalent PoPy DERIVATIVES section:-

    DERIVATIVES: |
        s[CEN] = @iv_one_cmp_cl{dose: @bolus{amt:c[AMT]}, CL: m[CL], V: m[V]}

See @iv_one_cmp_cl.

## ADVAN2

In Nonmem:-

    $SUBROUTINES  ADVAN2

Equivalent PoPy DERIVATIVES section:-

    DERIVATIVES: |
        s[DEP,CEN] = @dep_one_cmp_k{dose: @bolus{amt:c[AMT]}, KA: m[KA], KE: m[KE]}

See @dep_one_cmp_k.

## ADVAN2 TRANS2

In Nonmem:-

    $SUBROUTINES  ADVAN2 TRAN2

Equivalent PoPy DERIVATIVES section:-

    DERIVATIVES: |
        s[DEP,CEN] = @dep_one_cmp_cl{
            dose: @bolus{amt:c[AMT]},
            KA: m[KA], CL: m[CL], V: m[V]
        }

See @dep_one_cmp_cl.

## ADVAN3

In Nonmem:-

    $SUBROUTINES  ADVAN3

Equivalent PoPy DERIVATIVES section:-

    DERIVATIVES: |
        s[CEN,PERI] = @iv_two_cmp_k{
            dose: @bolus{amt:c[AMT]},
            KE: m[KE], K12: m[K12], K21: m[K21]}

See @iv_two_cmp_k.

## ADVAN3 TRANS4

In Nonmem:-

    $SUBROUTINES  ADVAN3 TRANS4

Equivalent PoPy DERIVATIVES section:-

    DERIVATIVES: |
        s[CEN,PERI] = @iv_two_cmp_cl{
            dose: @bolus{amt:c[AMT]},
            CL: m[CL], V1: m[V1], Q: m[Q], V2: m[V2]}

See @iv_two_cmp_cl.

## ADVAN4

In Nonmem:-

    $SUBROUTINES  ADVAN4

Equivalent PoPy DERIVATIVES section:-

    DERIVATIVES: |
        s[DEP,CEN,PERI] = @dep_two_cmp_k{
            dose: @bolus{amt:c[AMT]},
            KA: m[KA], KE: m[KE], K12: m[K12], K21: m[K21]}

See @dep_two_cmp_k.

## ADVAN4 TRANS4

In Nonmem:-

    $SUBROUTINES  ADVAN4 TRANS4

Equivalent PoPy DERIVATIVES section:-

    DERIVATIVES: |
        s[DEP,CEN,PERI] = @dep_two_cmp_cl{
            dose: @bolus{amt:c[AMT]},
            KA: m[KA], CL: m[CL], V1: m[V1],
            Q: m[Q], V2: m[V2]}

See @dep_two_cmp_cl.

## ADVAN11

In Nonmem:-

    $SUBROUTINES  ADVAN11

Equivalent PoPy DERIVATIVES section:-

    DERIVATIVES: |
        s[CEN,PERI1,PERI2] = @iv_three_cmp_k{
            dose: @bolus{amt:c[AMT]},
            KE: m[KE], K12: m[K12], K21: m[K21],
            K13: m[K13], K31: m[K31]}

See @iv_three_cmp_k.

## ADVAN11 TRANS4

In Nonmem:-

    $SUBROUTINES  ADVAN11 TRANS4

Equivalent PoPy DERIVATIVES section:-

    DERIVATIVES: |
        s[CEN,PERI1,PERI2] = @iv_three_cmp_cl{
            dose: @bolus{amt:c[AMT]},
            CL: m[CL], V1: m[V1], Q2: m[Q2],
            V2: m[V2], Q3: m[Q3], V3: m[V3]}

See @iv_three_cmp_cl.

## ADVAN12

In Nonmem:-

    $SUBROUTINES  ADVAN12

Equivalent PoPy DERIVATIVES section:-

    DERIVATIVES: |
        s[DEP,CEN,PERI1,PERI2] = @dep_three_cmp_k{
            dose: @bolus{amt:c[AMT]},
            KA: m[KA], KE: m[KE],
            K12: m[K12], K21: m[K21],
            K13: m[K13], K31: m[K31]}

See @dep_three_cmp_k.

## ADVAN12 TRANS4

In Nonmem:-

    $SUBROUTINES  ADVAN12 TRANS4

Equivalent PoPy DERIVATIVES section:-

    DERIVATIVES: |
        s[DEP,CEN,PERI1,PERI2] = @dep_three_cmp_cl{
            dose: @bolus{amt:c[AMT]},
            KA: m[KA],
            CL: m[CL], V1: m[V1],
            Q2: m[Q2], V2: m[V2],
            Q3: m[Q3], V3: m[V3]}

See @dep_three_cmp_cl.