Dear NMUsers,
I need new pairs of eyes to look at the small problem I'm facing. The
solution is probably right before my nose but I can't seem to get a hold
of it.
Let me explain briefly, I wrote two small test control files (pasted
below), one for a weibull input function (inspired from
http://www.cognigencorp.com/nonmem/current/2010-April/2476.html) and the
other for an inverse gaussian input function. Note that In the $DES,
block I only put the weibull or inverse gaussian and no clearance
related parameters so I should end up with a cumulative distribution of
the input function. The thing is this, it works just fine for the
weibull with the function cumulating to one but I cannot seem to get it
to work for the inverse gaussian. The shape of the inverse gaussian
cumulative distribution is OK, it's the scale that's the problem, the
cumulated input does not add up to one but to much less (to
0.397,actually). I figured it's probably just an error in my coding of
the inverse gaussian pdf but having scrutinized it so much I just don't
see it anymore.
Below are my two control streams. If you build a dataset to run with
the code be sure to put a lot of timepoints between 0 and 1 because the
MAT parameter of the inverse gaussian is small (immediate release
formulation).
Thanks for your help :o)
1) Weibull
----------------------------
$PROBLEM WEIBULL INPUT FUNCTION SIM, SINGLE SUBJ
$INPUT C ID AMT TIME DV MDV EVID
$DATA DESTEST.CSV IGNORE=C
$SUBROUTINE ADVAN6 TOL=3
$MODEL NCOMP=1 COMP=(CENTRAL)
$PK
F1=0
BETA=THETA(1)
ALPHA=THETA(2)
$DES
; WEIBULL FUNCTION PDF
WB=(BETA/ALPHA)*((T/ALPHA)**(BETA-1))*EXP(-(T/ALPHA)**BETA)
DADT(1)=WB
$THETA 4.10 ;BETA
3.09 ;ALPHA
$OMEGA (FIX,0)
$ERROR Y=F+ERR(1)
$SIMULATION (234134) ONLYSIM
$TABLE TIME Y NOPRINT FILE=WB.TAB
$SCATTER Y VS TIME
----------------------------
2) Inverse gaussian
----------------------------
$PROBLEM INVERSE GAUSSIAN SIM, SINGLE SUBJ
$INPUT C ID AMT TIME DV MDV EVID
$DATA DESTEST.CSV IGNORE=C
$SUBROUTINE ADVAN6 TOL=3
$MODEL NCOMP=1 COMP=(CENTRAL)
$PK
F1=0
MAT=THETA(1)
CV=THETA(2)
CV2=CV**2
$DES
;INVERSE GAUSSIAN PDF
P1=2*3.141593*CV2*TIME**3
P2=(TIME-MAT)**2
P3=2*CV2*MAT*TIME
P4=SQRT(MAT/P1)
RATIO=-1*(P2/P3)
P5=EXP(RATIO)
IG=P4*P5
DADT(1)=IG
$THETA 0.062 ;MAT
0.466 ;CV
$OMEGA (FIX,0)
$ERROR Y=F+ERR(1)
$SIMULATION (323454) ONLYSIM
$TABLE TIME Y NOPRINT FILE=IGTEST.TAB
$SCATTER Y VS TIME
----------------------------
Pierre-Olivier Tremblay
inverse gaussian input function
3 messages
3 people
Latest: Jul 22, 2011
I think you have to use T instead of TIME, because TIME is just a variable you named in your data set and it's not real 'time' for computation.
I hope this helps!
Best regards,
Nieves
Quoted reply history
On 7/21/11 9:45 PM, Tremblay, Pierre-Olivier wrote:
> Dear NMUsers,
>
> I need new pairs of eyes to look at thesmallproblem I'm facing. The solution is probably right before my nose but I can't seem to get a hold of it.
>
> Let me explain briefly, I wrote two small test control files(pasted below), one foraweibull input function(inspiredfrom http://www.cognigencorp.com/nonmem/current/2010-April/2476.html )and the other for an inverse gaussianinput function. Note that In the $DES,block I only put the weibullor inverse gaussian and no clearance related parameters soIshouldend up with a cumulative distribution of theinputfunction. The thing is this, it works just finefor the weibullwith the function cumulating to one but I cannot seem to get it to work for the inverse gaussian.The shape of the inverse gaussian cumulative distribution is OK, it's the scale that's the problem, the cumulated input does not add up to one buttomuch less (to 0.397,actually). I figured it's probably just an error in my coding of the inverse gaussian pdf buthaving scrutinized it so much Ijustdon't see it anymore.
>
> Below are my two control streams. If you build a dataset to run with the code be sure to put a lot of timepoints between 0 and 1 because the MATparameterof the inverse gaussianis small (immediate release formulation).
>
> Thanks for yourhelp:o)
>
> 1) Weibull
>
> ----------------------------
>
> $PROBLEM WEIBULL INPUT FUNCTION SIM, SINGLE SUBJ
>
> $INPUT C ID AMT TIME DV MDV EVID
>
> $DATA DESTEST.CSV IGNORE=C
>
> $SUBROUTINE ADVAN6 TOL=3
>
> $MODEL NCOMP=1 COMP=(CENTRAL)
>
> $PK
>
> F1=0
>
> BETA=THETA(1)
>
> ALPHA=THETA(2)
>
> $DES
>
> ; WEIBULL FUNCTION PDF
>
> WB=(BETA/ALPHA)*((T/ALPHA)**(BETA-1))*EXP(-(T/ALPHA)**BETA)
>
> DADT(1)=WB
>
> $THETA 4.10 ;BETA
>
> 3.09 ;ALPHA
>
> $OMEGA (FIX,0)
>
> $ERRORY=F+ERR(1)
>
> $SIMULATION (234134) ONLYSIM
>
> $TABLE TIME Y NOPRINT FILE=WB.TAB
>
> $SCATTER Y VS TIME
>
> ----------------------------
>
> 2) Inverse gaussian
>
> ----------------------------
>
> $PROBLEM INVERSE GAUSSIAN SIM, SINGLE SUBJ
>
> $INPUT C ID AMT TIME DV MDV EVID
>
> $DATA DESTEST.CSV IGNORE=C
>
> $SUBROUTINE ADVAN6 TOL=3
>
> $MODEL NCOMP=1 COMP=(CENTRAL)
>
> $PK
>
> F1=0
>
> MAT=THETA(1)
>
> CV=THETA(2)
>
> CV2=CV**2
>
> $DES
>
> ;INVERSE GAUSSIAN PDF
>
> P1=2*3.141593*CV2*TIME**3
>
> P2=(TIME-MAT)**2
>
> P3=2*CV2*MAT*TIME
>
> P4=SQRT(MAT/P1)
>
> RATIO=-1*(P2/P3)
>
> P5=EXP(RATIO)
>
> IG=P4*P5
>
> DADT(1)=IG
>
> $THETA 0.062 ;MAT
>
> 0.466 ;CV
>
> $OMEGA (FIX,0)
>
> $ERRORY=F+ERR(1)
>
> $SIMULATION (323454) ONLYSIM
>
> $TABLE TIME Y NOPRINT FILE=IGTEST.TAB
>
> $SCATTER Y VS TIME
>
> ----------------------------
>
> Pierre-Olivier Tremblay
Few ideas to try:
1. Replace TIME by T (for inverse Gaussian)
2. Put some defense against T=0 (say, use (T+0.000001) instead of T in all expressions)
3. Use TOL=9 (as high as nonmem would allow)
I tested it in R, and your expression integrates to 1, so this is a numerical issue, not an error in the formulas.
Leonid
--------------------------------------
Leonid Gibiansky, Ph.D.
President, QuantPharm LLC
web: www.quantpharm.com
e-mail: LGibiansky at quantpharm.com
tel: (301) 767 5566
Quoted reply history
On 7/21/2011 9:45 PM, Tremblay, Pierre-Olivier wrote:
> Dear NMUsers,
>
> I need new pairs of eyes to look at thesmallproblem I'm facing. The
> solution is probably right before my nose but I can't seem to get a hold
> of it.
>
> Let me explain briefly, I wrote two small test control files(pasted
> below), one foraweibull input
> function(inspiredfrom http://www.cognigencorp.com/nonmem/current/2010-April/2476.html)and
> the other for an inverse gaussianinput function. Note that In the
> $DES,block I only put the weibullor inverse gaussian and no clearance
> related parameters soIshouldend up with a cumulative distribution of
> theinputfunction. The thing is this, it works just finefor the
> weibullwith the function cumulating to one but I cannot seem to get it
> to work for the inverse gaussian.The shape of the inverse gaussian
> cumulative distribution is OK, it's the scale that's the problem, the
> cumulated input does not add up to one buttomuch less (to
> 0.397,actually). I figured it's probably just an error in my coding of
> the inverse gaussian pdf buthaving scrutinized it so much Ijustdon't see
> it anymore.
>
> Below are my two control streams. If you build a dataset to run with the
> code be sure to put a lot of timepoints between 0 and 1 because the
> MATparameterof the inverse gaussianis small (immediate release formulation).
>
> Thanks for yourhelp:o)
>
> 1) Weibull
>
> ----------------------------
>
> $PROBLEM WEIBULL INPUT FUNCTION SIM, SINGLE SUBJ
>
> $INPUT C ID AMT TIME DV MDV EVID
>
> $DATA DESTEST.CSV IGNORE=C
>
> $SUBROUTINE ADVAN6 TOL=3
>
> $MODEL NCOMP=1 COMP=(CENTRAL)
>
> $PK
>
> F1=0
>
> BETA=THETA(1)
>
> ALPHA=THETA(2)
>
> $DES
>
> ; WEIBULL FUNCTION PDF
>
> WB=(BETA/ALPHA)*((T/ALPHA)**(BETA-1))*EXP(-(T/ALPHA)**BETA)
>
> DADT(1)=WB
>
> $THETA 4.10 ;BETA
>
> 3.09 ;ALPHA
>
> $OMEGA (FIX,0)
>
> $ERRORY=F+ERR(1)
>
> $SIMULATION (234134) ONLYSIM
>
> $TABLE TIME Y NOPRINT FILE=WB.TAB
>
> $SCATTER Y VS TIME
>
> ----------------------------
>
> 2) Inverse gaussian
>
> ----------------------------
>
> $PROBLEM INVERSE GAUSSIAN SIM, SINGLE SUBJ
>
> $INPUT C ID AMT TIME DV MDV EVID
>
> $DATA DESTEST.CSV IGNORE=C
>
> $SUBROUTINE ADVAN6 TOL=3
>
> $MODEL NCOMP=1 COMP=(CENTRAL)
>
> $PK
>
> F1=0
>
> MAT=THETA(1)
>
> CV=THETA(2)
>
> CV2=CV**2
>
> $DES
>
> ;INVERSE GAUSSIAN PDF
>
> P1=2*3.141593*CV2*TIME**3
>
> P2=(TIME-MAT)**2
>
> P3=2*CV2*MAT*TIME
>
> P4=SQRT(MAT/P1)
>
> RATIO=-1*(P2/P3)
>
> P5=EXP(RATIO)
>
> IG=P4*P5
>
> DADT(1)=IG
>
> $THETA 0.062 ;MAT
>
> 0.466 ;CV
>
> $OMEGA (FIX,0)
>
> $ERRORY=F+ERR(1)
>
> $SIMULATION (323454) ONLYSIM
>
> $TABLE TIME Y NOPRINT FILE=IGTEST.TAB
>
> $SCATTER Y VS TIME
>
> ----------------------------
>
> Pierre-Olivier Tremblay