RE: [NMusers] ERROR NUMBER OF BASIC PK PARAMETERS EXCEEDS VALUE OF NPARAM IN $MODEL

2019-07-31 Thread Paul Hutson
Thank you, Alison!

Paul Hutson, PharmD, BCOP
Professor
UWisc School of Pharmacy
T: 608.263.2496
F: 608.265.5421


-Original Message-
From: Alison Boeckmann  
Sent: Wednesday, July 31, 2019 1:04 PM
To: Paul Hutson ; Leonid Gibiansky 
; 'nmusers' ; ajbf 

Subject: Re: [NMusers] ERROR NUMBER OF BASIC PK PARAMETERS EXCEEDS VALUE OF 
NPARAM IN $MODEL

(1) I agree with Leonid: don't code NPARAM.
NPARAM is required when the user writes a Fortran DES routine, e.g., $SUBR 
DES=mydes When $DES abbreviated code is present, NMTRAN will count the basic PK 
parameters and set NPARAM in the generated MODEL routine.
For example, if you omit NPARAM from the $MODEL record, the generated MODEL 
routine sets 
  NPAR=007
This is reported in the PREDPP portion of the NONMEM output:
MAXIMUM NO. OF BASIC PK PARAMETERS:   7

If both $DES and NPARAM are present, NPARAM must be at least as large as the 
number counted by NMTRAN, but may not be smaller.
(NMTRAN uses the larger value in the MODEL routine.)

(2) You ask:
"It appears that NONMEM wants additional parameters added to NPARAM when I 
added calculated value CC in the $DES block. "

The code in $PK is
MIC=0.12 ; SEEKING TIME AND AUC ABOVE 0.12 MCG/ML The code in $DES is
CC=A(1)/V1
IF(CC.GT.MIC) RT=1

It is MIC that looks to NMTRAN like a basic PK parameter.
You can see the following code in subroutine PK in FSUBS:
 P02=MIC 
 GG(0002,1,1)=P02

(3) You ask:
"What is also odd to me is that the fault is called on the line defining 
DADT(2)."

I'll pass on this one. Sometimes NMTRAN may report an error on a line near 
where the error is detected, not the exact line. It may be easy to fix for this 
example and yet the fix may break some other control stream.

-- Alison 

