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

 <http://www.farmbio.uu.se/research/researchgroups/pharmacometrics/>
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

1    0     1      110  115   5

1    1     2      115  112   3

1    2     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

Reply via email to