RE: [NMusers] Question about handling BLOQ data with mixture model

2012-05-26 Thread Martin Bergstrand
Dear Andy and Yaping,

 

I am sorry for my embarrassingly bad advice. I can now see that it is my
clumsy code that does not sum up to 1. That I should have written and how
normally code it is this:

 

$MIX

  NSPOP=3

  P(1) = THETA(8)/100

  P(2) = (1-THETA(8)/100)*THETA(9)/100

  P(3) = 1-THETA(8)/100 -((1-THETA(8)/100)*THETA(9)/100)

 

$THETA (0, 3.78, 100)  ; PMIX1

$THETA (80, 91, 100)   ; PMIX2/(1-PMIX1)

 

This is as the sober me can see mathematically identical to what you did. I
should get an alcohol lock for outlook so that I can't do NMusers postings
after more than 1 beer. 

 

For what it is worth coming from me you could try to add a very small number
to the CUMD (e.g. 10^-6). If you have a BQL observation that NONMEM predicts
a very low probability NONMEM will in my experience crash. When you get a
run working with this arbitrary imputation you can investigate what
observations that has this extremely low probability and investigate if
there seem to be something fishy about them. In general it can be said that
the Laplacian estimation method in NONMEM is notoriously instable and
slightly prone to local minima. It can for that reason be useful to by
default try running with perturbed initial estimates. 

 

Good luck,

Martin

 

From: owner-nmus...@globomaxnm.com [mailto:owner-nmus...@globomaxnm.com] On
Behalf Of Andy Stein
Sent: den 26 maj 2012 01:45
To: lgibian...@quantpharm.com
Cc: nmusers@globomaxnm.com; yapingz2...@gmail.com
Subject: Re: [NMusers] Question about handling BLOQ data with mixture model

 

I wanted to follow up on the comments to Yaping's email.First, the three
probabilities below from the original code do in fact sum to 1.

 

   P(1)=THETA(8)/100

   P(2)=(1-THETA(8)/100)*THETA(9)/1000

   P(3)=(1-THETA(8)/100)*(1-THETA(9)/1000)

 

Note that: P(2) + P(3) = 1-THETA(8)/100

 

And thus P(1) + P(2) + P(3) = 1

 

Also, the model worked completely fine when the BLOQ part of the code was
left out and only the mixture was modeled.  That is what led us to think
that the combination of BLOQ with a Mixture was causing the problem.  

 

Andy

 

On Fri, May 25, 2012 at 1:07 PM, lgibian...@quantpharm.com
 wrote:

Sum of probabilities should sum to 1. More standard way would be to use

P(1) = 1/(1+THETA(8)+THETA(9))

P(2) = THETA(8)/(1+THETA(8)+THETA(9))

P(3) = THETA(9)/(1+THETA(8)+THETA(9))

where THETA(8) and THETA(9) are any positive numbers
Regards
Leonid

Original Message:
-
From: Martin Bergstrand martin.bergstr...@farmbio.uu.se
Date: Fri, 25 May 2012 22:59:45 +0700
To: yapingz2...@gmail.com, nmusers@globomaxnm.com
Subject: RE: [NMusers] Question about handling BLOQ data with mixture model



Dear Yaping,



I can see that you need to make any particular consideration  because you
are applying a mixture model. CUMD is dependent on IPRED that in its turn is
dependent on the assigned mixture. That should be enough.



However, I spot what must be an error in your way of defining your mixture
probabilities. As it is now you total probability does not sum up to 1. Why
don't you parameterize it his way:



$MIX

  NSPOP=3

  P(1) = THETA(8)/100

  P(2) = (1-THETA(8)/100)*THETA(9)/100

  P(3) = 1-THETA(8)/100 -THETA(9)/100



$THETA (0, 3.78, 100)  ; PMIX1

$THETA (80, 91, 100)   ; PMIX2/(1-PMIX1)



I have kept the division of THETAs by 100 since I assume that you want
estimates in %. However the division with 1000 did not make any sense to me
despite the correctly assigned THETA boundaries?



Finally a word of caution, be careful with the use of NONMEM reserved
variables such as T (integrated time in $DES) and F (default model
prediction with some ADVANS). In my experience things can go wrong when you
use them outside the way it was intended, conflicts can occur.



Kind regards,



Martin Bergstrand, PhD

Pharmacometrics Research Group

Dept of Pharmaceutical Biosciences

Uppsala University

Sweden

martin.bergstr...@farmbio.uu.se



Visiting scientist:

Mahidol-Oxford Tropical Medicine Research Unit,

Bangkok, Thailand





From: owner-nmus...@globomaxnm.com [mailto:owner-nmus...@globomaxnm.com] On
Behalf Of Yaping Zhang
Sent: den 25 maj 2012 02:04
To: nmusers@globomaxnm.com
Subject: [NMusers] Question about handling BLOQ data with mixture model



Hello NMUsers,



I am trying to analyze BLOQ data using the M3 method (Stuart Beal, Ways to
Fit a PK Model with Some Data Below the Quantification Limit, 2001). The
model I have is a mixture model to describe PD response of three
subpopulations. The complete control stream is pasted below.



I have implemented just the mixture model (no BLOQ) and just the BLOQ error
model (no mixture) and it works fine with nonmem 6.  But the run crashed
immediately using nonmem 6 if including both BLOQ and the mixture model.



I am wondering if I need to account for the mixture in the section of the
code below when putting a mixture model together with the BLOQ error model

IF (BLOQ.EQ.1) THEN

F_FLAG=1

Y =CUMD + s

RE: [NMusers] Question about handling BLOQ data with mixture model

2012-05-26 Thread Mats Karlsson
Hi Martin,

 

