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

Table 54 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 54 Nonmem to PoPy Analytic ODEs
Nonmem | ADVAN Parameters | PoPy | CMP Parameters
--- | --- | --- | ---
ADVAN1 | K | @iv_one_cmp_k | KE
ADVAN1 TRANS2 | CL/V | @iv_one_cmp_cl | CL/V
ADVAN2 | KA/K | @dep_one_cmp_k | KA/KE
ADVAN2 TRANS2 | KA/CL/V | @dep_one_cmp_cl | KA/CL/V
ADVAN3 | K/K12/K21 | @iv_two_cmp_k | KE/K12/K21
ADVAN3 TRANS4 | CL/V1/Q/V2 | @iv_two_cmp_cl | CL/V1/Q/V2
ADVAN4 | KA/K/K23/K32 | @dep_two_cmp_k | KA/KE/K12/K21
ADVAN4 TRANS4 | KA/CL/V1/Q/V2 | @dep_two_cmp_cl | KA/CL/V1/Q/V2
ADVAN11 | K/K12/K21/K13/K31 | @iv_three_cmp_k | KE/K12/K21/K13/K31
ADVAN11 TRANS4 | CL/V1/Q2/V2/Q3/V3 | @iv_three_cmp_cl | CL/V1/Q2/V2/Q3/V3
ADVAN12 | KA/K/K23/K32/K24/K42 | @dep_three_cmp_k | KA/KE/K12/K21/K13/K31
ADVAN12 TRANS4 | KA/CL/V2/Q3/V3/Q4/V4 | @dep_three_cmp_cl | KA/CL/V1/Q2/V2/Q3/V3

## ADVAN1

In Nonmem:-

    $SUBROUTINES  ADVAN1

With following parameters defined in the Nonmem $PK section:-

- K = elimination rate

Equivalent PoPy DERIVATIVES section:-

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

The Nonmem parameters are mapped to PoPy as follows:-

- K -> KE

See @iv_one_cmp_k.

## ADVAN1 TRANS2

In Nonmem:-

    $SUBROUTINES  ADVAN1 TRAN2

With following parameters defined in the Nonmem $PK section:-

- CL = clearance
- V = volume of distribution

Equivalent PoPy DERIVATIVES section:-

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

The Nonmem parameters are mapped to PoPy as follows:-

- CL -> CL
- V -> V

See @iv_one_cmp_cl.

## ADVAN2

In Nonmem:-

    $SUBROUTINES  ADVAN2

With following parameters defined in the Nonmem $PK section:-

- KA = absorption rate
- K = elimination rate

Equivalent PoPy DERIVATIVES section:-

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

The Nonmem parameters are mapped to PoPy as follows:-

- KA -> KA
- K -> KE

See @dep_one_cmp_k.

## ADVAN2 TRANS2

In Nonmem:-

    $SUBROUTINES  ADVAN2 TRAN2

With following parameters defined in the Nonmem $PK section:-

- KA = absorption rate
- CL = clearance
- V = volume of distribution

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]
        }

The Nonmem parameters are mapped to PoPy as follows:-

- KA -> KA
- CL -> CL
- V -> V

See @dep_one_cmp_cl.

## ADVAN3

In Nonmem:-

    $SUBROUTINES  ADVAN3

With following parameters defined in the Nonmem $PK section:-

- K = elimination rate from central compartment
- K12 = elimination rate from central to peripheral compartment
- K21 = elimination rate from peripheral to central compartment

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]}

The Nonmem parameters are mapped to PoPy as follows:-

- K -> KE
- K12 -> K12
- K21 -> K21

See @iv_two_cmp_k.

## ADVAN3 TRANS4

In Nonmem:-

    $SUBROUTINES  ADVAN3 TRANS4

With following parameters defined in the Nonmem $PK section:-

- CL = clearance from central compartment
- V1 = volume of distribution for central compartment
- Q = clearance between central and peripheral compartment
- V2 = volume of distribution for peripheral compartment

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]}

The Nonmem parameters are mapped to PoPy as follows:-

- CL -> CL
- V1 -> V1
- Q -> Q
- V2 -> V2

See @iv_two_cmp_cl.

## ADVAN4

In Nonmem:-

    $SUBROUTINES  ADVAN4

With following parameters defined in the Nonmem $PK section:-

