Re: [NMusers] Time-varing covariate

2013-08-25 Thread mats karlsson
Hi Leonid,

You're right.

Best regards,
Mats

Skickat från min iPhone

25 aug 2013 kl. 02:12 skrev "lgibian...@quantpharm.com" 
:

> I think there was a typo, should it be: 
> IF(TIME.GT.OTIM) CCOV=OCOV+(T-OTIM)*(COV-OCOV)/(TIME-OTIM) ;CCOV is linear
> ?
> Leonid
> Original email:
> -
> From: Mats Karlsson mats.karls...@farmbio.uu.se
> Date: Sat, 24 Aug 2013 10:02:00 +0200
> To: william.s.den...@pfizer.com, ellen.siwei...@gmail.com, 
> nmusers@globomaxnm.com
> Subject: RE: [NMusers] Time-varing covariate
> 
> 
> Dear Bill and Siwei,
> 
> 
> 
> Although the thought in Bill's reply is right, I think there is an error in
> the code. NONMEM by default uses the present values to update from the
> previous time. 
> 
> Further, it is possible to do this interpolation on the fly in the model
> file without changes to the data set. 
> 
> 
> 
> $INPUT ID TIME DV COV ;Cov is time-varying covariate
> 
> $PK
> 
> IF(NEWIND.NE.2) OTIM=0  ;initialize variable to store old time
> 
> IF(NEWIND.NE.2) OCOV=0  ;initialize variable to store old covariate value
> 
> 
> 
> $DES
> 
> CCOV=OCOV
> 
> IF(TIME.GT.OTIM) CCOV=OCOV+(T-TIME)*(COV-OCOV)/(TIME-OTIM) ;CCOV is linear
> interpolation between observed covariate values
> 
> 
> 
> $ERROR
> 
> OCOV =COV;store previous time 
> 
> OTIM  =TIME  ;store previous time
> 
> 
> 
> (NB haven't tested the code).
> 
> Best regards,
> 
> Mats
> 
> Mats Karlsson, PhD
> 
> Professor of Pharmacometrics
> 
> 
> 
> Dept of Pharmaceutical Biosciences
> 
> Faculty of Pharmacy
> 
> Uppsala University
> 
> Box 591
> 
> 75124 Uppsala
> 
> 
> 
> Phone: +46 18 4714105
> 
> Fax + 46 18 4714003
> 
> 
> www.farmbio.uu.se/research/researchgroups/pharmacometrics/
> 
> 
> 
> From: owner-nmus...@globomaxnm.com [mailto:owner-nmus...@globomaxnm.com] On
> Behalf Of Denney, William S.
> Sent: 23 August 2013 20:09
> To: siwei Dai; nmusers@globomaxnm.com
> Subject: RE: [NMusers] Time-varing covariate
> 
> 
> 
> Hi Siwei,
> 
> 
> 
> If you are using an algebraic model (i.e. no differential equations), then
> you can simply include it in your equation:
> 
> 
> 
> e.g. assuming that SBP is systolic blood pressure in your original data set:
> 
> 
> 
> EFF=THETA(1)+SBP*THETA(2)
> 
> 
> 
> If you have a differential equation model and you want the time varying
> covariate to have an effect that is not a step change, you will need to
> interpolate the covariate.  Within your data set, you'll need a column for
> the next time and the next value of the time varying covariate.  Using the
> same assumption that you have SBP in your data set as your time varying
> covariate, you will want to make two new columns to allow for interpolation:
> 
> 
> 
> ID   TIME  NTIME  SBP  NSBP  DV
> 
> 10 1  110  115   5
> 
> 11 2  115  112   3
> 
> 12 4  112  108   4
> 
> 
> 
> Then to use your parameter, you will need code like the following in your
> $DES section to linearly interpolate:
> 
> 
> 
> $DES
> 
> .
> 
> ;; Current SBP
> 
> CSBP = (NSBP - SBP)/(NTIME - TIME) * (T - TIME) + SBP
> 
> .
> 
> 
> 
> The parameter T is the current time for the differential equation solver
> which will be somewhere between TIME and NTIME.  TIME is an important column
> name for NONMEM.
> 
> 
> 
> Thanks,
> 
> 
> 
> Bill
> 
> 
> 
> From: owner-nmus...@globomaxnm.com [mailto:owner-nmus...@globomaxnm.com] On
> Behalf Of siwei Dai
> Sent: Friday, August 23, 2013 12:01 PM
> To: nmusers@globomaxnm.com
> Subject: [NMusers] Time-varing covariate
> 
> 
> 
> Hi, Dear NMusers:
> 
> 
> 
> I want to add a time-varing covariate in my model. For example, blood
> pressure or blood flow as covariates. But I am not sure how to do it. I see
> some earlier threads to discuss it but they all use complicated methods.  
> 
> 
> 
> I am wondering if there are any new way  to do it in NM 7.2?  I see in the
> user guide that EVID=4 can indicate physiological change. Is this what I
> should use?
> 
> 
> 
> Thank you very much for any suggestions. 
> 
> 
> 
> Best regards,
> 
> 
> 
> Siwei
> 
> 
> 
> 
> mail2web.com – Enhanced email for the mobile individual based on Microsoft®
> Exchange - http://link.mail2web.com/Personal/EnhancedEmail
> 
> 


Re: [NMusers] Reducing ETAs actually decreased OFV

2013-08-25 Thread Xinting Wang
Dear Leonid,

I tried with your method and found the same result. The initial estimation
of the added ETA was set at 0.01, and the result showed an increase of OFV.
Please see below the $PK part of the control file for more information.
Many thanks.

Dear Bill,

Could you please explain that in a little bit more detail? I am pasting the
$PK part of the control file in case you could find the useful information.
Thanks a lot.

$PK

FA1=0
FA2=0
FA3=0
FA4=0

IF(DOSE.EQ.250) THEN
FA1=1
ENDIF

IF(DOSE.EQ.500) THEN
FA2=1
ENDIF

IF(DOSE.EQ.850) THEN
FA3=1
ENDIF

IF(DOSE.EQ.1000) THEN
FA4=1
ENDIF

F1=FA1+FA2*THETA(6)+FA3*THETA(7)+FA4*THETA(8)

TVCL=THETA(1)
TVV2=THETA(2)
TVKA=THETA(3)
TVQ=THETA(4)
TVV3=THETA(5)

CL=TVCL*EXP(ETA(1))
V2=TVV2*EXP(ETA(2))
KA=TVKA*EXP(ETA(5))
Q=TVQ*EXP(ETA(3))
V3=TVV3*EXP(ETA(4))


S2=V2/1000
S3=V3/1000


$ERROR

IPRE=F

IRES=DV-IPRE

W=F

IF(W.EQ.0) W = 1

IWRE  = IRES/W

Y=F*(1+EPS(1))+EPS(2)

Best Regards


On 12 August 2013 20:50, Denney, William S. wrote:

> Hi Xinting,
>
> In a few rare cases, I've seen this happen if the model is approaching
> nonconvergence.  In those cases, typically the RSE on one or more
> parameters will increase and the ratio of max to min eigenvalues will
> increase substantially.  Are you seeing either of these?
>
> Thanks,
>
> Bill
>
> On Aug 11, 2013, at 21:56, "Leonid Gibiansky" 
> wrote:
>
> Xinting,
> Try to start from the initial conditions of your "reduced" model but add
> that "reduced" ETA with the corresponding OMEGA equal to 0.01 or other
> small number. If the control stream code is correct, the objective function
> should decrease or retain the same value.
> Leonid
>
> --
> Leonid Gibiansky, Ph.D.
> President, QuantPharm LLC
> web:www.quantpharm.com
> e-mail: LGibiansky at quantpharm.com
> tel:(301) 767 5566
>
>
>
> On 8/10/2013 10:23 PM, Xinting Wang wrote:
> > Dear all,
> >
> > Does anyone witnessed such a phenomenon in NONMEM as when you reduced an
> > ETA, the OFV value, rather than increase, actually decreased? It's quite
> > against intuition, as individual estimation should be better than
> > population estimation in that particular parameter. Both models, whether
> > having this ETA, converged very well.
> >
> > Best
> >
> > --
> > Xinting
>



-- 
Xinting


Re: [NMusers] Reducing ETAs actually decreased OFV

2013-08-25 Thread Denney, William S.
Hi Xinting,

When I've seen this before, it is due to the model approaching non-convergence. 
 Given the model that you're showing below, I'd guess that your issue is coming 
from the eta on Q or V3 because it is rare to have enough data to fit true IIV 
there.

Thanks,

Bill

On Aug 25, 2013, at 8:42, "Xinting Wang" 
mailto:wxinting1...@gmail.com>> wrote:

Dear Leonid,

I tried with your method and found the same result. The initial estimation of 
the added ETA was set at 0.01, and the result showed an increase of OFV. Please 
see below the $PK part of the control file for more information. Many thanks.

Dear Bill,

Could you please explain that in a little bit more detail? I am pasting the $PK 
part of the control file in case you could find the useful information. Thanks 
a lot.

$PK

FA1=0
FA2=0
FA3=0
FA4=0

IF(DOSE.EQ.250) THEN
FA1=1
ENDIF

IF(DOSE.EQ.500) THEN
FA2=1
ENDIF

IF(DOSE.EQ.850) THEN
FA3=1
ENDIF

IF(DOSE.EQ.1000) THEN
FA4=1
ENDIF

F1=FA1+FA2*THETA(6)+FA3*THETA(7)+FA4*THETA(8)

TVCL=THETA(1)
TVV2=THETA(2)
TVKA=THETA(3)
TVQ=THETA(4)
TVV3=THETA(5)

CL=TVCL*EXP(ETA(1))
V2=TVV2*EXP(ETA(2))
KA=TVKA*EXP(ETA(5))
Q=TVQ*EXP(ETA(3))
V3=TVV3*EXP(ETA(4))


S2=V2/1000
S3=V3/1000


$ERROR

IPRE=F

IRES=DV-IPRE

W=F

IF(W.EQ.0) W = 1

IWRE  = IRES/W

Y=F*(1+EPS(1))+EPS(2)

Best Regards


On 12 August 2013 20:50, Denney, William S. 
mailto:william.s.den...@pfizer.com>> wrote:
Hi Xinting,

In a few rare cases, I've seen this happen if the model is approaching 
nonconvergence.  In those cases, typically the RSE on one or more parameters 
will increase and the ratio of max to min eigenvalues will increase 
substantially.  Are you seeing either of these?

Thanks,

Bill

On Aug 11, 2013, at 21:56, "Leonid Gibiansky" 
mailto:lgibian...@quantpharm.com>> wrote:

Xinting,
Try to start from the initial conditions of your "reduced" model but add that 
"reduced" ETA with the corresponding OMEGA equal to 0.01 or other small number. 
If the control stream code is correct, the objective function should decrease 
or retain the same value.
Leonid

--
Leonid Gibiansky, Ph.D.
President, QuantPharm LLC
web:www.quantpharm.com
e-mail: LGibiansky at quantpharm.com
tel:(301) 767 5566



On 8/10/2013 10:23 PM, Xinting Wang wrote:
> Dear all,
>
> Does anyone witnessed such a phenomenon in NONMEM as when you reduced an
> ETA, the OFV value, rather than increase, actually decreased? It's quite
> against intuition, as individual estimation should be better than
> population estimation in that particular parameter. Both models, whether
> having this ETA, converged very well.
>
> Best
>
> --
> Xinting



--
Xinting


Re: [NMusers] Reducing ETAs actually decreased OFV

2013-08-25 Thread Leonid Gibiansky

Hi Xinting,
You should be able to do it. Let's check it again this way
1. You run the model with all ETAs included, but one ETA (the one that 
was excluded in the reduced model) is fixed to zero. You should be able 
to reproduce your "reduced ETA" result (OF)
2. You take the same control stream, and set all initial values to the 
final parameter estimates of model (1) above, except you use the small 
value (may be not 0.01 but 0.01) as the initial value of the ETA 
that was fixed to zero in model (1).


Model (2) is the not-reduced model, and it's OF should be less or equal 
to the OF of model (1). If this is not the case, increase the number of 
significant digits in the initial estimates of model (2) - take those 
from the final estimates of model 1.


Without data, it is very difficult to offer more specific advice.

Also, what is the magnitude of the OF change? What is the estimate of 
the OMEGA for the ETA in question?


Regards,
Leonid




--
Leonid Gibiansky, Ph.D.
President, QuantPharm LLC
web:www.quantpharm.com
e-mail: LGibiansky at quantpharm.com
tel:(301) 767 5566



On 8/25/2013 8:42 AM, Xinting Wang wrote:

Dear Leonid,

I tried with your method and found the same result. The initial
estimation of the added ETA was set at 0.01, and the result showed an
increase of OFV. Please see below the $PK part of the control file for
more information. Many thanks.

Dear Bill,

Could you please explain that in a little bit more detail? I am pasting
the $PK part of the control file in case you could find the useful
information. Thanks a lot.

$PK

FA1=0
FA2=0
FA3=0
FA4=0

IF(DOSE.EQ.250) THEN
FA1=1
ENDIF

IF(DOSE.EQ.500) THEN
FA2=1
ENDIF

IF(DOSE.EQ.850) THEN
FA3=1
ENDIF

IF(DOSE.EQ.1000) THEN
FA4=1
ENDIF

F1=FA1+FA2*THETA(6)+FA3*THETA(7)+FA4*THETA(8)

TVCL=THETA(1)
TVV2=THETA(2)
TVKA=THETA(3)
TVQ=THETA(4)
TVV3=THETA(5)

CL=TVCL*EXP(ETA(1))
V2=TVV2*EXP(ETA(2))
KA=TVKA*EXP(ETA(5))
Q=TVQ*EXP(ETA(3))
V3=TVV3*EXP(ETA(4))


S2=V2/1000
S3=V3/1000


$ERROR

IPRE=F

IRES=DV-IPRE

W=F

IF(W.EQ.0) W = 1

IWRE  = IRES/W

Y=F*(1+EPS(1))+EPS(2)

Best Regards


On 12 August 2013 20:50, Denney, William S. mailto:william.s.den...@pfizer.com>> wrote:

Hi Xinting,

In a few rare cases, I've seen this happen if the model is
approaching nonconvergence.  In those cases, typically the RSE on
one or more parameters will increase and the ratio of max to min
eigenvalues will increase substantially.  Are you seeing either of
these?

Thanks,

Bill

On Aug 11, 2013, at 21:56, "Leonid Gibiansky"
mailto:lgibian...@quantpharm.com>> wrote:

Xinting,
Try to start from the initial conditions of your "reduced" model but
add that "reduced" ETA with the corresponding OMEGA equal to 0.01 or
other small number. If the control stream code is correct, the
objective function should decrease or retain the same value.
Leonid

--
Leonid Gibiansky, Ph.D.
President, QuantPharm LLC
web: www.quantpharm.com 
e-mail: LGibiansky at quantpharm.com 
tel: (301) 767 5566 



On 8/10/2013 10:23 PM, Xinting Wang wrote:
 > Dear all,
 >
 > Does anyone witnessed such a phenomenon in NONMEM as when you
reduced an
 > ETA, the OFV value, rather than increase, actually decreased?
It's quite
 > against intuition, as individual estimation should be better than
 > population estimation in that particular parameter. Both models,
whether
 > having this ETA, converged very well.
 >
 > Best
 >
 > --
 > Xinting




--
Xinting