      # Transit compartment codes

9 replies to this topic

### #1 Davidq8

Davidq8

• • Members
•   • 38 posts

Posted 13 January 2022 - 07:08 PM

Hi, I am building a population Pk model for an oral drug. The plasma concentration-time curve suggests two compartments for the Structural model. Adding a Tlag function to delay absorption has improved the fit; however, I believe modeling the absorption process using transit compartments models will improve the general fitting of the model. I need help to write the codes for the Transit compartments for extravascular administration with two compartments. I really appreciate help and suggestions.

Thanks

### #2 kniefort

kniefort

Member

• • Members
•  • 19 posts

Posted 13 January 2022 - 08:08 PM

Hi, I am building a population Pk model for an oral drug. The plasma concentration-time curve suggests two compartments for the Structural model. Adding a Tlag function to delay absorption has improved the fit; however, I believe modeling the absorption process using transit compartments models will improve the general fitting of the model. I need help to write the codes for the Transit compartments for extravascular administration with two compartments. I really appreciate help and suggestions.

Thanks

Have you considered using a delay function instead?

https://onlinehelp.c...=delay&rhsyns=

### #3 bwendt@certara.com

bwendt@certara.com

• • • 254 posts

Posted 14 January 2022 - 09:24 AM

You did not provide an example Phoenix project file. Let me start with a standard 2-comp oral model in PML:

___________________________________

test(){
deriv(A1 = - (Cl * C) + (Aa * Ka)- (Cl2 * (C - C2)))
deriv(Aa = - (Aa * Ka))
deriv(A2 = (Cl2 * (C - C2)))
C = A1 / V
dosepoint(Aa, idosevar = AaDose, infdosevar = AaInfDose, infratevar = AaInfRate)
C2 = A2 / V2
error(CEps = 1)
observe(CObs = C + CEps)
stparm(V = tvV * exp(nV))
stparm(Cl = tvCl * exp(nCl))
stparm(Ka = tvKa * exp(nKa))
stparm(V2 = tvV2 * exp(nV2))
stparm(Cl2 = tvCl2 * exp(nCl2))
fixef(tvV = c(, 1, ))
fixef(tvCl = c(, 1, ))
fixef(tvKa = c(, 1, ))
fixef(tvV2 = c(, 1, ))
fixef(tvCl2 = c(, 1, ))
ranef(diag(nV, nCl, nKa, nV2, nCl2) = c(1, 1, 1, 1, 1))
}

_________________________________________________

For a transit compartment, just add a transit statement:

--------------------------------------------------------------------------------------

test(){
#deriv(Aa = - (Aa * Ka))
transit(Aa, mtt, ntr, max=50, out=-Aa*Ka)
deriv(A1 = - (Cl * C) + (Aa * Ka)- (Cl2 * (C - C2)))
deriv(A2 = (Cl2 * (C - C2)))
C = A1 / V
dosepoint(Aa, idosevar = AaDose, infdosevar = AaInfDose, infratevar = AaInfRate)
C2 = A2 / V2
error(CEps = 1)
observe(CObs = C + CEps)
stparm(V = tvV * exp(nV))
stparm(Cl = tvCl * exp(nCl))
stparm(Ka = tvKa * exp(nKa))
stparm(V2 = tvV2 * exp(nV2))
stparm(Cl2 = tvCl2 * exp(nCl2))
stparm(mtt = tvmtt)
stparm(ntr = tvntr)
fixef(tvV = c(, 1, ))
fixef(tvCl = c(, 1, ))
fixef(tvKa = c(, 1, ))
fixef(tvV2 = c(, 1, ))
fixef(tvCl2 = c(, 1, ))
fixef(tvmtt = c(,1,))
fixef(tvntr= c(,1,))
ranef(diag(nV, nCl, nKa, nV2, nCl2) = c(1, 1, 1, 1, 1))
}

----------------------------------------------------------------------------