If you write P(3) =1-P(1)-P(2) you reduce the risk of writing something
incorrect J

 

Mats Karlsson

Mats Karlsson, PhD

Professor of Pharmacometrics

 

FIRST WORLD CONFERENCE ON PHARMACOMETRICS, 5-7 September 2012, Seoul (
 www.go-wcop.org)

 

Dept of Pharmaceutical Biosciences

Faculty of Pharmacy

Uppsala University

Box 591

75124 Uppsala

 

Phone: +46 18 4714105

Fax + 46 18 4714003

 

From: owner-nmus...@globomaxnm.com [mailto:owner-nmus...@globomaxnm.com] On
Behalf Of Martin Bergstrand
Sent: 26 May 2012 09:06
To: 'Andy Stein'; yapingz2...@gmail.com
Cc: nmusers@globomaxnm.com; lgibian...@quantpharm.com
Subject: RE: [NMusers] Question about handling BLOQ data with mixture model

 

Dear Andy and Yaping,

 

I am sorry for my embarrassingly bad advice. I can now see that it is my
clumsy code that does not sum up to 1. That I should have written and how
normally code it is this:

 

$MIX

  NSPOP=3

  P(1) = THETA(8)/100

  P(2) = (1-THETA(8)/100)*THETA(9)/100

  P(3) = 1-THETA(8)/100 -((1-THETA(8)/100)*THETA(9)/100)

 

$THETA (0, 3.78, 100)  ; PMIX1

$THETA (80, 91, 100)   ; PMIX2/(1-PMIX1)

 

This is as the sober me can see mathematically identical to what you did. I
should get an alcohol lock for outlook so that I can't do NMusers postings
after more than 1 beer. 

 

For what it is worth coming from me you could try to add a very small number
to the CUMD (e.g. 10^-6). If you have a BQL observation that NONMEM predicts
a very low probability NONMEM will in my experience crash. When you get a
run working with this arbitrary imputation you can investigate what
observations that has this extremely low probability and investigate if
there seem to be something fishy about them. In general it can be said that
the Laplacian estimation method in NONMEM is notoriously instable and
slightly prone to local minima. It can for that reason be useful to by
default try running with perturbed initial estimates. 

 

Good luck,

Martin

 

From: owner-nmus...@globomaxnm.com [mailto:owner-nmus...@globomaxnm.com] On
Behalf Of Andy Stein
Sent: den 26 maj 2012 01:45
To: lgibian...@quantpharm.com
Cc: nmusers@globomaxnm.com; yapingz2...@gmail.com
Subject: Re: [NMusers] Question about handling BLOQ data with mixture model

 

I wanted to follow up on the comments to Yaping's email.First, the three
probabilities below from the original code do in fact sum to 1.

 

   P(1)=THETA(8)/100

   P(2)=(1-THETA(8)/100)*THETA(9)/1000

   P(3)=(1-THETA(8)/100)*(1-THETA(9)/1000)

 

Note that: P(2) + P(3) = 1-THETA(8)/100

 

And thus P(1) + P(2) + P(3) = 1

 

Also, the model worked completely fine when the BLOQ part of the code was
left out and only the mixture was modeled.  That is what led us to think
that the combination of BLOQ with a Mixture was causing the problem.  

 

Andy

 

On Fri, May 25, 2012 at 1:07 PM, lgibian...@quantpharm.com
 wrote:

Sum of probabilities should sum to 1. More standard way would be to use

P(1) = 1/(1+THETA(8)+THETA(9))

P(2) = THETA(8)/(1+THETA(8)+THETA(9))

P(3) = THETA(9)/(1+THETA(8)+THETA(9))

where THETA(8) and THETA(9) are any positive numbers
Regards
Leonid

Original Message:
-
From: Martin Bergstrand martin.bergstr...@farmbio.uu.se
Date: Fri, 25 May 2012 22:59:45 +0700
To: yapingz2...@gmail.com, nmusers@globomaxnm.com
Subject: RE: [NMusers] Question about handling BLOQ data with mixture model



Dear Yaping,



I can see that you need to make any particular consideration  because you
are applying a mixture model. CUMD is dependent on IPRED that in its turn is
dependent on the assigned mixture. That should be enough.



However, I spot what must be an error in your way of defining your mixture
probabilities. As it is now you total probability does not sum up to 1. Why
don't you parameterize it his way:



$MIX

  NSPOP=3

  P(1) = THETA(8)/100

  P(2) = (1-THETA(8)/100)*THETA(9)/100

  P(3) = 1-THETA(8)/100 -THETA(9)/100



$THETA (0, 3.78, 100)  ; PMIX1

$THETA (80, 91, 100)   ; PMIX2/(1-PMIX1)



I have kept the division of THETAs by 100 since I assume that you want
estimates in %. However the division with 1000 did not make any sense to me
despite the correctly assigned THETA boundaries?



Finally a word of caution, be careful with the use of NONMEM reserved
variables such as T (integrated time in $DES) and F (default model
prediction with some ADVANS). In my experience things can go wrong when you
use them outside the way it was intended, conflicts can occur.



Kind regards,



Martin Bergstrand, PhD

Pharmacometrics Research Group

Dept of Pharmaceutical Biosciences

Uppsala University

Sweden

martin.bergstr...@farmbio.uu.se



Visiting scientist:

Mahidol-Oxford Tropical Medicine Research Unit,

Bangkok, Thailand





From: owner-nmus...@globomaxnm.com [mailto:owner-nmus...@globomaxnm.com] On
Behalf Of Yaping Zhang
Sent: den 25 maj 2012 02:04
To: nmusers@globomaxnm.com
Subject: [NMusers] Question about handling BLOQ d