I’m attempting to fit several IV infusion population PK models using Torsten. The user manual says that first-order absorption can be eliminated by setting ka=0, however when I set that parameter to 0 (theta[3]=0 using PKModelOneCpt() or theta[5]=0 using PKModelTwoCpt()), I get the following error and no sampling is done.
Chain 1: Rejecting initial value:
Chain 1: Error evaluating the log probability at the initial value.
Chain 1: Exception: PMXTwoCptModel: ka is 0, but must be > 0! (in ‘modela845d45a7de_3a354a9e89043ae5921a28b76b8a46e3’ at line 79)
The relevant section of the transformed parameters block is shown below. Any idea how to correct this so one and two compartment models can be used with IV data?
Thanks
...
thetaHat[1] = CLHat;
thetaHat[2] = QHat;
thetaHat[3] = V1Hat;
thetaHat[4] = V2Hat;
thetaHat[5] = kaHat;
// Matt's trick to use unit scale
thetaM = (rep_matrix(thetaHat, nSubjects) .* exp(diag_pre_multiply(omega, L * etaStd)))';
for(j in 1:nSubjects)
{
theta[1] = thetaM[j, 1]; // CL
theta[2] = thetaM[j, 2]; // Q
theta[3] = thetaM[j, 3]; // V1
theta[4] = thetaM[j, 4]; // V2
//theta[5] = thetaM[j, 5]; // ka
theta[5] = 0; // ka
x[first[j]:last[j]] = PKModelTwoCpt(time[first[j]:last[j]],
amt[first[j]:last[j]],
rate[first[j]:last[j]],
ii[first[j]:last[j]],
evid[first[j]:last[j]],
cmt[first[j]:last[j]],
addl[first[j]:last[j]],
ss[first[j]:last[j]],
theta, biovar, tlag);
...