On Wed, Jul 31, 2019, at 5:56 AM, Paul Hutson wrote:
> Hello, Leonid, and thank you for the correction on the IWRES and the 
> suggestion on the IRES.
> Regarding NPARAM, you are correct, the model runs if the NPARM count is 
> removed from the $MODEL statement.   It was curious to me that if it 
> was included that it was counting the calculated value CC in the $DES 
> block as a parameter.
> Take care.
> Paul
> 
> Paul Hutson, PharmD, BCOP
> Professor
> UWisc School of Pharmacy
> T: 608.263.2496
> F: 608.265.5421
> 
> -Original Message-
> From: Leonid Gibiansky 
> Sent: Tuesday, July 30, 2019 11:53 PM
> To: Paul Hutson ; 'nmusers' 
> 
> Subject: Re: [NMusers] ERROR NUMBER OF BASIC PK PARAMETERS EXCEEDS 
> VALUE OF NPARAM IN $MODEL
> 
> Not sure why would we need NPARAM there, is it necessary? I think one 
> can skip it.
> 
> On the different topic, expression for IWRES is not correct:
> 
> IWRES=IRES/(IPRED * EPS(1) + EPS(2))
> 
> This is the version that should be used:
> 
> IWRES=IRES/SQRT(IPRED**2 * SIGMA(1,1) + SIGMA(2,2))
> 
> Also it is more traditional to define IRES=DV-IPRED (negative residual 
> corresponds to over-predictions; observed=predicted + residual error).
> 
> Regards
> Leonid
> 
> 
> On 7/29/2019 2:49 PM, Paul Hutson wrote:
> > I've fixed it by increasing NPARAM until it worked (increasing to 
> > 7), but can anyone explain why I get this message for a 3 
> > compartment model with additional compartments to output a time 
> > above a concentration threshold (#4) and AUC while above that concentration 
> > threshold (#5)?
> > It appears that NONMEM wants additional parameters added to NPARAM 
> > when I added calculated value CC in the $DES block.  What is also 
> > odd to me is that the fault is called on the line defining DADT(2). 
> > Thanks in advance. Paul
> > 
> > $SUBROUTINES ADVAN6 TOL=3
> > 
> > $MODEL NCOMP=5 NPARAM=6
> > 
> > COMP=(CENTRAL DEFDOSE DEFOBS)
> > 
> > COMP=(TISU1)
> > 
> > COMP=(TISU2)
> > 
> > COMP=(TTIME)
> > 
> > COMP=(AUCC)
> > 
> > ;--PK BLOCK
> > 
> > $PK
> > 
> > MIC=0.12 ; SEEKING TIME AND AUC ABOVE 0.12 MCG/ML
> > 
> > TVCL = POP_CL
> > 
> > TVV1=POP_V1
> > 
> > TVQ2=POP_Q2
> > 
> > TVV2=POP_V2
> > 
> > TVQ3=POP_Q3
> > 
> > TVV3=POP_V3
> > 
> > CL=TVCL * EXP(ETA(1))
> > 
> > V1=TVV1 * EXP(ETA(2))
> > 
> > Q2=TVQ2 * EXP(ETA(3))
> > 
> > V2=TVV2 * EXP(ETA(4))
> > 
> > Q3=TVQ3 * EXP(ETA(5))
> > 
> > V3=TVV3 * EXP(ETA(6))
> > 
> > K10=CL/V1
> > 
> > K12=Q2/V1
> > 
> > K21=Q2/V2
> > 
> > K13=Q3/V1
> > 
> > K31=Q3/V3
> > 
> > ;DES BLOCK
> > 
> > $DES
> > 
> > CC=A(1)/V1
> > 
> > RT=0
> > 
> > IF(CC.GT.MIC) RT=1
> > 
> > DADT(1) = - A(1) * (K10 + K12 + K13) + A(2) * K21  + A(3)*K31
> > 
> > DADT(2) = A(1) * K12 - A(2) * K21
> > 
> > DADT(3) = A(1) * K13 - A(3) * K31
> > 
> > DADT(4)=RT ; TIME ABOVE THRESHOLD TAT
> > 
> > DADT(5)=RT*CC ; AUC ABOVE THRESHOLD AUCAT
> > 
> > ;- ERROR MODEL --
> > 
> > $ERROR
> > 
> > IPRED = F
> > 
> >     IRES=IPRED-DV
> > 
> >     Y=IPRED * (1 + EPS(1)) + EPS(2)
> > 
> >     IWRES=IRES/(IPRED * EPS(1) + EPS(2))
> > 
> > TAT=A(4)
> > 
> > AUCAT=A(5)
> > 
> > TIS2 = A(2)/V2
> > 
> > TIS3 = A(3)/V3
> > 
> > Paul Hutson, 

Re: [NMusers] ERROR NUMBER OF BASIC PK PARAMETERS EXCEEDS VALUE OF NPARAM IN $MODEL

2019-07-31 Thread Alison Boeckmann
(1) I agree with Leonid: don't code NPARAM.
NPARAM is required when the user writes a Fortran DES routine, e.g., 
$SUBR DES=mydes
When $DES abbreviated code is present, NMTRAN will count the
basic PK parameters and set NPARAM in the generated MODEL routine.
For example, if you omit NPARAM from the $MODEL record, 
the generated MODEL routine sets 
  NPAR=007
This is reported in the PREDPP portion of the NONMEM output:
MAXIMUM NO. OF BASIC PK PARAMETERS:   7

If both $DES and NPARAM are present, NPARAM must be at least 
as large as the number counted by NMTRAN, but may not be smaller.
(NMTRAN uses the larger value in the MODEL routine.)

(2) You ask:
"It appears that NONMEM wants additional parameters added to NPARAM
when I added calculated value CC in the $DES block. "

The code in $PK is
MIC=0.12 ; SEEKING TIME AND AUC ABOVE 0.12 MCG/ML
The code in $DES is
CC=A(1)/V1
IF(CC.GT.MIC) RT=1

It is MIC that looks to NMTRAN like a basic PK parameter.
You can see the following code in subroutine PK in FSUBS:
 P02=MIC 
 GG(0002,1,1)=P02

(3) You ask:
"What is also odd to me is that the fault is called on the line
defining DADT(2)."

I'll pass on this one. Sometimes NMTRAN may report an error on a
line near where the error is detected, not the exact line. It may
be easy to fix for this example and yet the fix may break some other
control stream.

-- Alison 

On Wed, Jul 31, 2019, at 5:56 AM, Paul Hutson wrote:
> Hello, Leonid, and thank you for the correction on the IWRES and the 
> suggestion on the IRES.
> Regarding NPARAM, you are correct, the model runs if the NPARM count is 
> removed from the $MODEL statement.   It was curious to me that if it 
> was included that it was counting the calculated value CC in the $DES 
> block as a parameter.
> Take care.
> Paul
> 
> Paul Hutson, PharmD, BCOP
> Professor
> UWisc School of Pharmacy
> T: 608.263.2496
> F: 608.265.5421
> 
> -Original Message-
> From: Leonid Gibiansky  
> Sent: Tuesday, July 30, 2019 11:53 PM
> To: Paul Hutson ; 'nmusers' 
> 
> Subject: Re: [NMusers] ERROR NUMBER OF BASIC PK PARAMETERS EXCEEDS 
> VALUE OF NPARAM IN $MODEL
> 
> Not sure why would we need NPARAM there, is it necessary? I think one 
> can skip it.
> 
> On the different topic, expression for IWRES is not correct:
> 
> IWRES=IRES/(IPRED * EPS(1) + EPS(2))
> 
> This is the version that should be used:
> 
> IWRES=IRES/SQRT(IPRED**2 * SIGMA(1,1) + SIGMA(2,2))
> 
> Also it is more traditional to define IRES=DV-IPRED (negative residual 
> corresponds to over-predictions; observed=predicted + residual error).
> 
> Regards
> Leonid
> 
> 
> On 7/29/2019 2:49 PM, Paul Hutson wrote:
> > I've fixed it by increasing NPARAM until it worked (increasing to 7), 
> > but can anyone explain why I get this message for a 3 compartment 
> > model with additional compartments to output a time above a 
> > concentration threshold (#4) and AUC while above that concentration 
> > threshold (#5)?
> > It appears that NONMEM wants additional parameters added to NPARAM 
> > when I added calculated value CC in the $DES block.  What is also odd 
> > to me is that the fault is called on the line defining DADT(2). Thanks 
> > in advance. Paul
> > 
> > $SUBROUTINES ADVAN6 TOL=3
> > 
> > $MODEL NCOMP=5 NPARAM=6
> > 
> > COMP=(CENTRAL DEFDOSE DEFOBS)
> > 
> > COMP=(TISU1)
> > 
> > COMP=(TISU2)
> > 
> > COMP=(TTIME)
> > 
> > COMP=(AUCC)
> > 
> > ;--PK BLOCK
> > 
> > $PK
> > 
> > MIC=0.12 ; SEEKING TIME AND AUC ABOVE 0.12 MCG/ML
> > 
> > TVCL = POP_CL
> > 
> > TVV1=POP_V1
> > 
> > TVQ2=POP_Q2
> > 
> > TVV2=POP_V2
> > 
> > TVQ3=POP_Q3
> > 
> > TVV3=POP_V3
> > 
> > CL=TVCL * EXP(ETA(1))
> > 
> > V1=TVV1 * EXP(ETA(2))
> > 
> > Q2=TVQ2 * EXP(ETA(3))
> > 
> > V2=TVV2 * EXP(ETA(4))
> > 
> > Q3=TVQ3 * EXP(ETA(5))
> > 
> > V3=TVV3 * EXP(ETA(6))
> > 
> > K10=CL/V1
> > 
> > K12=Q2/V1
> > 
> > K21=Q2/V2
> > 
> > K13=Q3/V1
> > 
> > K31=Q3/V3
> > 
> > ;DES BLOCK
> > 
> > $DES
> > 
> > CC=A(1)/V1
> > 
> > RT=0
> > 
> > IF(CC.GT.MIC) RT=1
> > 
> > DADT(1) = - A(1) * (K10 + K12 + K13) + A(2) * K21  + A(3)*K31
> > 
> > DADT(2) = A(1) * K12 - A(2) * K21
> > 
> > DADT(3) = A(1) * K13 - A(3) * K31
> > 
> > DADT(4)=RT ; TIME ABOVE THRESHOLD TAT
> > 
> > DADT(5)=RT*CC ; AUC ABOVE THRESHOLD AUCAT
> > 
> > ;- ERROR MODEL --
> > 
> > $ERROR
> > 
> > IPRED = F
> > 
> >     IRES=IPRED-DV
> > 
> >     Y=IPRED * (1 + EPS(1)) + EPS(2)
> > 
> >     IWRES=IRES/(IPRED * EPS(1) + EPS(2))
> > 
> > TAT=A(4)
> > 
> > AUCAT=A(5)
> > 
> > TIS2 = A(2)/V2
> > 
> > TIS3 = A(3)/V3
> > 
> > Paul Hutson, PharmD, BCOP
> > 
> > Professor
> > 
> > UWisc School of Pharmacy
> > 
> > T: 608.263.2496
> > 
> > F: 608.265.5421
> > 
> 
>

-- 
  Alison Boeckmann
  alisonboeckm...@fastmail.fm



RE: [NMusers] ERROR NUMBER OF BASIC PK PARAMETERS EXCEEDS VALUE OF NPARAM IN $MODEL

2019-07-31 Thread Paul Hutson
Hello, Leonid, and thank you for the correction on the IWRES and the suggestion 
on the IRES.
Regarding NPARAM, you are correct, the model runs if the NPARM count is removed 
from the $MODEL statement.   It was curious to me that if it was included that 
it was counting the calculated value CC in the $DES block as a parameter.
Take care.
Paul

Paul Hutson, PharmD, BCOP
Professor
UWisc School of Pharmacy
T: 608.263.2496
F: 608.265.5421

-Original Message-
From: Leonid Gibiansky  
Sent: Tuesday, July 30, 2019 11:53 PM
To: Paul Hutson ; 'nmusers' 
Subject: Re: [NMusers] ERROR NUMBER OF BASIC PK PARAMETERS EXCEEDS VALUE OF 
NPARAM IN $MODEL

Not sure why would we need NPARAM there, is it necessary? I think one can skip 
it.

On the different topic, expression for IWRES is not correct:

IWRES=IRES/(IPRED * EPS(1) + EPS(2))

This is the version that should be used:

IWRES=IRES/SQRT(IPRED**2 * SIGMA(1,1) + SIGMA(2,2))

Also it is more traditional to define IRES=DV-IPRED (negative residual 
corresponds to over-predictions; observed=predicted + residual error).

Regards
Leonid


On 7/29/2019 2:49 PM, Paul Hutson wrote:
> I've fixed it by increasing NPARAM until it worked (increasing to 7), 
> but can anyone explain why I get this message for a 3 compartment 
> model with additional compartments to output a time above a 
> concentration threshold (#4) and AUC while above that concentration threshold 
> (#5)?
> It appears that NONMEM wants additional parameters added to NPARAM 
> when I added calculated value CC in the $DES block.  What is also odd 
> to me is that the fault is called on the line defining DADT(2). Thanks 
> in advance. Paul
> 
> $SUBROUTINES ADVAN6 TOL=3
> 
> $MODEL NCOMP=5 NPARAM=6
> 
> COMP=(CENTRAL DEFDOSE DEFOBS)
> 
> COMP=(TISU1)
> 
> COMP=(TISU2)
> 
> COMP=(TTIME)
> 
> COMP=(AUCC)
> 
> ;--PK BLOCK
> 
> $PK
> 
> MIC=0.12 ; SEEKING TIME AND AUC ABOVE 0.12 MCG/ML
> 
> TVCL = POP_CL
> 
> TVV1=POP_V1
> 
> TVQ2=POP_Q2
> 
> TVV2=POP_V2
> 
> TVQ3=POP_Q3
> 
> TVV3=POP_V3
> 
> CL=TVCL * EXP(ETA(1))
> 
> V1=TVV1 * EXP(ETA(2))
> 
> Q2=TVQ2 * EXP(ETA(3))
> 
> V2=TVV2 * EXP(ETA(4))
> 
> Q3=TVQ3 * EXP(ETA(5))
> 
> V3=TVV3 * EXP(ETA(6))
> 
> K10=CL/V1
> 
> K12=Q2/V1
> 
> K21=Q2/V2
> 
> K13=Q3/V1
> 
> K31=Q3/V3
> 
> ;DES BLOCK
> 
> $DES
> 
> CC=A(1)/V1
> 
> RT=0
> 
> IF(CC.GT.MIC) RT=1
> 
> DADT(1) = - A(1) * (K10 + K12 + K13) + A(2) * K21  + A(3)*K31
> 
> DADT(2) = A(1) * K12 - A(2) * K21
> 
> DADT(3) = A(1) * K13 - A(3) * K31
> 
> DADT(4)=RT ; TIME ABOVE THRESHOLD TAT
> 
> DADT(5)=RT*CC ; AUC ABOVE THRESHOLD AUCAT
> 
> ;- ERROR MODEL --
> 
> $ERROR
> 
> IPRED = F
> 
>     IRES=IPRED-DV
> 
>     Y=IPRED * (1 + EPS(1)) + EPS(2)
> 
>     IWRES=IRES/(IPRED * EPS(1) + EPS(2))
> 
> TAT=A(4)
> 
> AUCAT=A(5)
> 
> TIS2 = A(2)/V2
> 
> TIS3 = A(3)/V3
> 
> Paul Hutson, PharmD, BCOP
> 
> Professor
> 
> UWisc School of Pharmacy
> 
> T: 608.263.2496
> 
> F: 608.265.5421
> 



Re: [NMusers] ERROR NUMBER OF BASIC PK PARAMETERS EXCEEDS VALUE OF NPARAM IN $MODEL

2019-07-30 Thread Leonid Gibiansky
Not sure why would we need NPARAM there, is it necessary? I think one 
can skip it.


On the different topic, expression for IWRES is not correct:

IWRES=IRES/(IPRED * EPS(1) + EPS(2))

This is the version that should be used:

IWRES=IRES/SQRT(IPRED**2 * SIGMA(1,1) + SIGMA(2,2))

Also it is more traditional to define IRES=DV-IPRED (negative residual 
corresponds to over-predictions; observed=predicted + residual error).


Regards
Leonid


On 7/29/2019 2:49 PM, Paul Hutson wrote:
I’ve fixed it by increasing NPARAM until it worked (increasing to 7), 
but can anyone explain why I get this message for a 3 compartment model 
with additional compartments to output a time above a concentration 
threshold (#4) and AUC while above that concentration threshold (#5)?  
It appears that NONMEM wants additional parameters added to NPARAM when 
I added calculated value CC in the $DES block.  What is also odd to me 
is that the fault is called on the line defining DADT(2). Thanks in 
advance. Paul


$SUBROUTINES ADVAN6 TOL=3

$MODEL NCOMP=5 NPARAM=6

COMP=(CENTRAL DEFDOSE DEFOBS)

COMP=(TISU1)

COMP=(TISU2)

COMP=(TTIME)

COMP=(AUCC)

;--PK BLOCK

$PK

MIC=0.12 ; SEEKING TIME AND AUC ABOVE 0.12 MCG/ML

TVCL = POP_CL

TVV1=POP_V1

TVQ2=POP_Q2

TVV2=POP_V2

TVQ3=POP_Q3

TVV3=POP_V3

CL=TVCL * EXP(ETA(1))

V1=TVV1 * EXP(ETA(2))

Q2=TVQ2 * EXP(ETA(3))

V2=TVV2 * EXP(ETA(4))

Q3=TVQ3 * EXP(ETA(5))

V3=TVV3 * EXP(ETA(6))

K10=CL/V1

K12=Q2/V1

K21=Q2/V2

K13=Q3/V1

K31=Q3/V3

;DES BLOCK

$DES

CC=A(1)/V1

RT=0

IF(CC.GT.MIC) RT=1

DADT(1) = - A(1) * (K10 + K12 + K13) + A(2) * K21  + A(3)*K31

DADT(2) = A(1) * K12 - A(2) * K21

DADT(3) = A(1) * K13 - A(3) * K31

DADT(4)=RT ; TIME ABOVE THRESHOLD TAT

DADT(5)=RT*CC ; AUC ABOVE THRESHOLD AUCAT

;- ERROR MODEL --

$ERROR

IPRED = F

    IRES=IPRED-DV

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

    IWRES=IRES/(IPRED * EPS(1) + EPS(2))

TAT=A(4)

AUCAT=A(5)

TIS2 = A(2)/V2

TIS3 = A(3)/V3

Paul Hutson, PharmD, BCOP

Professor

UWisc School of Pharmacy

T: 608.263.2496

F: 608.265.5421





[NMusers] ERROR NUMBER OF BASIC PK PARAMETERS EXCEEDS VALUE OF NPARAM IN $MODEL

2019-07-30 Thread Paul Hutson
I've fixed it by increasing NPARAM until it worked (increasing to 7), but can 
anyone explain why I get this message for a 3 compartment model with additional 
compartments to output a time above a concentration threshold (#4) and AUC 
while above that concentration threshold (#5)?  It appears that NONMEM wants 
additional parameters added to NPARAM when I added calculated value CC in the 
$DES block.  What is also odd to me is that the fault is called on the line 
defining DADT(2). Thanks in advance. Paul

$SUBROUTINES ADVAN6 TOL=3
$MODEL NCOMP=5 NPARAM=6
COMP=(CENTRAL DEFDOSE DEFOBS)
COMP=(TISU1)
COMP=(TISU2)
COMP=(TTIME)
COMP=(AUCC)

;--PK BLOCK
$PK
MIC=0.12 ; SEEKING TIME AND AUC ABOVE 0.12 MCG/ML

TVCL = POP_CL
TVV1=POP_V1
TVQ2=POP_Q2
TVV2=POP_V2
TVQ3=POP_Q3
TVV3=POP_V3

CL=TVCL * EXP(ETA(1))
V1=TVV1 * EXP(ETA(2))
Q2=TVQ2 * EXP(ETA(3))
V2=TVV2 * EXP(ETA(4))
Q3=TVQ3 * EXP(ETA(5))
V3=TVV3 * EXP(ETA(6))

K10=CL/V1
K12=Q2/V1
K21=Q2/V2
K13=Q3/V1
K31=Q3/V3

;DES BLOCK
$DES
CC=A(1)/V1

RT=0
IF(CC.GT.MIC) RT=1

DADT(1) = - A(1) * (K10 + K12 + K13) + A(2) * K21  + A(3)*K31
DADT(2) = A(1) * K12 - A(2) * K21
DADT(3) = A(1) * K13 - A(3) * K31

DADT(4)=RT ; TIME ABOVE THRESHOLD TAT
DADT(5)=RT*CC ; AUC ABOVE THRESHOLD AUCAT
;- ERROR MODEL --
$ERROR
IPRED = F
   IRES=IPRED-DV
   Y=IPRED * (1 + EPS(1)) + EPS(2)
   IWRES=IRES/(IPRED * EPS(1) + EPS(2))
TAT=A(4)
AUCAT=A(5)
TIS2 = A(2)/V2
TIS3 = A(3)/V3

Paul Hutson, PharmD, BCOP
Professor
UWisc School of Pharmacy
T: 608.263.2496
F: 608.265.5421