For the delay-function that Keith suggested, a few additional changes need to be done:

-----------------------------------------------------------------------------

test(){
#deriv(A1 = - (Cl * C) + (Aa * Ka)- (Cl2 * (C - C2)))
#deriv(Aa = - (Aa * Ka))
delayInfCpt( A1, mtt, ntr, out = - Cl*C - (Cl2 * (C - C2)))
deriv(A2 = (Cl2 * (C - C2)))
C = A1 / V
dosepoint(A1, idosevar = AaDose, infdosevar = AaInfDose, infratevar = AaInfRate)
C2 = A2 / V2
error(CEps = 1)
observe(CObs = C + CEps)
stparm(V = tvV * exp(nV))
stparm(Cl = tvCl * exp(nCl))
#stparm(Ka = tvKa * exp(nKa))
stparm(V2 = tvV2 * exp(nV2))
stparm(Cl2 = tvCl2 * exp(nCl2))
stparm(mtt = tvmtt)
stparm(ntr = tvntr)
fixef(tvV = c(, 1, ))
fixef(tvCl = c(, 1, ))
#fixef(tvKa = c(, 1, ))
fixef(tvV2 = c(, 1, ))
fixef(tvCl2 = c(, 1, ))
fixef(tvmtt = c(,5,))
fixef(tvntr= c(,10,))
ranef(diag(nV, nCl, nKa, nV2, nCl2) = c(1, 1, 1, 1, 1))
}

-----------------------------------------------------------------------------

Please let us know if you run into issues.

Bernd

### #4 Simon Davis

Simon Davis

• • • 1,258 posts

Posted 14 January 2022 - 04:00 PM

### #5 Davidq8

Davidq8

• • Members
•   • 38 posts

Posted 11 February 2022 - 07:24 PM

Have you considered using a delay function instead?

https://onlinehelp.c...=delay&rhsyns=

Thanks, kniefort for your suggestion! I will try it.

Edited by Davidq8, 11 February 2022 - 07:28 PM.

### #6 Davidq8

Davidq8

• • Members
•   • 38 posts

Posted 11 February 2022 - 07:27 PM

You did not provide an example Phoenix project file. Let me start with a standard 2-comp oral model in PML:

___________________________________

test(){
deriv(A1 = - (Cl * C) + (Aa * Ka)- (Cl2 * (C - C2)))
deriv(Aa = - (Aa * Ka))
deriv(A2 = (Cl2 * (C - C2)))
C = A1 / V
dosepoint(Aa, idosevar = AaDose, infdosevar = AaInfDose, infratevar = AaInfRate)
C2 = A2 / V2
error(CEps = 1)
observe(CObs = C + CEps)
stparm(V = tvV * exp(nV))
stparm(Cl = tvCl * exp(nCl))
stparm(Ka = tvKa * exp(nKa))
stparm(V2 = tvV2 * exp(nV2))
stparm(Cl2 = tvCl2 * exp(nCl2))
fixef(tvV = c(, 1, ))
fixef(tvCl = c(, 1, ))
fixef(tvKa = c(, 1, ))
fixef(tvV2 = c(, 1, ))
fixef(tvCl2 = c(, 1, ))
ranef(diag(nV, nCl, nKa, nV2, nCl2) = c(1, 1, 1, 1, 1))
}

_________________________________________________

For a transit compartment, just add a transit statement:

--------------------------------------------------------------------------------------

