Re: Problem with estimating sigma when using M3 method
For error messages, check that you have bounds on THETAs that prevent model parameters to be negative (if they should be positive, like CL). Check whether there are any places where you could "ATTEMPT TO COMPUTE BASE*POWER WITH BASE < 0". Otherwise, these error messages are OK if the final model looks good. For the pre-dose values, if the model can produce only zeros there (pre-first dose), then these points do not have any information value, and should be excluded (probably harmless but useless). We should not compare OF of models with different number of observations, this has no meaning.
Regards,
Leonid
Quoted reply history
On 5/31/2023 8:58 AM, Hiba Sliem wrote:
> Thank you! I followed your advice by ignoring bql values at first and I managed
> to get my model to work with satisfying results.
>
> I did chose not to exclude any bql DV in my final dataset, including those
> pre-first dose samples, since removing them only slightly changes my parameter
> estimates while increasing the objective function, what's the usual approach
> when dealing with predose observations?
>
> And finally while my model seems to be a good fit, during its execution nonmem
> displayed several error messages in the output window that weren't reported in
> the res file such as:
>
> OCCURS DURING SEARCH FOR ETA AT INITIAL VALUE, ETA=0
> PK SUBROUTINE: ERROR IN COMPUTATION
> ATTEMPT TO COMPUTE BASE*POWER WITH BASE < 0
> PRED EXIT CODE= 1
>
> OCCURS DURING SEARCH FOR ETA AT INITIAL VALUE, ETA=0
> ERROR In TRANS4 ROUTINE, CL (could also be V2 or Q) IS NEGATIVE
>
> All these errors involved the first subject ID=1 exclusively
>
> Should these messages be taken into consideration or can they be overlooked
> considering they weren't transcribed in the report file and I'm satisfied with
> my model?
>
> Thank you again
>
> regards
>
> -----Original Message-----
> From: Leonid Gibiansky <[email protected]>
> Sent: Tuesday, 30 May 2023 04:17
> To: Hiba Sliem <[email protected]>
> Cc: nmusers <[email protected]>
> Subject: Re: [NMusers] Problem with estimating sigma when using M3 method
>
> The code is incorrect, $ERROR should be
>
> $ERROR
> LOQ=0.1
> IPRED = F
> W1 = THETA(8)*IPRED
> W2 = THETA(9)
> W = SQRT(W1**2+W2**2)
> IRES = DV - IPRED
> IWRES = IRES/W
> DUM = (LOQ -IPRED)/W
> CUMD = PHI(DUM)
> IF(BLQ.EQ.0) THEN
> F_FLAG=0
> Y= IPRED +W1*ERR(1) + W2*ERR(2)
> ELSE
> F_FLAG=1
> Y=CUMD
> MDVRES = 1
> ENDIF
>
> My be it makes sense to show the entire $PK and $EST blocks: easier to check.
> Which ADVAN do you use? If ADVAN6, switch to ADVAN13
>
> Use MATRIX=S on $COV step
> Use NOABORT on $EST step
>
> try to use NSIG=4 SIGL=12 on $EST with LAPLACEAN
>
> For pre-dose samples, do you mean pre-first dose? Then those should be ignored,
> removed from the data set, or use EVID=2 MDV=1, then they will be ignored at
> estimation. After washout, if all samples are BQLs, I would ignore them in a
> similar way, at least initially.
> For washout setting, all versions are fine, You can use TIME=0 EVID=4 for the
> first dose after washout.
>
> To check the code, I would first remove BQLs (use MDV=1 EVID=2 for those, to
> get IPRED), use FOCEI rather than LAPLACEAN, and make sure that the model fit
> is good. Then check that IPRED at the points of BQLs is small. If not, check
> whether those BQLs are reasonable or could be data errors. Then switch to
> LAPLACEAN with initial values of all parameters set at the final values of the
> previous FOCEI run. Make sure you use INTERACTION options for all runs.
>
> Good luck!
> Leonid
>
> On 5/29/2023 8:02 PM, Hiba Sliem wrote:
>
> > Hi
> >
> > Thank you for your assistance, unfortunately I still haven't found a solution
> > to my issue, and I keep running into either one of these error messages
> > depending on my dataset codification:
> >
> > #PROGRAM TERMINATED BY OBJ
> > ERROR IN NCONTR WITH INDIVIDUAL 6 ID= 6.00000000000000E+00
> > NUMERICAL HESSIAN OF OBJ. FUNC. FOR COMPUTING CONDITIONAL ESTIMATE
> > IS NON POSITIVE DEFINITE
> >
> > #R MATRIX ALGORITHMICALLY SINGULAR
> > AND ALGORITHMICALLY NON-POSITIVE-SEMIDEFINITE 0R MATRIX IS OUTPUT
> > 0COVARIANCE STEP ABORTED
> >
> > I finally managed to have both estimation and covariance not fail with the
> > following error code :
> > $ERROR
> > LOQ=0.1
> > IPRED = F
> > W1 = THETA(8)*IPRED
> > W2 = THETA(9)
> > IRES = DV - IPRED
> > IWRES = IRES/(W1 + W2)
> > DUM = (LOQ -IPRED)/(W1 + W2)
> > CUMD = PHI(DUM)
> > IF(BLQ.EQ.0) THEN
> > F_FLAG=0
> > Y= IPRED +W1*ERR(1) + W2*ERR(2)
> > ELSE
> > F_FLAG=1
> > Y=CUMD
> > MDVRES = 1
> > ENDIF
> >
> > $THETA
> > (0.01, 0.38) ; [w1]
> > (0.01, 0.1) ; [w2]
> >
> > $SIGMA
> > 1 FIX ;[P] sigma(1,1)
> > 1 FIX ;[P] sigma(2,2)
> >
> > However my results were accompanied by the following message:
> >
> > MINIMIZATION SUCCESSFUL
> > HOWEVER, PROBLEMS OCCURRED WITH THE MINIMIZATION.
> > REGARD THE RESULTS OF THE ESTIMATION STEP CAREFULLY, AND ACCEPT THEM ONLY
> > AFTER CHECKING THAT THE COVARIANCE STEP PRODUCES REASONABLE OUTPUT.
> >
> > I think a part of the issue is the way I've been formatting my dataset, since I
> > get different results depending on the way I've set it up, so I'd like to have
> > your opinion on the best way to proceed in the following situations:
> > >predose samples that are BLQ or higher at Time of dosing:
> > ID TIME DV AMT BLQ
> > 1 0 0.1 0 1
> > 1 0 0 10 0
> >
> > Do I keep the original times or do something like that?:
> >
> > ID TIME DV AMT BLQ
> > 1 -0.01 0.1 0 1
> > 1 0 0 10 0
> >
> > And can I ignore these observations altogether (using something like MDV=100
> > for example)?
> >
> > > Washout period followed by a predose sample and a new administration of the
> > > same drug (different dose):
> >
> > ID TIME DV AMT BLQ EVID
> > 1 0 0 10 0
> > 1
> > 1 1 0.5 0 0
> > 0
> > 1 .... ... ....
> > .... ....
> > After washout > 1 1000 0.1 0 1 0
> > 1 1000 0 20 0
> > 1
> >
> > Do I leave it inchanged, or use EVID4 either this way:
> > ID TIME DV AMT BLQ EVID
> > 1 0 0 10 0
> > 1
> > 1 1 0.5 0 0
> > 0
> > 1 .... ... ....
> > .... ....
> > 1 1000 0.1 0 1
> > 0
> > 1 0 0 20 0
> > 4
> >
> > Or that way?:
> > ID TIME DV AMT BLQ EVID
> > 1 0 0 10 0
> > 1
> > 1 1 0.5 0 0
> > 0
> > 1 .... ... ....
> > .... ....
> > 1 0 0 20 0
> > 4
> > 1 0 0.1 0 1
> > 0
> >
> > Sorry if these all seem like obvious questions, but I've been struggling to get
> > satisfying results over the last few days and I'd like to understand what I've
> > been doing wrong.
> >
> > Kind regards,
> >
> > -----Original Message-----
> > From: Philip Harder Delff <[email protected]>
> > Sent: Friday, 26 May 2023 21:42
> > To: Leonid Gibiansky <[email protected]>
> > Cc: Hiba Sliem <[email protected]>; nmusers
> > <[email protected]>
> > Subject: Re: [NMusers] Problem with estimating sigma when using M3
> > method
> >
> > [You don't often get email from [email protected]. Learn why this is
> > important at https://aka.ms/LearnAboutSenderIdentification ]
> >
> > Hi Hiba,
> >
> > I agree that often the issues should be found in the data rather than the
> > model. I recommend checking the data with NMcheckData from the R package called
> > NMdata. It scans for a long list of potential issues, some that will make
> > Nonmem fail, some that won't. If it finds issues, they will be returned in a
> > data.frame with reference to row numbers and ID's so you can easily identify
> > the root cause. If you look at ?NMcheckData you may identify arguments you can
> > specify to add to the list of checks the function can run.
> >
> > Having said this, a data/model issue can also be that your data poorly supports
> > estimation of parts of your model (practical identifiability).
> > NMcheckData won't help you identify such issues.
> >
> > NMdata:
> > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fphil
> > ipdelff.github.io%2FNMdata%2F&data=05%7C01%7CHiba.Sliem%40pharmalex.co
> > m%7Ca65c013926fc4c8b3b9c08db60b3fcdd%7Cff9ac3ce3c4141c3b556e1b32a662fe
> > d%7C0%7C0%7C638210098390223373%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA
> > wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sd
> > ata=wjIRuNgQJ9jEvmHCKVJx94bH0IEEY9hwVoUXVf2PSjA%3D&reserved=0
> > NMcheckData manual:
> > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fphil
> > ipdelff.github.io%2FNMdata%2Freference%2FNMcheckData.html&data=05%7C01
> > %7CHiba.Sliem%40pharmalex.com%7Ca65c013926fc4c8b3b9c08db60b3fcdd%7Cff9
> > ac3ce3c4141c3b556e1b32a662fed%7C0%7C0%7C638210098390223373%7CUnknown%7
> > CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXV
> > CI6Mn0%3D%7C3000%7C%7C%7C&sdata=uUA1xwU0xQw6XVhuOZD0C59TmvpbutubpINW7s
> > TwGjU%3D&reserved=0
> >
> > An example with a few arguments that activate additional checks:
> > res.checks <-
> > NMcheckData(mydata,covs="WEIGHTBL",cols.num="WEIGHT",col.usubjid="USUB
> > JID") Here, NMcheckData will (in addition to a bunch of other checks)
> > see if WEIGHTBL exists numeric, non-na and unique within subjects, WEIGHT
> > exists and is numeric and non-NA, and that ID is unique against USUBJID and
> > vice versa. (Obviously, Nonmem can't read USUBJID if it contains characters,
> > but you could still keep it to the right in the dataset for reference). See the
> > manual above for more options.
> >
> > Best,
> > Philip
> >
> > On 2023-05-26 11:06 AM, Leonid Gibiansky wrote:
> >
> > > Yes, SIGMA should be fixed to 1 (do not try anything else, it has to
> > > be done correctly in the code first, and then we should worry about
> > > how to make it work)
> > >
> > > For combined error, expression is
> > > W = SQRT(W1**2 + W2**2) (squares in both terms)
> > >
> > > Do not worry about error 134, this is harmless, and you can fix it
> > > any time after you get your model right. Add UNCONDITIONAL MATRIX=S
> > > to the $COV step.
> > >
> > > For PARAMETER ESTIMATE IS NEAR ITS BOUNDARY try to add
> > > NOSIGMABOUNDTEST NOOMEGABOUNDTEST NOTHETABOUNDTEST to $est record
> > >
> > > Most of the time, numerical difficulties come from the problems with
> > > the data, so it makes sense to clean the data set first as much as
> > > possible.
> > >
> > > Leonid
> > >
> > > On 5/26/2023 9:30 AM, Hiba Sliem wrote:
> > >
> > > > Hi
> > > >
> > > > I already tried fixing the value of sigma to 1, the covariance step
> > > > isn't implemented when I do that.
> > > > If I try fixing it to 0.144 the minimization isn't successful.
> > > >
> > > > I also tried a combined error model like this:
> > > > LOQ=0.1
> > > > IPRED = F
> > > > W1 = THETA(8)*IPRED
> > > > W2 = THETA(9)
> > > > W = SQRT(W1**1 + W2**2)
> > > > DEL = 0
> > > > IF(W.EQ.0) DEL = 1
> > > > IRES = DV - IPRED
> > > > IWRES = IRES/(W + DEL)
> > > > DUM = (LOQ -IPRED)/(W + DEL)
> > > > CUMD = PHI(DUM)
> > > > IF(BLQ.EQ.0) THEN
> > > > F_FLAG=0
> > > > Y= IPRED +W*ERR(1)
> > > > ELSE
> > > > F_FLAG=1
> > > > Y=CUMD
> > > > MDVRES = 1
> > > > ENDIF
> > > >
> > > > In which case I get a PARAMETER ESTIMATE IS NEAR ITS BOUNDARY error
> > > > message When trying to fix Sigma in the combined model I have a
> > > > MINIMIZATION TERMINATED
> > > > DUE TO ROUNDING ERRORS (ERROR=134) message.
> > > >
> > > > My dataset has a lot of predose samples and washouts between
> > > > different periods, is it possible the issue comes from my dataset?
> > > >
> > > > Regards
> > > >
> > > > -----Original Message-----
> > > > From: Leonid Gibiansky <[email protected]>
> > > > Sent: Friday, 26 May 2023 14:51
> > > > To: Hiba Sliem <[email protected]>; [email protected]
> > > > Subject: Re: [NMusers] Problem with estimating sigma when using M3
> > > > method
> > > >
> > > > [You don't often get email from [email protected]. Learn why
> > > > this is important at https://aka.ms/LearnAboutSenderIdentification ]
> > > >
> > > > you should fix
> > > >
> > > > $SIGMA
> > > > 1 FIX
> > > >
> > > > as you are already estimating the SD using THETA(8).
> > > >
> > > > Leonid
> > > >
> > > > On 5/26/2023 4:57 AM, Hiba Sliem wrote:
> > > >
> > > > > Hello
> > > > >
> > > > > I'm fairly new to nonmem, I'm currently trying to model a phase 1
> > > > > study with BLQ values, while the run was successful with no error
> > > > > message, my
> > > > > residual error has a %rse >70 and a confidence interval that
> > > > > includes
> > > > > zero.
> > > > >
> > > > > Here's my code:
> > > > >
> > > > > $ERROR
> > > > >
> > > > > LOQ=0.1
> > > > >
> > > > > IPRED = F
> > > > >
> > > > > SD = THETA(8)*IPRED
> > > > >
> > > > > DEL = 0
> > > > >
> > > > > IF(SD.EQ.0) DEL = 1
> > > > >
> > > > > IRES = DV - IPRED
> > > > >
> > > > > IWRES = IRES / (SD + DEL)
> > > > >
> > > > > DUM = (LOQ -IPRED) / (SD + DEL)
> > > > >
> > > > > CUMD = PHI(DUM) + DEL
> > > > >
> > > > > IF(BLQ.EQ.0) THEN
> > > > >
> > > > > F_FLAG=0
> > > > >
> > > > > Y= IPRED +SD*ERR(1)
> > > > >
> > > > > ELSE
> > > > >
> > > > > F_FLAG=1
> > > > >
> > > > > Y=CUMD
> > > > >
> > > > > MDVRES = 1
> > > > >
> > > > > ENDIF
> > > > >
> > > > > $EST METHOD=1 INTERACTION LAPLACIAN PRINT=5 MAX=9999 SIG=3 SLOW
> > > > > NUMERICAL MSFO=*.msf
> > > > >
> > > > > $SIGMA
> > > > >
> > > > > 0.38 ;[P] sigma(1,1) (estimated in a previous model)
> > > > >
> > > > > Furthermore, when trying to fit this model to my phase 2 dataset,
> > > > > covariance step fails when I implement it.
> > > > >
> > > > > Any suggestions are welcome
> > > > >
> > > > > Thank you