From: "LIANG ZHAO" zhao.80@osu.edu 
Subject: [NMusers] Any way to change the maximum input data item no.? 
Date: 23-Mar-2005 12:49

Hello,all,

Is there any way to change the maximum input data item no. when it exceeds 20? Thank you.

Liang 
_______________________________________________________

From: mark.e.sale@GSK.com 
Subject: Re: [NMusers] Any way to change the maximum input data item no.? 
Date: Date: Thu, 11 Aug 2005

Two solutions, you can use continuation lines, as described in the guide:
 -------------------------------------------------------------------
|                                                                 |
|                            CONT DATA ITEM                       |
|                                                                 |
------------------------------------------------------------------

MEANING: Continuation (CONT) data item for PREDPP
CONTEXT: $INPUT record and NONMEM data set

USAGE:
$INPUT ... CONT ...

DISCUSSION:
CONT labels PREDPP's continuation (CONT) data item.  The  continuation
data  item  is  optional.   The  CONT  data item allows a PREDPP event
record to span several data records.  It is useful when more  than  20
data  items are needed to describe a single event.  When the CONT data
item is not defined on the $INPUT record, every event record  consists
of a single data record.

Values are:

0    This is the last or only data record of the event record.

1    This and the succeeding record are both members of the same event
     record.  MDV must be 1.

PREDPP ignores records having CONT=1, except to pass them  to  the  PK
and  ERROR  routines  as part of the complete event record.  Values of
PREDPP data items such as EVID, AMT, etc., are significant only on the
final record of each event record, i.e., on records having CONT=0.

With NM-TRAN abbreviated code, values on data  records  having  CONT=1
are  not available for use as right-hand quantities, i.e., abbreviated
code cannot reference the values in data records other than  the  last
of  each event record.  (It would be possible to reference such values
using verbatim code, however).  When NM-TRAN performs time translation
or  ii  conversion (see date, time, ii), it does so only for the event
records having CONT=0.

REFERENCES: Guide VI, section II (p. 5), V.A (p. 55), V.I (p. 62)
REFERENCES: Guide IV, section V.B (p. 61), V.C.5 (p. 70)

Or, you can write additional data to a seperate file and read it in from verbatum code in $PK. 
If you want to read it in from a separate file, let me know I'll send the code.
GO BUCKS (BS OSU, 1981, MD OSU, 1985)

Mark Sale M.D.
Global Director, Research Modeling and Simulation
GlaxoSmithKline
919-483-1808
Mobile
919-522-6668 
_______________________________________________________

From: Sam Liao sliao@pharmaxresearch.com
Subject: Re: [NMusers] Any way to change the maximum input data item no.? 
Date: Thu, 11 Aug 2005 10:30:38 -0400

Dear Mark:
Do you mind sharing the verbatum code in $PK to read a separate file?
What platform this code is working?  UNIX or PC?

Best regards,
Sam Liao
Pharmax Research 

_______________________________________________________

From: 
Subject: 
Date: 

Sam,
  No problem,  It is all fortran, and I know it works with G77, Digital 
and Intel fortran for windows.  Never tried it on Unix, but should work.

The original control file came from Anthe Zandvliet.

Notes
  This version only reads a covariate set for each new ID - the assumption 
is that the covariates are constant (such as post hoc etas, age gender) 
This can be adapted for changing covariates within a subject, but it gets 
more complicated.

First, the required subroutines - called get_subs.for
Please excuse (again), my use of informative comments, which in generally 
is not encouraged in NONMEM code

********Beginning of GET_SUBS.FOR*****************************************


       SUBROUTINE READER()
c     READ ALL THE POST-HOC PARAMETERS/COVARIATE DATA INTO TWO ARRAYS 
STORED IN COMMON READ
C      TID - ID#S FOR SUBJECT - MUST MATCH THOSE IN MAIN DATA SET
C      TCOV - COVARIATES, MUST MANUALLY ENTER NUMBER OF SUBJECTS (24 HERE)
C      AND NUMBER OF COVARIATES (3)
       COMMON /READ/ TID,TCOV
       REAL TID(24),TCOV(24,3) 
C     MANUALLY EDIT FILE NAME
       OPEN(UNIT = 77,FILE = 'extra_pk.prn')
       REWIND 77
C      MANUALLY EDIT NUMBER OF SUBJECTS (24) - NOTE THE POOR PROGRAMMING 
STYLE
       DO 11,I = 1,24