test(){
#deriv(Aa = - (Aa * Ka))
transit(Aa, mtt, ntr, max=50, out=-Aa*Ka)
deriv(A1 = - (Cl * C) + (Aa * Ka)- (Cl2 * (C - C2)))
deriv(A2 = (Cl2 * (C - C2)))
C = A1 / V
dosepoint(Aa, idosevar = AaDose, infdosevar = AaInfDose, infratevar = AaInfRate)
C2 = A2 / V2
error(CEps = 1)
observe(CObs = C + CEps)
stparm(V = tvV * exp(nV))
stparm(Cl = tvCl * exp(nCl))
stparm(Ka = tvKa * exp(nKa))
stparm(V2 = tvV2 * exp(nV2))
stparm(Cl2 = tvCl2 * exp(nCl2))
stparm(mtt = tvmtt)
stparm(ntr = tvntr)
fixef(tvV = c(, 1, ))
fixef(tvCl = c(, 1, ))
fixef(tvKa = c(, 1, ))
fixef(tvV2 = c(, 1, ))
fixef(tvCl2 = c(, 1, ))
fixef(tvmtt = c(,1,))
fixef(tvntr= c(,1,))
ranef(diag(nV, nCl, nKa, nV2, nCl2) = c(1, 1, 1, 1, 1))
}

----------------------------------------------------------------------------

For the delay-function that Keith suggested, a few additional changes need to be done:

-----------------------------------------------------------------------------

test(){
#deriv(A1 = - (Cl * C) + (Aa * Ka)- (Cl2 * (C - C2)))
#deriv(Aa = - (Aa * Ka))
delayInfCpt( A1, mtt, ntr, out = - Cl*C - (Cl2 * (C - C2)))
deriv(A2 = (Cl2 * (C - C2)))
C = A1 / V
dosepoint(A1, idosevar = AaDose, infdosevar = AaInfDose, infratevar = AaInfRate)
C2 = A2 / V2
error(CEps = 1)
observe(CObs = C + CEps)
stparm(V = tvV * exp(nV))
stparm(Cl = tvCl * exp(nCl))
#stparm(Ka = tvKa * exp(nKa))
stparm(V2 = tvV2 * exp(nV2))
stparm(Cl2 = tvCl2 * exp(nCl2))
stparm(mtt = tvmtt)
stparm(ntr = tvntr)
fixef(tvV = c(, 1, ))
fixef(tvCl = c(, 1, ))
#fixef(tvKa = c(, 1, ))
fixef(tvV2 = c(, 1, ))
fixef(tvCl2 = c(, 1, ))
fixef(tvmtt = c(,5,))
fixef(tvntr= c(,10,))
ranef(diag(nV, nCl, nKa, nV2, nCl2) = c(1, 1, 1, 1, 1))
}

-----------------------------------------------------------------------------

Please let us know if you run into issues.

Bernd

Thanks, Bernd, for providing codes for both models, I really appreciate your help!!

### #7 Davidq8

Davidq8

• • Members
•   • 38 posts

Posted 11 February 2022 - 07:29 PM

Thanks Simon for sharing the link!

### #8 Davidq8

Davidq8

• • Members
•   • 38 posts

Posted 03 October 2022 - 06:48 PM

You did not provide an example Phoenix project file. Let me start with a standard 2-comp oral model in PML:

___________________________________

test(){
deriv(A1 = - (Cl * C) + (Aa * Ka)- (Cl2 * (C - C2)))
deriv(Aa = - (Aa * Ka))
deriv(A2 = (Cl2 * (C - C2)))
C = A1 / V
dosepoint(Aa, idosevar = AaDose, infdosevar = AaInfDose, infratevar = AaInfRate)
C2 = A2 / V2
error(CEps = 1)
observe(CObs = C + CEps)
stparm(V = tvV * exp(nV))
stparm(Cl = tvCl * exp(nCl))
stparm(Ka = tvKa * exp(nKa))
stparm(V2 = tvV2 * exp(nV2))
stparm(Cl2 = tvCl2 * exp(nCl2))
fixef(tvV = c(, 1, ))
fixef(tvCl = c(, 1, ))
fixef(tvKa = c(, 1, ))
fixef(tvV2 = c(, 1, ))
fixef(tvCl2 = c(, 1, ))
ranef(diag(nV, nCl, nKa, nV2, nCl2) = c(1, 1, 1, 1, 1))
}

