Jump to content


Photo
- - - - -

Transit compartment codes


  • Please log in to reply
12 replies to this topic

#1 Davidq8

Davidq8

    Advanced Member

  • Members
  • PipPipPip
  • 57 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
  • PipPip
  • 29 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

    Advanced Member

  • Administrators
  • 282 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

    Advanced Member

  • Administrators
  • 1,316 posts

Posted 14 January 2022 - 04:00 PM

the online help has more background about PML syntaxt if you have not found this yet; https://onlinehelp.c...ment_models.htm



#5 Davidq8

Davidq8

    Advanced Member

  • Members
  • PipPipPip
  • 57 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

    Advanced Member

  • Members
  • PipPipPip
  • 57 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

    Advanced Member

  • Members
  • PipPipPip
  • 57 posts

Posted 11 February 2022 - 07:29 PM

the online help has more background about PML syntaxt if you have not found this yet; https://onlinehelp.c...ment_models.htm

Thanks Simon for sharing the link!



#8 Davidq8

Davidq8

    Advanced Member

  • Members
  • PipPipPip
  • 57 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

    Advanced Member

  • Administrators
  • 282 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:

 

sim.png

 

Bernd



#10 Davidq8

Davidq8

    Advanced Member

  • Members
  • PipPipPip
  • 57 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:

 

attachicon.gifsim.png

 

Bernd

Thanks, Bernd, for the explanation 



#11 weizixu

weizixu

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 20 November 2023 - 01:53 AM

Hi 

 

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

Hi Bernd, 

 

Appreciate for the code! I tried to modified it to a one-compartment model, here is my code: 

test(){
	deriv(A1 = - (Cl * C) + (Aa * Ka))  
	transit(Aa, mtt, ntr, max=50 ,out=-Aa*Ka)
	dosepoint(Aa)
	C = A1 / V
	ktr=(ntr+1)/mtt 
	error(CEps = 0.1)
	observe(CObs = C * (1 + CEps))
	stparm(Ka = tvKa * exp(nKa))
	stparm(V = tvV * exp(nV))
	stparm(Cl = tvCl * exp(nCl))
	stparm(mtt = tvmtt)
	stparm(ntr = tvntr)
	fixef(tvKa = c(, 1, ))
	fixef(tvV = c(, 2.14, ))
	fixef(tvCl = c(, 0.73, ))
	fixef(tvmtt=c(, 1, ))
	fixef(tvntr=c(0, 1, )) 
	ranef(diag(nV, nCl, nKa) = c(1, 1, 1))
}

However, my theta estimate for ntr is a little off, CI includes negative value (I specified ntr should >0 in the code).

I am wondering what's wrong with my code, thanks! 

 



#12 bwendt@certara.com

bwendt@certara.com

    Advanced Member

  • Administrators
  • 282 posts

Posted 20 November 2023 - 09:05 AM

Hi,

 

I don't think there is anything wrong with your code. CI with negative values just indicates that this parameter is not identifiable with the data at hand. If you can share the data, we can investigate. You can send to support@certara.com if you don't want to share publicly.

 

 Bernd



#13 weizixu

weizixu

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 20 November 2023 - 05:46 PM

Hi,

 

I don't think there is anything wrong with your code. CI with negative values just indicates that this parameter is not identifiable with the data at hand. If you can share the data, we can investigate. You can send to support@certara.com if you don't want to share publicly.

 

 Bernd

Hi Bernd, 

 

Thanks for the quick reply! It would be really helpful to get some suggestions from you, I attached my project.

I tried adding Tlag, using the transit model ("1comp Transit") or the delay-function ("1comp Transit delayed") you mentioned before. 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users