TMDD Model PD baseline fitting issue

I’m wondering if someone from Pharisght can take a look at the PD model portion of this code. I’m having a tough time with the PD part where the individual predicted points don’t seem to go through the baseline E0. I know that in some instances, it matters what the order of the equations is (i.e. you have to define variables before using them in a differential) and want to see if this is the case here. I do have a lot of parameters for the data I have, but this is an appropriate structural model for the drug so hoping to use this structure. My VPC plots suggest I’m not fitting that initial portion of the curve and I can’t help but thing its because the initial concentrations aren’t being considered properly. Figure attached. test(){ deriv(A1 = (Aa * Ka) - (kdCRf) + (kdDR)) deriv(DR=(CkdRf)-(kd+kint)DR) Rf=Rmax-DR deriv(Aa = - (Aa * Ka)) dosepoint(A1, bioavail = (1-F), duration = (dur), idosevar = A1Dose, infdosevar = A1InfDose, infratevar = A1InfRate) dosepoint(Aa, bioavail = (F), idosevar = AaDose, infdosevar = AaInfDose, infratevar = AaInfRate) error(CEps = 0.21545) observe(CObs = C + CEps * (1 + C * CMixRatio)) C = A1 / V stparm(CMixRatio = tvCMixRatio) stparm(V = tvV * exp(nV)) stparm(Ka = tvKa) stparm(F = tvF * exp(nF)) stparm(dur = tvdur * exp(ndur)) stparm(kint = tvkintexp(nkint)) stparm(kd = tvkd) stparm(Rmax = tvRmax) fixef(tvCMixRatio = c(, 0.0933754, )) fixef(tvV = c(, 0.487506, )) fixef(tvKa = c(, 0.0813175, )) fixef(tvF = c(0, 0.87914, 0.985643602863839)) fixef(tvdur = c(, 3.59687, )) fixef(tvkint=c(,1.7585,)) fixef(tvkd=c(,0.155133,)) k0=koutE0 P0=k0/kp deriv(DRa= kintDR-krDRa) #DRa is the activated DR complex and kr is transit from a hypothetical comparment deriv(P = k0 * (1 + ((Smax * DRa) / (DRa + SC50))) - kp * P)#k0 is zero order stimulation of precursor (P) production and kp is the 1st order rate of conversion of P to (\E deriv(E = kpP-koutE) #E is the PD response observe(EObs = E + EEps) # observe statement for E using additive error based on standard deviation error(EEps = 1733.74) sequence{E=E0} sequence{P=koutE0/kp} stparm(E0=tvE0) stparm(kout = tvkoutexp(nkout)) stparm(Smax = tvSmax) stparm(SC50= tvSC50) stparm(kr = tvkr) stparm(kp = tvkp) fixef(tvE0=c(0,2831.58,)) fixef(tvkr =c(0,0.523305,)) fixef(tvkp=c(0,0.536113,)) fixef(tvkout= c(0,0.0198855,)) fixef(tvSmax=c(0,11079600,)) fixef(tvSC50=c(0,253519,)) ranef(diag(nV, nF, ndur, nkint, nkout) = c(0.25239902, 0.0039700942, 0.077763133,0.45833155, 0.02)) }

Dear Elliott You wrote stparm(Rmax = tvRmax) but tvRmax is not defined anywhere. You need to define fixef(tvRmax=c(,your initial estimate of Rmax,)) Then now Rmax will be defined and Rf=Rmax-DR can be calculated. It is strange that the compiler did not catch that. Try with tvRmax defined and let me know if it solves the problem. best Serge

Hi Serge, the fixed effect statement was indeed already in the model for Rmax, I just must have deleted it when I was editing the post. so that wasn’t the issue in this case. Is the order of the statements correct? Do the differentials make sense in Phoenix parlance? are my initial conditions appropriately statement? I konw there are alot of parameters, however the PK portion alone fits the observed data very very well, so I’m thinking I’m missing something in the PK-PD link. I actually tried to remove the precursor thinking by removing some parameters that it would fit better but Iose some of the sigmoidal response profile. for some reason the delay in response (i.e. the time between E0 and the first observed timepont are not being fitted properly…reflected by the “kr” parameter, but changing the kr parameter rate isn’t having the desired result. Any help is appreciated. The model is as follows: test(){ deriv(A1 = (Aa * Ka) - (kdCRf) + (kdDR)) deriv(DR=(CkdRf)-(kd+kint)DR) Rf=Rmax-DR deriv(Aa = - (Aa * Ka)) dosepoint(A1, bioavail = (1-F), duration = (dur), idosevar = A1Dose, infdosevar = A1InfDose, infratevar = A1InfRate) dosepoint(Aa, bioavail = (F), idosevar = AaDose, infdosevar = AaInfDose, infratevar = AaInfRate) error(CEps = 0.21545) observe(CObs = C + CEps * (1 + C * CMixRatio)) C = A1 / V stparm(CMixRatio = tvCMixRatio) stparm(V = tvV * exp(nV)) stparm(Ka = tvKa) stparm(F = tvF * exp(nF)) stparm(dur = tvdur * exp(ndur)) stparm(kint = tvkintexp(nkint)) stparm(kd = tvkd) stparm(Rmax = tvRmax) fixef(tvCMixRatio = c(, 0.0933754, )) fixef(tvV = c(, 0.487506, )) fixef(tvKa = c(, 0.0813175, )) fixef(tvF = c(0, 0.87914, 0.985643602863839)) fixef(tvdur = c(, 3.59687, )) fixef(tvkint=c(,1.7585,)) fixef(tvkd=c(,0.155133,)) fixef(tvRmax=c(,2.28479, )) k0=koutE0 P0=k0/kp deriv(DRa= kintDR-krDRa) #DRa is the activated DR complex and kr is transit from a hypothetical comparment deriv(P = k0 * (1 + ((Smax * DRa) / (DRa + SC50))) - kp * P)#k0 is zero order stimulation of precursor (P) production and kp is the 1st order rate of conversion of P to E deriv(E = kpP-koutE) #E is the effect response observe(EObs = E + EEps) # observe statement for effectr using additive error based on standard deviation error(EEps = 1733.74) sequence{E=E0} sequence{P=koutE0/kp} stparm(E0=tvE0) stparm(kout = tvkoutexp(nkout)) stparm(Smax = tvSmax) stparm(SC50= tvSC50) stparm(kr = tvkr) stparm(kp = tvkp) fixef(tvE0=c(0,2831.58,)) fixef(tvkr =c(0,0.523305,)) fixef(tvkp=c(0,0.536113,)) fixef(tvkout= c(0,0.0198855,)) fixef(tvSmax=c(0,11079600,)) fixef(tvSC50=c(0,253519,)) ranef(diag(nV, nF, ndur, nkint, nkout) = c(0.25239902, 0.0039700942, 0.077763133,0.45833155, 0.02)) }

Dear Elliot In your data set, is the first recording time 0? The initial conditions always apply to t=0. If your first record is not zero, the program will extrapolate to zero to find the initial condition at t=0. Can you share the data set? I do not see any problem with the order here. Best Regards Serge

Oups, you should use only one sequence statement Not sequence{E=E0} sequence{P=koutE0/kp} but sequence{E=E0 P=koutE0/kp} Now within the sequence statement, the statement are processed sequentially. Not even sure you can use 2 sequence statements and if you do, not sure that E will be calculated before P. Try Best Serge

I did a simulation with A1=100 and Aa =100. I got # repl id time C E 0 “1” 0 0 2831.58 0 “1” 1 24.5002 2899.04 0 “1” 2 46.4897 3773.18 0 “1” 3 66.8043 6315.88 0 “1” 4 85.397 10729.1 0 “1” 5 99.1304 16812.1 0 “1” 6 105.183 24221.8 0 “1” 7 109.994 32600.8 0 “1” 8 113.665 41639.2 0 “1” 9 116.293 51094 0 “1” 10 117.962 60784.9 You can see that E starts at 2831.58. Now if your first record is not 0, then that can mess up all the results because the E0 initial condition applies to t=0. I am pretty sure that your problem is somewhere there because I am getting E starting at E0 because I am starting at t=0. Best Serge

Dear Elliott I think you have a multiple absorption peak and not IV and oral dose. therefore the first part of the code should be more like Dear Elliot It seems that you have double absorption peak. In that case, the code should be more like deriv(A1 = - (Cl * C) + (Aa1 * Ka) + (Aa2 * Ka) - (kdCRf) + (kdDR)) deriv(DR=(Ckd*Rf)-(kd+kint)*DR) Rf=Rmax-DR deriv(Aa1 = - (Aa1 * Ka)) deriv(Aa2 = - (Aa2 * Ka)) C = A1 / V error(CEps = 1) observe(CObs = C + CEps) dosepoint(Aa1, bioavail = (F), idosevar = Aa1Dose, infdosevar = Aa1InfDose, infratevar = Aa1InfRate) dosepoint(Aa2, bioavail = (1-F), idosevar = Aa2Dose, infdosevar = Aa2InfDose, infratevar = Aa2InfRate) then same code as before. Best Serge

Next Question (and by the way, thank you to Serge for addressing my question). This is a model with 2 similar biologic formulations of the same drug in Rhesus monkeys and my final model has covariates of body weight on volume and formulation on volume and clearance. what I would like to do is use the model to scale up to a population of humans at a different dose. Given my model is textual, how would one simulate the Cobs and Eobs from my PKPD model for a particular distribution of body weights. ( I can generate say n=100 of body weights in R) but in terms of mapping that data in, I’m unclear. Do I create a data sheet which has the column variable names and data for everything except the Cobs and Eobs, and run the mode in sim/pred check? e.g. ID Time Dose Weight Cobs Eobs 1 0 1000 70 1 0.5 1 1 1 5 2 0 1000 73 2 0.5 2 1 2 5 Thank you, Elliot

Dear Elliott You can use the add simulation table and here is the trick. Rather than defining weight as a covariate, you define it as a model parameter. stparm(weight=tvweightexp(nweight)) You define the geometric mean tvweight, let say 70 and suppose you have 30% cv, then nweight in the ranef statement will be 0.30.3. ranef(diag(nweight)=c(0.09)) Now each simulated patient will randomly generate a weight from that distribution which is what you want. This make your template data set easier to make. He will not have weight column as you use weight as a model parameter. Try it and send me your project for review. best Serge

Serge, I’ll try that little trick, in the meantime, using R, it wasn’t too difficult (with a colleague’s help), to create the file. I guess, the other parts of my question are: (1) do I leave Eobs and Cobs blank in the input file? (2) do I state in the simulation table I want Eobs and Cobs? (3) then it will fill essentially fill in the Eobs and Cobs for those timepoints and dose specified in the input file? Elliot

Dear Elliott You map the same way you would map a model for fitting. At each record you want an hypothetical value of EObs and/or CObs, you put any number ( like 0) for EObs and/or CObs. Then the program will create predicted+noise EObs and/or CObs. Let me know if you want to use also the add sim table option. This can be useful if you want lot of data points but all patients with the same set of time points. best Serge

Dear Elliott Please see the link to the project with simulations. I did it with both sim table and also the regular one (AllPCdata). Note that in the upcoming version of the program that the speed will be about 100 times faster. I discovered a while ago issue with speed and they fixed it. Note that AllPCdata does not give the prediction without noise. In your version you cannot put 0 error (you can with a trick indeed) change observe(CObs = C * (1 + CEps)) to observe(CObs = C * (1 + CEps*0)) same with E link to the simulations Box Happy new year Note also that in the interface there is a box with stratification, that is where you select formualation. I changedyour data set to include formulation column and put all 0 for Cobs and EObs to get AllPCdata output too. Hope it helps. Best Serge Hi Serge, I’m taking you up on your offer to help me figure out how to perform the simulations in NLME. I’m sending to your email as I know these NLME project files are big and don’t always attach properly for me on the website. So to remind you, I’ve got data in rhesus monkeys for two biosimilar formulations. I’ve fit the model with a covariate of formulation on a couple parameters. I now want to simulate to human by (1) adding a covariate of weight onto the volume parameter and (2) simulate by categorical formulation. Using the dose actually administered to the humans in the human study. I’ve created an input file with simulated body weight from my human study (using R). How do I create a simulated dataset from the final model stratified by covariate of formulation (=0 or =1), using the dose and sampling times in my input file? Attached is the project file with the final textual model and the two datasheets (actual rhesus monkey data and simulated human sheet). What I can’t figure out is how to tell it to stratify by formulation? Do I randomly assign 50% of the subjects to formulation =0 and the other 50% to 1? Thanks Elliot

Serge, this is exactly what I needed. I see from the project file, that in the sim table interface, you included “Formulation” as a variable. I was missing this part. I had included Formulation as a covariate to stratify by, but I had assumed that then this variable would carry over into the output simulation file…evidently not. So if I can reiterate my errors in setting up the simulation: (1) I didn’t put all the variables in the input file - so it is critical that your input file has all the columns (data variables) for mapping to your model if you want to simulate the data, especially if you want to stratify to a particular covariate. (2) if you want to simulate the observed Concentration or Effect, you need to incude C and E (without noise). Or if you only want C and E, you can set the noise to zero. follow-up question, is when would you want this? I had understood in simulation we want to simulate what we would have observed. Other than that, Serge, you have helped me close the loop on this simulation piece. I can now use NLME as a more power tool. Thank you again and happy new year! Elliot

Dear Elliott (1) I didn’t put all the variables in the input file - so it is critical that your input file has all the columns (data variables) for mapping to your model if you want to simulate the data, especially if you want to stratify to a particular covariate. Yes. If you do not do that, the program has no idea what value to assign for the covariate (2) if you want to simulate the observed Concentration or Effect, you need to include C and E (without noise). Or if you only want C and E, you can set the noise to zero. In addition in the input file, you need to put any value you want (0 is the easiest) for EObs and CObs at each record you want a prediction. This applies to the ALLPCdata output only. Only the non empty cells for EObs and CObs will have predictions. Yes, in ALLPCdata, you get the prediction + noise. In the table simulated, you can write C,E,CObs and EOBS to get both predictions with and without noise. In the upcoming version, you can just put the dosing information in the input file and use the table to get the simulation if all paitent have the same set of times. If the times are different across for example different cohort, then you need to put that in the input file (not only the dosing information) follow-up question, is when would you want this? I had understood in simulation we want to simulate what we would have observed. Not always and often not. You want to separate the signal from the noise to see what would be the true effect in a trial. The noise is assumed to be not a part of the signal and that is why commonly you want C,E and not CObs and EObs. In addition, if your error model is mixed (ctse + proportional) or you have large proportional error, you will get easily negative values for your predictions with noise and it is really confusing. I am happy you love the software. We invested huge time and energy and wait for the upcoming version that is 100 times more powerful. You can always count on all of us to provide the necessary support you need. Pass the message to all your colleagues if you believe it. Happy new year and see you next year. best Serge