_________________________________________________

For a transit compartment, just add a transit statement:

--------------------------------------------------------------------------------------

test(){
#deriv(Aa = - (Aa * Ka))
transit(Aa, mtt, ntr, max=50, out=-Aa*Ka)
deriv(A1 = - (Cl * C) + (Aa * Ka)- (Cl2 * (C - C2)))
deriv(A2 = (Cl2 * (C - C2)))
C = A1 / V
dosepoint(Aa, idosevar = AaDose, infdosevar = AaInfDose, infratevar = AaInfRate)
C2 = A2 / V2
error(CEps = 1)
observe(CObs = C + CEps)
stparm(V = tvV * exp(nV))
stparm(Cl = tvCl * exp(nCl))
stparm(Ka = tvKa * exp(nKa))
stparm(V2 = tvV2 * exp(nV2))
stparm(Cl2 = tvCl2 * exp(nCl2))
stparm(mtt = tvmtt)
stparm(ntr = tvntr)
fixef(tvV = c(, 1, ))
fixef(tvCl = c(, 1, ))
fixef(tvKa = c(, 1, ))
fixef(tvV2 = c(, 1, ))
fixef(tvCl2 = c(, 1, ))
fixef(tvmtt = c(,1,))
fixef(tvntr= c(,1,))
ranef(diag(nV, nCl, nKa, nV2, nCl2) = c(1, 1, 1, 1, 1))
}

----------------------------------------------------------------------------

For the delay-function that Keith suggested, a few additional changes need to be done:

-----------------------------------------------------------------------------

test(){
#deriv(A1 = - (Cl * C) + (Aa * Ka)- (Cl2 * (C - C2)))
#deriv(Aa = - (Aa * Ka))
delayInfCpt( A1, mtt, ntr, out = - Cl*C - (Cl2 * (C - C2)))
deriv(A2 = (Cl2 * (C - C2)))
C = A1 / V
dosepoint(A1, idosevar = AaDose, infdosevar = AaInfDose, infratevar = AaInfRate)
C2 = A2 / V2
error(CEps = 1)
observe(CObs = C + CEps)
stparm(V = tvV * exp(nV))
stparm(Cl = tvCl * exp(nCl))
#stparm(Ka = tvKa * exp(nKa))
stparm(V2 = tvV2 * exp(nV2))
stparm(Cl2 = tvCl2 * exp(nCl2))
stparm(mtt = tvmtt)
stparm(ntr = tvntr)
fixef(tvV = c(, 1, ))
fixef(tvCl = c(, 1, ))
#fixef(tvKa = c(, 1, ))
fixef(tvV2 = c(, 1, ))
fixef(tvCl2 = c(, 1, ))
fixef(tvmtt = c(,5,))
fixef(tvntr= c(,10,))
ranef(diag(nV, nCl, nKa, nV2, nCl2) = c(1, 1, 1, 1, 1))
}

-----------------------------------------------------------------------------

Please let us know if you run into issues.

Bernd

Bernd

I have a follow up question regarding the model with delay function, why do not we estimate absorption rate constant in this model?

Thanks

### #9 bwendt@certara.com

bwendt@certara.com

• • • 254 posts

Posted 04 October 2022 - 09:19 AM

David,

you don't need Ka with delay function: you are dosing directly into the systemic compartment (A1). The delay function will cause the amounts of compound to appear in the systemic compartment to be delayed, see A1 vs Time of a simulated profile:

Bernd

### #10 Davidq8

Davidq8

• • Members
•   • 38 posts

Posted 13 November 2022 - 09:49 PM

David,

you don't need Ka with delay function: you are dosing directly into the systemic compartment (A1). The delay function will cause the amounts of compound to appear in the systemic compartment to be delayed, see A1 vs Time of a simulated profile: sim.png

Bernd

Thanks, Bernd, for the explanation

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users 