From: "Bachman, William"
Subject: [NMusers] "Tip of the Week #7 - April 8, 2002" - subsetting your data 'on the fly'
Date: Mon, April 8, 2002 11:48 am
This tip was suggested by an inquiry to nmusers from Klaas Prins:
Quoted reply history
-----Original Message-----
From: Prins, N.H. (Klaas)
Sent: Friday, March 08, 2002 10:21 AM
To: 'nmusers@globomaxnm.com'
Subject: [NMusers] EVID data item and beyond
Dear nm-users,
Currently I am working on a study that consisted of 4 different study parts
in which several dosing schemes were tested, i.e. 3 schemes of multiple
dosing and 1 of continuous infusion. Initially, I created separate data sets
for each study part and inserted intermediate time points to get smooth
curves when plotting observed and predicted versus time. Using either the
MDV (0=observation, 1=missing) or EVID (0=observation, 1=dosing,
2=other/simulation) data item, I managed to get decent fits for each study
part. Also combining data from different study parts resulted in succesful
NM runs.
However, I did not feel satisfied with making more than one dataset and a
couple of control streams. Therefore, I set out to put together a single
dataset containing data of all study parts. Then, the aim was to flag out
the study parts that did not need to be evaluated in specific run, by
setting EVID to 2 (other event). In this manner, I created 6 different
evaluation schemes and listed them in data items EV1 to EV6. For instance,
scheme EV4 was created to evaluate study parts 1 and 4 only, then all
records for those parts were set to 0, 1 and 2 (see above) and all other
records were set to 2 (flagged as 'other').
The $INPUT control stream read the following:
$INPUT ID TIME AMT RATE DV SEX WT PART EV1=DROP EV2=DROP EV3=DROP EV4=EVID
EV5=DROP EV6=DROP
So, by toggling on and off the EVx=EVID/DROP, I hoped to get my desired
evaluation.
It did not work since the nm-tran reported for the data records of study
parts that were flagged out:
THE DV DATA ITEM IS POSITIVE, BUT THE MDV DATA ITEM IS 1
I did not specify a MDV data item, so this must refer to a 'generated MDV'.
I do understand this, since for these parts, the observations are read and
NM is suprised that it is asked to consider this as a simulation record.
Now, after this exhausting problem description, could somebody comment on
this issue and provide hints on how to surpass this? Any suggestion is much
appreciated.
Thanks in advance and have a nice weekend,
Klaas Prins
-----END of Original Message-----
Actually, Klaas was very close to the solution of his problem. The issue
Klaas encountered was that not only do you need to "pre-specify" the EVID
for NONMEM, you also need to pre-specify the MDV and ANY DOSING-RELATED data
items such as AMT and RATE because this scheme relies on:
1. pre-defining to NM-TRAN those records which you choose not to analyze as
MDV=1 (missing) and that DV is not expected to be positive for MDV=1
2. other data item records (EVID=2) may not specify dosing information.
To circumenvent these limitations one must apriori create columns in your
data representing all the combinations of data you wish to subset for
analysis by specifying the EVID, MDV, AMT (and RATE if needed).
I have created an example data file, test.csv, in which I make four subsets
of the full data set:
subset 0: all of the data, specified by data columns EV0, MV0, AM0
subset 1: subjects 1-4, specified by data columns EV1, MV1, AM1
subset 2: subjects 5-8, specified by data columns EV2, MV2, AM2
subset 3: subjects 9-12, specified by data columns EV3, MV3, AM3
subset 4: subjects 1-4 & 9-12, specified by data columns EV4, MV4, AM4
(This will, of course, increase the number of columns in your original
datafile, but NOT in the number of columns in the datafile used by NONMEM,
FDATA, becuause the columns not used in a given run will be excluded using
"DROP=" and because NM-TRAN will ordinarily add columns for EVID, MDV and
AMT anyway.)
The datafile for one subject looks like:
C,Data Desc: Theophylline PK Study,,,,,,,,,,,,,,,,,,
C,ID,TIME,DV,WT,AM0,AM1,AM2,AM3,AM4,EV0,EV1,EV2,EV3,EV4,MV0,MV1,MV2,MV3,MV4
,1,0,.,79.6,4.02,4.02,0,0,4.02,1,1,2,2,1,1,1,1,1,1
,1,0,0.74,.,.,.,.,.,.,0,0,2,2,0,0,0,1,1,0
,1,0.25,2.84,.,.,.,.,.,.,0,0,2,2,0,0,0,1,1,0
,1,0.57,6.57,.,.,.,.,.,.,0,0,2,2,0,0,0,1,1,0
,1,1.12,10.5,.,.,.,.,.,.,0,0,2,2,0,0,0,1,1,0
,1,2.02,9.66,.,.,.,.,.,.,0,0,2,2,0,0,0,1,1,0
,1,3.82,8.58,.,.,.,.,.,.,0,0,2,2,0,0,0,1,1,0
,1,5.1,8.36,.,.,.,.,.,.,0,0,2,2,0,0,0,1,1,0
,1,7.03,7.47,.,.,.,.,.,.,0,0,2,2,0,0,0,1,1,0
,1,9.05,6.89,.,.,.,.,.,.,0,0,2,2,0,0,0,1,1,0
,1,12.12,5.94,.,.,.,.,.,.,0,0,2,2,0,0,0,1,1,0
,1,24.37,3.28,.,.,.,.,.,.,0,0,2,2,0,0,0,1,1,0
To analyze all to the data, specify EVID=EV0, MDV=MV0, AMT=AM0 in $DATA of
your control stream (and DROP= is specified for the remaining columns),
e.g.:
;Model Desc: NONMEM & PDx-Pop compliant control stream
;Project Name: TIPS
;Project ID: NO PROJECT DESCRIPTION
$PROB RUN# 011 DATA
$INPUT C ID TIME DV WT
AMT=AM0 DROP=AM1 DROP=AM2 DROP=AM3 DROP=AM4
EVID=EV0 DROP=EV1 DROP=EV2 DROP=EV3 DROP=EV4
MDV=MV0 DROP=MV1 DROP=MV2 DROP=MV3 DROP=MV4
$DATA test.CSV IGNORE=C
$SUBROUTINES ADVAN2
$PK
KA=THETA(1)*EXP(ETA(1))
K =THETA(2)*EXP(ETA(2))
CL=THETA(3)*EXP(ETA(3))
SC=CL/K
$THETA
(0,3)
(0,.08)
(0,.04)
$OMEGA
0.1 ;[p]
0.1 ;[p]
0.1 ;[p]
$ERROR
Y=F+EPS(1)
$SIGMA
.1 ;[A]
$EST MAXEVAL=450 PRINT=5 MSF=011.MSF
$COV
$TABLE ID AMT TIME WT EVID MDV FILE=011.TAB ONEHEADER NOPRINT
To analyze subset 1 of the data, specify EVID=EV1, MDV=MV1, AMT=AM1 in $DATA
of your control stream (and DROP= is specified for the remaining columns),
e.g.:
$INPUT C ID TIME DV WT
DROP=AM0 AMT=AM1 DROP=AM2 DROP=AM3 DROP=AM4
DROP=EV0 EVID=EV1 DROP=EV2 DROP=EV3 DROP=EV4
DROP=MV0 MDV=MV1 DROP=MV2 DROP=MV3 DROP=MV4
The control stream, tip7.ctl, and the complete datafile, test.csv, for this
example may be found in the NONMEM Repository @ GloboMax:
ftp://ftp.globomaxnm.com/Public/nonmem/tips/
[Generic Disclaimer: Verify that this code or any other code you receive
from an outside
source works with YOUR DATA.]
*****************************************************************
If you have a "tip" or a better way to do things, by all means, feel free to
post them! One of the reasons for doing this (other than good PR for
GloboMax), is to stimulate discussion. We at GloboMax can learn from your
experience as well.
Do you have a "tip" you would like to share, but would prefer to remain
anonymous? If so, you may forward it to us and your identity will be
withheld. Distribution as a "Tip of the Week" will be at the discretion of
nmconsult@globomaxnm.com.
*****************************************************************
nmconsult@globomaxnm.com
GloboMax LLC
7250 Parkway Drive, Suite 430
Hanover, MD 21076
Voice: (410) 782-2205
FAX: (410) 712-0737