# Transit compartment codes

**URL:** <https://forum.certara.com/t/transit-compartment-codes/3582>\
**Category:** PML School\
**Created:** [January 13, 2022, 7:08pm UTC](https://forum.certara.com/t/transit-compartment-codes/3582 "2022-01-13T19:08:58Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidq8](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@davidq8](https://forum.certara.com/u/davidq8)\
**Post date:** [January 13, 2022, 7:08pm UTC](https://forum.certara.com/t/transit-compartment-codes/3582/1 "2022-01-13T19:08:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kniefort](https://avatars.discourse-cdn.com/v4/letter/k/c68b51/32.png) [@kniefort](https://forum.certara.com/u/kniefort)\
**Post date:** [January 13, 2022, 8:08pm UTC](https://forum.certara.com/t/transit-compartment-codes/3582/2 "2022-01-13T20:08:43Z")

</div>

> [@davidq8](#):
>
> 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.certara.com/phoenix/8.3/index.html#t=topics%2FDiscrete\_and\_distributed\_delays.htm&rhsearch=delay&rhhlterm=delay&rhsyns=%20](https://onlinehelp.certara.com/phoenix/8.3/index.html#t=topics%2FDiscrete_and_distributed_delays.htm&rhsearch=delay&rhhlterm=delay&rhsyns=%20)

---

<div class="post-metadata">

**Author:** ![bwendt](https://avatars.discourse-cdn.com/v4/letter/b/f4b2a3/32.png) [@bwendt](https://forum.certara.com/u/bwendt)\
**Post date:** [January 14, 2022, 9:24am UTC](https://forum.certara.com/t/transit-compartment-codes/3582/3 "2022-01-14T09:24:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SimonDavis](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@SimonDavis](https://forum.certara.com/u/SimonDavis)\
**Post date:** [January 14, 2022, 4:00pm UTC](https://forum.certara.com/t/transit-compartment-codes/3582/4 "2022-01-14T16:00:17Z")

</div>

the online help has more background about PML syntaxt if you have not found this yet; [https://onlinehelp.certara.com/phoenix/8.3/index.html#t=topics%2FPML\_-\_Transit\_compartment\_models.htm](https://onlinehelp.certara.com/phoenix/8.3/index.html#t=topics%2FPML_-_Transit_compartment_models.htm)

---

<div class="post-metadata">

**Author:** ![davidq8](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@davidq8](https://forum.certara.com/u/davidq8)\
**Post date:** [February 11, 2022, 7:24pm UTC](https://forum.certara.com/t/transit-compartment-codes/3582/5 "2022-02-11T19:24:50Z")

</div>

> [@kniefort](#):
>
> Have you considered using a delay function instead?
> 
> [https://onlinehelp.certara.com/phoenix/8.3/index.html#t=topics%2FDiscrete\_and\_distributed\_delays.htm&rhsearch=delay&rhhlterm=delay&rhsyns=%20](https://onlinehelp.certara.com/phoenix/8.3/index.html#t=topics%2FDiscrete_and_distributed_delays.htm&rhsearch=delay&rhhlterm=delay&rhsyns=%20)

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

---

<div class="post-metadata">

**Author:** ![davidq8](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@davidq8](https://forum.certara.com/u/davidq8)\
**Post date:** [February 11, 2022, 7:27pm UTC](https://forum.certara.com/t/transit-compartment-codes/3582/6 "2022-02-11T19:27:24Z")

</div>

> [@bwendt\_1](#):
>
> 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!!

---

<div class="post-metadata">

**Author:** ![davidq8](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@davidq8](https://forum.certara.com/u/davidq8)\
**Post date:** [February 11, 2022, 7:29pm UTC](https://forum.certara.com/t/transit-compartment-codes/3582/7 "2022-02-11T19:29:46Z")

</div>

> [@sdavis](#):
>
> the online help has more background about PML syntaxt if you have not found this yet; [https://onlinehelp.certara.com/phoenix/8.3/index.html#t=topics%2FPML\_-\_Transit\_compartment\_models.htm](https://onlinehelp.certara.com/phoenix/8.3/index.html#t=topics%2FPML_-_Transit_compartment_models.htm)

Thanks Simon for sharing the link!

---

<div class="post-metadata">

**Author:** ![davidq8](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@davidq8](https://forum.certara.com/u/davidq8)\
**Post date:** [October 3, 2022, 6:48pm UTC](https://forum.certara.com/t/transit-compartment-codes/3582/8 "2022-10-03T18:48:57Z")

</div>

> [@bwendt\_1](#):
>
> 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

---

<div class="post-metadata">

**Author:** ![bwendt](https://avatars.discourse-cdn.com/v4/letter/b/f4b2a3/32.png) [@bwendt](https://forum.certara.com/u/bwendt)\
**Post date:** [October 4, 2022, 9:19am UTC](https://forum.certara.com/t/transit-compartment-codes/3582/9 "2022-10-04T09:19:21Z")

</div>

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](https://us1.discourse-cdn.com/certara/original/2X/4/48e801fab6ac757e47819c93d52383882cbfca18.png)

Bernd

---

<div class="post-metadata">

**Author:** ![davidq8](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@davidq8](https://forum.certara.com/u/davidq8)\
**Post date:** [November 13, 2022, 9:49pm UTC](https://forum.certara.com/t/transit-compartment-codes/3582/10 "2022-11-13T21:49:39Z")

</div>

> [@bwendt\_1](#):
>
> 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](https://us1.discourse-cdn.com/certara/original/2X/4/48e801fab6ac757e47819c93d52383882cbfca18.png)
> 
> Bernd

Thanks, Bernd, for the explanation

---

<div class="post-metadata">

**Author:** ![weizixu](https://avatars.discourse-cdn.com/v4/letter/w/e8c25b/32.png) [@weizixu](https://forum.certara.com/u/weizixu)\
**Post date:** [November 20, 2023, 1:53am UTC](https://forum.certara.com/t/transit-compartment-codes/3582/11 "2023-11-20T01:53:06Z")

</div>

Hi

> [@bwendt\_1](#):
>
> 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:

```auto
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!

---

<div class="post-metadata">

**Author:** ![bwendt](https://avatars.discourse-cdn.com/v4/letter/b/f4b2a3/32.png) [@bwendt](https://forum.certara.com/u/bwendt)\
**Post date:** [November 20, 2023, 9:05am UTC](https://forum.certara.com/t/transit-compartment-codes/3582/12 "2023-11-20T09:05:46Z")

</div>

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](mailto:support@certara.com) if you don’t want to share publicly.

Bernd

---

<div class="post-metadata">

**Author:** ![weizixu](https://avatars.discourse-cdn.com/v4/letter/w/e8c25b/32.png) [@weizixu](https://forum.certara.com/u/weizixu)\
**Post date:** [November 20, 2023, 5:46pm UTC](https://forum.certara.com/t/transit-compartment-codes/3582/13 "2023-11-20T17:46:16Z")

</div>

> [@bwendt\_1](#):
>
> 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](mailto: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.