C      MANUALLY EDIT THE NUMBER OF COVARIATES - ONE TCOV(I,#) FOR EACH - 3 
HERE 
       READ(77,*) TID(I),TCOV(I,1), TCOV(I,2), TCOV(I,3)
   11  CONTINUE
       END

       SUBROUTINE GET_SUB(NEWIND,ID,CURID,COV1,COV2,COV3,MID)
C       GET ONE SUBJECT - HAD A PROBLEM WITH NOT GETTING ID RIGHT ONCE
C      WILL BE (A LITTLE) MORE EFFICIENT IF YOU LEAVE THE 
IF(NEWIND.EQ.1)..ELSEIF..END IF IN
       COMMON /READ/ TID,TCOV
C     MANUALLY EDIT NUMBER OF COVARIATES COV1..COVN
       REAL ID,CURID,COV1,COV2,COV3,MID
       INTEGER NEWIND
C     MANUALLY EDIT NUMBER OF SUBJECTS( 24 HERE) AND NUMBER OF COVARIATES 
(3 HERE)
       REAL TID(24),TCOV(24,3)
       CURID = 1
C       IF (NEWIND.EQ.1) THEN 
   12  CONTINUE
       IF(ID.GT.TID(CURID)) THEN 
       CURID =CURID + 1
       GOTO 12
       END IF
C       ELSEIF(NEWIND.EQ.0) THEN
C       CURID = 1 
C       END IF 
C OUTPUT COVARIATES IN COMMON ARRAY TO SUBROUTINE ARGUMENTS
       COV1 = TCOV(CURID,1)
       COV2 = TCOV(CURID,2)
       COV3 = TCOV(CURID,3)
C     AND ID - TO BE CHECKED IN $PK 
       MID = TID(CURID)
       END


************End of GET_SUBS.FOR*****************************************

Here is what the control file looks like: - again from Anthe
note the other subroutine in the $SUBROUTINES record (OTHER=GET_SUBS.FOR)


********Beginning of control file 
*****************************************

$PROB parameter inputs

$INPUT ID TIME TAD AMT RATE DV EVID BSA MDV 
       CYCL CMT FLAG BASE V1 TMAX TM K21 K13 K31

$DATA data.prn
$SUBROUTINES ADVAN6 TOL=5 OTHER=GET_SUBS.FOR
$MODEL COMP=(CENTRAL) 
       COMP=(PERIPH)
       COMP=(PERIPH2)
       COMP=(AUC) 
       COMP=(PROL)
       COMP=(TRANS1) 
       COMP=(TRANS2) 
       COMP=(TRANS3) 
       COMP=(CIRC) 

$PK
" FIRST
" COMMON/PRCOMG/IDUM1,IDUM2,IMAX,IDUM4,IDUM5
" INTEGER IDUM1,IDUM2,IMAX,IDUM4,IDUM5
" REAL CURID,ICOV1,ICOV2,ICOV3,MID
" LOGICAL READ
" IF(.NOT.READ)THEN
" CALL READER()
" CURID=1
" READ=.TRUE.
" ENDIF
" IMAX=10000000
" CALL GET_SUB(NEWIND,ID,CURID,ICOV1,ICOV2,ICOV3,MID) 

CID=MID
IF(CID.NE.ID)THEN
" PRINT*, 'ERROR CHECKING FAILED,CID=',CID,'ID= ',ID
ENDIF

VM=ICOV1
KM=ICOV2
K1=ICOV3

  S1=V1 

  MTT=THETA(1)*EXP(ETA(1)) 
  SLOPE=THETA(2)*EXP(ETA(2))
  GAMMA=THETA(3)

  R5=BASE*4/MTT

  V5=1
  V6=1
  V7=1
  V8=1
  V9=1

  EFFX10=EFF*10
  IF(EFFX10.GT.10.AND.EFFX10.LT.50) THEN
    FEEDB=EFF
  ELSE
    FEEDB=1
  ENDIF

$DES

  C1=A(1)/S1

 DADT(1)=-C1*TMAX/(TM+C1)+K21*A(2)-C1*VM/(KM+C1)-K13*A(1)+K31*A(3)-K1*A(1)
  DADT(2)=C1*TMAX/(TM+C1)-K21*A(2) 
  DADT(3)=K13*A(1)-K31*A(3)
  DADT(4)=A(1)/S1
 
  A9=A(9)

  IF(A(9).LT.0) THEN 
    C9=0.001
  ELSE
    C9=A(9)
  ENDIF
 
  EFF=(BASE/C9)**GAMMA

  KTR=4/MTT
  DADT(5)=-BASE*KTR*(1-FEEDB)-SLOPE*C1*A(5)-KTR*A(5) 
  DADT(6)=KTR*A(5)-KTR*A(6)
  DADT(7)=KTR*A(6)-KTR*A(7)
  DADT(8)=KTR*A(7)-KTR*A(8)
  DADT(9)=KTR*A(8)-KTR*A(9)



$ERROR


PROP=0
IF(FLAG.EQ.0) PROP=THETA(4)*EPS(1) 
IF(FLAG.EQ.1) PROP=THETA(5)*EPS(2)

IF(DV.EQ.0) THEN
   IPRED=-3
ELSE
   IPRED=LOG(F)
ENDIF

Y=IPRED+PROP

AUC=A(4)

OBS=EXP(DV)
IPRD=EXP(IPRED)


$THETA
  (160)                 ;1 MTT 
  (0.02)                ;2 SLOPE
  (0.17)                ;3 GAMMA
  (0.224)               ;4 PROP PK
  (0.2)                 ;5 PROP PD

$OMEGA
  (0.2)                 ;1 MTT
  (0.2)                 ;2 SLOPE

$SIGMA
  1 FIX 
  1 FIX

;$SIMULATION (782849) ONLYSIM
$ESTIMATION MAXEVAL=9999 NOABORT METHOD=0 POSTHOC PRINT=5 MSFO=MSF062

$TABLE ID TIME OBS IPRD
 NOPRINT ONEHEADER FILE=SDTAB062
$TABLE ID CYCL TIME TAD BASE OBS IPRD CMT
 NOPRINT ONEHEADER FILE=PATAB062
$TABLE ID TIME VM KM K1
 NOPRINT ONEHEADER FILE=062.TAB NOAPPEND

********End of Control file *****************************************

and the file with the covariates looks like this:


********Beginning of extra_pk.prn 
*****************************************
       1   4.1543    0.655   0.028763
       2   3.3872    0.655   0.013762
       3   3.4003    0.655   0.017642
       4   4.1453    0.655   0.025413
       5   4.3594    0.655   0.069201
       6   4.2084    0.655   0.059667
       7   4.1103    0.655   0.030597
       8   4.2867    0.655   0.024943
       9   5.0094    0.655   0.025269
      10   5.0587    0.655  0.0027627
      11   3.9004    0.655   0.024167
      12   3.2185    0.655    0.01934
      13   4.2663    0.655   0.020534
      14   8.4225    0.655   0.019306
      15   3.2326    0.655   0.036098
      16   2.5746    0.655   0.017847
      17   3.7562    0.655   0.021424
      18    3.078    0.655   0.017124
      19   4.5008    0.655   0.028322
      20   2.7431    0.655   0.018758
      21   3.0547    0.655   0.017375
      22   5.3407    0.655   0.071841
      23   3.7328    0.655    0.02789
      24   4.8513    0.655  0.0242981


********End of extra_pk.prn *****************************************


Mark Sale M.D.
Global Director, Research Modeling and Simulation
GlaxoSmithKline
919-483-1808
Mobile 
919-522-6668

_______________________________________________________

From: Sam Liao sliao@pharmaxresearch.com
Subject: Re: [NMusers] Any way to change the maximum input data item no.?
Date: Thu, 11 Aug 2005 11:52:00 -0400

Dear Mark:
Thanks a lot for your quick response.  It can be very useful program for me.

The complication is that I need to read additional items for every observation records.

Best regards,
Sam 
_______________________________________________________

From: mark.e.sale@gsk.com
Subject: Re: [NMusers] Any way to change the maximum input data item no.?
Date: Thu, 11 Aug 2005 12:03:41 -0400

Can be done in the same way.  Try setting up the data file and the "extra 
data" file with a unique number for every observation or event, rather 
than every subject, them use that number for search the array, rather than 
the ID. You'll have to call PK with every observation or event (using 
CALLFL = -2 or -1), then call get_sub with every call to PK (as it is 
now).  I don't know if NMTRAN/NONMEM would set CALLFL correctly, that is 
if it would look inside the verbatim code to see if PK must be called with 
every event, so I'd probably just go ahead and force a call to PK with 
every observation or event.  I can't claim to understand the logic that 
NONMEM uses to decide when to call PK.

Mark Sale M.D.
Global Director, Research Modeling and Simulation
GlaxoSmithKline
919-483-1808
Mobile 
919-522-6668
_______________________________________________________