From: "ZDROJEWSKI,IMMO" zdrojew@ufl.edu Subject: [NMusers] log transformed data and multi compartment PK Date: Tue, 26 Jul 2005 17:17:57 -0400 (EDT) Dear NONMEM users, I was trying to model the PK of a drug that shows high variablility in the data. In order to improve the speed of NONMEM and improve the high variability I tried to log tranform the data. I can make it work, modeling one compartment only, however, since I have data for the metabolite, I want to model praent drug and metabolite. When I start the Nonmem run, I get an error message saying: run-time error M6202: math - log: SING error I figure that it might have something to do with the log function, but nothing worked so far to fix it. Does anybody have an idea what I could cahnge in the attached code? Thanks a lot in advance Immo ----------------------- $SUBROUTINE ADVAN8 TOL=5 $MODEL ;SPECIFIES WITH MODEL FROM PREDPP IS USED TO FIT THE DATA. NCOMPARTMENTS=3 COMP = SVA COMP = SV COMP = SVAP $PK ;$PK ASSIGNS THETAS TO FIXED EFFECT PARAMETERS AND SPECIFIES THE RANDOM EFFECT MODEL ;E.G ADDITIVE, PROPORTIONAL, EXPONENTIAL TVK1=THETA(1) K12=TVK1*EXP(ETA(1)) TVK2=THETA(2) K21=TVK2*EXP(ETA(2)) TVKE=THETA(3) KE=TVKE*EXP(ETA(3)) TVVD=THETA(4) VD=TVVD*EXP(ETA(4)) TVKL=THETA(5) KL=TVKL*EXP(ETA(5)) TVKA=THETA(6) KA=TVKA*EXP(ETA(6)) TVKX=THETA(7) KX=TVKX*EXP(ETA(7)) TVSV=THETA(8) SV=TVSV*EXP(ETA(8)) ;THETA IS THE ESTIMATED POPULATION VALUE, EXPONENTIAL BETWEEN SUBJECT VARIABILITY IS USED HERE, ;ETA IS THE BETWEEN SUBJECT VARIABILITY S1=VD/1000 S2=SV/1000 ;S=SCALING FACTOR TO ADJUST FOR THE UNITS, DOSE= MG CONC = NG/ML SCALING FACTOR = 1000 $ERROR (OBSERVATION ONLY) Q1=0 IF(CMT.EQ.1) Q1=1 Y1=LOG(F)+ERR(1) Q2=0 IF(CMT.EQ.2) Q2=1 Y2=LOG(F)+ERR(2) Y=Q1*Y1+Q2*Y2 IPRED=LOG(F) $DES DADT(1)= -KE*A(1)-K12*A(1)+K21*A(3)-KA*A(1)+KL*A(2) DADT(2)= KA*A(1)-KL*A(2)-KX*A(2) DADT(3)= K12*A(1)-K21*A(3) $THETA (0,2.7) ;(0,2,10) THETAK12 (0,0.27) ;(0,0.5,10) THETA K21 (0,4.5);(0,0.83,10)NTHEATKE (0,8) ;(0,210) THETAVD (0,0.09) ;K LACTONE TO ACID (0,0.16) ;K ACID TO LACTONE (0,1.5) ;KX ELIMINATION FOR SV (0,25.7) ; VDSV ESTIMATE $OMEGA 0.09 0.09 0.01 0.09 0.09 0.09 0.09 0.09 $SIGMA 1 1 $ESTIMATION METH=0 MAXEVAL=9999 PRINT=5 MSFO=002NM20LOG.MSF ;SIGDIG=2 $COVARIANCE $TABLE ID TIME TVK1 K12 ETA1 TVK2 K21 ETA2 TVKE KE ETA3 TVVD VD ETA4 TVKL KL ETA5 TVKA KA ETA6 TVKX KX ETA7 TVSV SV ETA8 ID CMT ;IPRED NOPRINT FILE=002NM20LOG.FIT X ID CMT TIME CONC AMT RATE MDV 0 1 1 0 . 1.301029996 1.602059991 1 0 1 2 0 . 0 0 1 0 1 1 0.25 2.702266783 0 0 0 0 1 2 0.25 -0.086186148 0 0 0 0 1 1 0.5 2.837481114 0 0 0 0 1 2 0.5 -0.283996656 0 0 0 0 1 1 0.67 2.109659527 0 0 0 0 1 2 0.67 -0.427128398 0 0 0 0 1 1 0.83 1.893040112 0 0 0 0 1 2 0.83 -0.368556231 0 0 0 0 1 1 1 1.740094134 0 0 0 0 1 2 1 -0.242603971 0 0 0 0 1 1 1.5 1.544626064 0 0 0 0 1 2 1.5 -0.240332155 0 0 0 -- Immo Zdrojewski, Pharmacist Graduate Student @ Pharmaceutics: (352)-846-2584 @ Nursing: (352)-273-6513 e-mail: zdrojew@ufl.edu _______________________________________________________ From: David Dai david.dai@bms.com Subject: RE: [NMusers] log transformed data and multi compartment PK Date: Tue, 26 Jul 2005 18:05:20 -0400 Hi, Immo: Log transformation is a better way to fit parent/metabolite simultaneously. I never got converged with FOCE-interaction using real DV data. but quite happy with log transformed data and run time was much shorter. In your error block, you might want to add the following lines to avoid the error messages: CALLFL=0 IPRED = -6 IF (F.GT.0) IPRED =LOG(F) Additionally, have you tried a different error structure for log-transformed data such as combined additive and proportional model? Best, david _______________________________________________________ From: Leonid Gibiansky leonidg@metrumrg.com Subject: Re: [NMusers] log transformed data and multi compartment PK Date: Tue, 26 Jul 2005 18:17:03 -0400 1. I would use ADVAN5 or ADVAN7 rather then differential equations if you want to speed up the process 2. It is better to follow conventions and use K13 - K31 for the mass exchange between compartments 1 and 3, rather than K12 - K21 (and similarly for all the other coefficients) 3. If F (prediction) is equal to zero, NONMEM will crash. Just in case, use IPRED=F IF(IPRED.LT. some small number, say LLOQ, 0.01) IPRED= same number, say 0.01 Y1=LOG(IPRED)+ERR(1) 4. Try to start with just 2-3 random effects first, and add more if needed/supported by the data 5. You have identifiability problem. You need either to fix S1=S2 or assume complete metabolism (KE=0) or assume metabolization fraction (KA= some.fixed.number*KE) 6. What is the meaning of KL, is it reversible metabolism? Good luck Leonid _______________________________________________________ From: "Gordi, Toufigh" Toufigh.Gordi@cvt.com Subject: RE: [NMusers] log transformed data and multi compartment PK Date: Tue, 26 Jul 2005 15:29:23 -0700 Hi Immo, Your model is a very complex one: a drug with 2-compartmental kinetics (compartments 1 and 3 in your model) with 2 distinctive elimination pathways: one forming a measured metabolite (compartment 2) and another with a rate of KE. Your model also implies that the metabolism is reversible and beside being eliminated by a rate of KKX, the metabolite is also transformed back to the parent compound. Maybe I understand you incorrectly but I thought you were trying to fit a 1-comp model to your data. Assuming the model is correct as written, it is indeed quite complex and unless you have very good data it would be difficult to estimate all the parameters of the model. On the top of that, you are trying to estimate not less than 8 variability terms! My suggestion to you is to start with the simplest model you can come up with (which at the same time is supported by what you know about your compound and its metabolite), trying to estimate 1-2 ETAs at the most. Once you have established the simple model, you can add more complexity by adding more structural model and /or variability parameters. I also recommend that you name the parameters after the compartments to make it easier for others to follow your model. I am assuming that you have a metabolite with longer elimination half-life, or you know the kinetics of your metabolite after an iv dose of the metabolite from previous studies. Otherwise, you will have difficulties in estimating model parameters associated with your metabolite. Others have already addressed the problem with log-normalized data. Toufigh Gordi _______________________________________________________ From: "ZDROJEWSKI,IMMO" zdrojew@ufl.edu Subject: Re: [NMusers] log transformed data and multi compartment PK Date: Tue, 26 Jul 2005 22:24:28 -0400 (EDT) Hello Leonid, I think I expressed myself wrong when I said one compartment body model. It's more likely that I have reverible metabolism of drug into metabolite and periperal compartments for drug and metabolite. I will have to use ADVAN* to fit the data. I should try to maybe set S1=S2. I will try that next. KL and KA are for reversible metabolism, however it seems that one of the constants is low or neglegible. (I think I need the Luck Thanks for the help, Immo _______________________________________________________ From: "ZDROJEWSKI,IMMO" zdrojew@ufl.edu Subject: Re: [NMusers] log transformed data and multi compartment PK Date: Tue, 26 Jul 2005 22:30:23 -0400 (EDT) Hi Toufigh, thanks a lot for your help. Indeed the problem is very complex. I thnk I expressed myself in a wrong way when I was talking about the one compartment body model. What I meant was that the drug and metabolite either do or do not have a peropheral compartment. That's defenitively not a one compartment model. I will try to start with the easiest model. Thanks a lot for the help, Immo _______________________________________________________