- KA = absorption rate from depot to central compartment
- K = elimination rate from central compartment
- K23 = elimination rate from central to peripheral compartment
- K32 = elimination rate from peripheral to central compartment

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]}

The Nonmem parameters are mapped to PoPy as follows:-

- KA -> KA
- K -> KE
- K23 -> K12
- K32 -> K21

Note PoPy uses consistent parameter names between @iv_two_cmp_k (advan3) and @dep_two_cmp_k (advan4), whereas Nonmem renumbers the parameters.

See @dep_two_cmp_k.

## ADVAN4 TRANS4

In Nonmem:-

    $SUBROUTINES  ADVAN4 TRANS4

With following parameters defined in the Nonmem $PK section:-

- KA = absorption rate from depot to central compartment
- CL = clearance from central compartment
- V2 = volume of distribution for central compartment
- Q = clearance between central and peripheral compartment
- V3 = volume of distribution for peripheral compartment

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]}

The Nonmem parameters are mapped to PoPy as follows:-

- KA -> KA
- CL -> CL
- V2 -> V1
- Q -> Q
- V3 -> V2

Note PoPy uses consistent parameter names between @iv_two_cmp_cl (advan3 trans 4) and @dep_two_cmp_cl (advan4 trans4), whereas Nonmem renumbers the parameters.

See @dep_two_cmp_cl.

## ADVAN11

In Nonmem:-

    $SUBROUTINES  ADVAN11

With following parameters defined in the Nonmem $PK section:-

- K = elimination rate from central compartment
- K12 = elimination rate from central to first peripheral compartment
- K21 = elimination rate from first peripheral to central compartment
- K13 = elimination rate from central to second peripheral compartment
- K31 = elimination rate from second peripheral to central compartment

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]}

The Nonmem parameters are mapped to PoPy as follows:-

- K -> KE
- K12 -> K12
- K21 -> K21
- K13 -> K13
- K31 -> K31

See @iv_three_cmp_k.

## ADVAN11 TRANS4

In Nonmem:-

    $SUBROUTINES  ADVAN11 TRANS4

With following parameters defined in the Nonmem $PK section:-

- CL = clearance from central compartment
- V1 = volume of distribution for central compartment
- Q2 = clearance between central and first peripheral compartment
- V2 = volume of distribution for first peripheral compartment
- Q3 = clearance between central and first peripheral compartment
- V3 = volume of distribution for second peripheral compartment

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]}

The Nonmem parameters are mapped to PoPy as follows:-

- CL -> CL
- V1 -> V1
- Q2 -> Q2
- V2 -> V2
- Q3 -> Q3
- V3 -> V3

See @iv_three_cmp_cl.

## ADVAN12

In Nonmem:-

    $SUBROUTINES  ADVAN12

With following parameters defined in the Nonmem $PK section:-

- KA = absorption rate from depot to central compartment
- K = elimination rate from central compartment
- K23 = elimination rate from central to first peripheral compartment
- K32 = elimination rate from first peripheral to central compartment
- K24 = elimination rate from central to second peripheral compartment
- K42 = elimination rate from second peripheral to central compartment

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]}

The Nonmem parameters are mapped to PoPy as follows:-

- KA -> KA
- K -> KE
- K23 -> K12
- K32 -> K21
- K24 -> K13
- K42 -> K31

Note PoPy uses consistent parameter names between @iv_three_cmp_k (advan11) and @dep_three_cmp_k (advan12), whereas Nonmem renumbers the parameters.

See @dep_three_cmp_k.

## ADVAN12 TRANS4

In Nonmem:-

    $SUBROUTINES  ADVAN12 TRANS4

With following parameters defined in the Nonmem $PK section:-

- KA = absorption rate from depot to central compartment
- CL = clearance from central compartment
- V2 = volume of distribution for central compartment
- Q3 = clearance between central and first peripheral compartment
- V3 = volume of distribution for first peripheral compartment
- Q4 = clearance between central and first peripheral compartment
- V4 = volume of distribution for second peripheral compartment

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]}

The Nonmem parameters are mapped to PoPy as follows:-

- KA -> KA
- CL -> CL
- V2 -> V1
- Q3 -> Q2
- V3 -> V2
- Q4 -> Q3
- V4 -> V3

Note PoPy uses consistent parameter names between @iv_three_cmp_cl (advan11 trans 4) and @dep_three_cmp_cl (advan12 trans4), whereas Nonmem renumbers the parameters.

See @dep_three_cmp_cl.