Dear NMuser,
I encountered a strange problem when I used the following code to simulate
normal distributed data. When the data records >797, no result appears with
NONMEM run into an infinite loop . But when the records decreasing to 796
(delete the last row), the results will occurred immediately. Anyone else
met this phenomenon? Any comments and suggestions are appreciated. Thank
you in advance.
$PROBLEM PD
$INPUT ID,CONC,DV
$DATA data.csv IGNORE=@ ;
$PRED
NMEAN=THETA(1)+ETA(1)
SD=THETA(2)
;Simulate count
IF (ICALL.EQ.4) THEN
N=0
PRN=0
CALL RANDOM(2, R)
RL=1-R
DO WHILE (RL .GT. PRN)
LNNOR=LOG(6.283185)+2*LOG(SD)+((N-NMEAN)/SD)**2
PY=EXP(-0.5*LNNOR)
PRN=PRN+PY
IF (PRN .LT. RL) N=N+1
ENDDO
DV=N
ENDIF
$THETA
(30,41.7,60) ;MEAN
(2,14.4,50) ;SD
$OMEGA
0 FIX ;MEAN
$SIMULATION (6446) (7545 UNIFORM) ONLYSIM NOPRED SUB=1
$TABLE ID TIME DV ONEHEADER NOPRINT FILE=npctab1.dta
data.csv like this
ID CONC DV
1 0 .
1 0 .
1 0 .
1 0 .
1 0 .
1 0.01 .
1 0.01 .
1 0.01 .
1 0.01 .
1 0.01 .
.....
Yucheng Sheng
Research Associate
School of Pharmacy, UCL
Simulation problem of normal distributed data
5 messages
4 people
Latest: Jul 30, 2014
Hi Sheng,
I don't know the exact reason behind such mysterious behavior but if you
just change the seed number (the UNIFORM seed) it works.
e.g. I changed the seed# from 7545 to 17545 and was able to simulate
1000 rows for the subject.
$SIMULATION (6446) (*1*7545 UNIFORM) ONLYSIM NOPRED SUB=1
Its a rare occurrence but may be the seed number caused some issue (while
generating sufficient samples to satisfy the constraints you set up using
the DOWHILE LOOP). For example I think the same seed number (7545) may work
when the DOWHILE condition is reversed
(RL .*LT*. PRN) however it may not be appropriate based on your
problem. .......or
may be there is some other explanation to such occurrence.
Kind regards
Navin Goyal
Quoted reply history
On Tue, Jul 29, 2014 at 10:54 AM, Gerry Sheng <[email protected]> wrote:
> Dear NMuser,
>
> I encountered a strange problem when I used the following code to simulate
> normal distributed data. When the data records >797, no result appears with
> NONMEM run into an infinite loop . But when the records decreasing to 796
> (delete the last row), the results will occurred immediately. Anyone else
> met this phenomenon? Any comments and suggestions are appreciated. Thank
> you in advance.
>
> $PROBLEM PD
> $INPUT ID,CONC,DV
> $DATA data.csv IGNORE=@ ;
>
> $PRED
> NMEAN=THETA(1)+ETA(1)
> SD=THETA(2)
>
> ;Simulate count
> IF (ICALL.EQ.4) THEN
> N=0
> PRN=0
> CALL RANDOM(2, R)
> RL=1-R
> DO WHILE (RL .GT. PRN)
> LNNOR=LOG(6.283185)+2*LOG(SD)+((N-NMEAN)/SD)**2
> PY=EXP(-0.5*LNNOR)
> PRN=PRN+PY
> IF (PRN .LT. RL) N=N+1
> ENDDO
> DV=N
> ENDIF
>
> $THETA
> (30,41.7,60) ;MEAN
> (2,14.4,50) ;SD
>
> $OMEGA
> 0 FIX ;MEAN
>
> $SIMULATION (6446) (7545 UNIFORM) ONLYSIM NOPRED SUB=1
> $TABLE ID TIME DV ONEHEADER NOPRINT FILE=npctab1.dta
>
> data.csv like this
> ID CONC DV
> 1 0 .
> 1 0 .
> 1 0 .
> 1 0 .
> 1 0 .
> 1 0.01 .
> 1 0.01 .
> 1 0.01 .
> 1 0.01 .
> 1 0.01 .
> .....
>
> Yucheng Sheng
>
> Research Associate
> School of Pharmacy, UCL
>
--
Navin Goyal
Sheng:
This seems like a rather arbitrary occurrence. If you would supply me with
your problem (control stream file and data set), I would be happy to determine
if there is a bug. Please let me know what version of NONMEM you are using,
compiler, and operating system.
Robert J. Bauer, Ph.D.
Vice President, Pharmacometrics, R&D
ICON Development Solutions
7740 Milestone Parkway
Suite 150
Hanover, MD 21076
Tel: (215) 616-6428
Mob: (925) 286-0769
Email: [email protected]<mailto:[email protected]>
Web: http://www.iconplc.com/
Quoted reply history
From: [email protected] [mailto:[email protected]] On
Behalf Of Navin Goyal
Sent: Tuesday, July 29, 2014 6:25 PM
To: Gerry Sheng
Cc: nmusers
Subject: Re: [NMusers] Simulation problem of normal distributed data
Hi Sheng,
I don't know the exact reason behind such mysterious behavior but if you just
change the seed number (the UNIFORM seed) it works.
e.g. I changed the seed# from 7545 to 17545 and was able to simulate 1000
rows for the subject.
$SIMULATION (6446) (17545 UNIFORM) ONLYSIM NOPRED SUB=1
Its a rare occurrence but may be the seed number caused some issue (while
generating sufficient samples to satisfy the constraints you set up using the
DOWHILE LOOP). For example I think the same seed number (7545) may work when
the DOWHILE condition is reversed
(RL .LT. PRN) however it may not be appropriate based on your problem.
.......or may be there is some other explanation to such occurrence.
Kind regards
Navin Goyal
On Tue, Jul 29, 2014 at 10:54 AM, Gerry Sheng
<[email protected]<mailto:[email protected]>> wrote:
Dear NMuser,
I encountered a strange problem when I used the following code to simulate
normal distributed data. When the data records >797, no result appears with
NONMEM run into an infinite loop . But when the records decreasing to 796
(delete the last row), the results will occurred immediately. Anyone else met
this phenomenon? Any comments and suggestions are appreciated. Thank you in
advance.
$PROBLEM PD
$INPUT ID,CONC,DV
$DATA data.csv IGNORE=@ ;
$PRED
NMEAN=THETA(1)+ETA(1)
SD=THETA(2)
;Simulate count
IF (ICALL.EQ.4) THEN
N=0
PRN=0
CALL RANDOM(2, R)
RL=1-R
DO WHILE (RL .GT. PRN)
LNNOR=LOG(6.283185)+2*LOG(SD)+((N-NMEAN)/SD)**2
PY=EXP(-0.5*LNNOR)
PRN=PRN+PY
IF (PRN .LT. RL) N=N+1
ENDDO
DV=N
ENDIF
$THETA
(30,41.7,60) ;MEAN
(2,14.4,50) ;SD
$OMEGA
0 FIX ;MEAN
$SIMULATION (6446) (7545 UNIFORM) ONLYSIM NOPRED SUB=1
$TABLE ID TIME DV ONEHEADER NOPRINT FILE=npctab1.dta
data.csv like this
ID CONC DV
1 0 .
1 0 .
1 0 .
1 0 .
1 0 .
1 0.01 .
1 0.01 .
1 0.01 .
1 0.01 .
1 0.01 .
.....
Yucheng Sheng
Research Associate
School of Pharmacy, UCL
--
Navin Goyal
Dear Goyal,
Thank you for your advice. I changed the second seed to 17545, but the new
cutoff number of records is 1498 . If data records>1498, the same problem
still exists.
Best wishes,
Yucheng Sheng
Research Associate
School of Pharmacy, UCL
Quoted reply history
On 29 July 2014 23:25, Navin Goyal <[email protected]> wrote:
> Hi Sheng,
> I don't know the exact reason behind such mysterious behavior but if you
> just change the seed number (the UNIFORM seed) it works.
> e.g. I changed the seed# from 7545 to 17545 and was able to simulate
> 1000 rows for the subject.
>
> $SIMULATION (6446) (*1*7545 UNIFORM) ONLYSIM NOPRED SUB=1
>
> Its a rare occurrence but may be the seed number caused some issue (while
> generating sufficient samples to satisfy the constraints you set up using
> the DOWHILE LOOP). For example I think the same seed number (7545) may
> work when the DOWHILE condition is reversed
> (RL .*LT*. PRN) however it may not be appropriate based on your problem.
> .......or may be there is some other explanation to such occurrence.
>
> Kind regards
> Navin Goyal
>
>
>
>
>
>
> On Tue, Jul 29, 2014 at 10:54 AM, Gerry Sheng <[email protected]> wrote:
>
>> Dear NMuser,
>>
>> I encountered a strange problem when I used the following code to
>> simulate normal distributed data. When the data records >797, no result
>> appears with NONMEM run into an infinite loop . But when the records
>> decreasing to 796 (delete the last row), the results will occurred
>> immediately. Anyone else met this phenomenon? Any comments and suggestions
>> are appreciated. Thank you in advance.
>>
>> $PROBLEM PD
>> $INPUT ID,CONC,DV
>> $DATA data.csv IGNORE=@ ;
>>
>> $PRED
>> NMEAN=THETA(1)+ETA(1)
>> SD=THETA(2)
>>
>> ;Simulate count
>> IF (ICALL.EQ.4) THEN
>> N=0
>> PRN=0
>> CALL RANDOM(2, R)
>> RL=1-R
>> DO WHILE (RL .GT. PRN)
>> LNNOR=LOG(6.283185)+2*LOG(SD)+((N-NMEAN)/SD)**2
>> PY=EXP(-0.5*LNNOR)
>> PRN=PRN+PY
>> IF (PRN .LT. RL) N=N+1
>> ENDDO
>> DV=N
>> ENDIF
>>
>> $THETA
>> (30,41.7,60) ;MEAN
>> (2,14.4,50) ;SD
>>
>> $OMEGA
>> 0 FIX ;MEAN
>>
>> $SIMULATION (6446) (7545 UNIFORM) ONLYSIM NOPRED SUB=1
>> $TABLE ID TIME DV ONEHEADER NOPRINT FILE=npctab1.dta
>>
>> data.csv like this
>> ID CONC DV
>> 1 0 .
>> 1 0 .
>> 1 0 .
>> 1 0 .
>> 1 0 .
>> 1 0.01 .
>> 1 0.01 .
>> 1 0.01 .
>> 1 0.01 .
>> 1 0.01 .
>> .....
>>
>> Yucheng Sheng
>>
>> Research Associate
>> School of Pharmacy, UCL
>>
>
>
>
> --
> Navin Goyal
>
Hi Gerry,
EXP(-X) might become such a small number that PRN no longer increases. For
example, 0.5+S is represented as 0.5 for small S. Using verbatim code (see
nmhelp) you could print N, PY and PRN to see if something like this occurs.
Best regards,
Erik
Quoted reply history
________________________________
From: [email protected] [[email protected]] on behalf of
Gerry Sheng [[email protected]]
Sent: Wednesday, July 30, 2014 10:40 AM
Cc: nmusers
Subject: Re: [NMusers] Simulation problem of normal distributed data
Dear Goyal,
Thank you for your advice. I changed the second seed to 17545, but the new
cutoff number of records is 1498 . If data records>1498, the same problem
still exists.
Best wishes,
Yucheng Sheng
Research Associate
School of Pharmacy, UCL
On 29 July 2014 23:25, Navin Goyal
<[email protected]<mailto:[email protected]>> wrote:
Hi Sheng,
I don't know the exact reason behind such mysterious behavior but if you just
change the seed number (the UNIFORM seed) it works.
e.g. I changed the seed# from 7545 to 17545 and was able to simulate 1000
rows for the subject.
$SIMULATION (6446) (17545 UNIFORM) ONLYSIM NOPRED SUB=1
Its a rare occurrence but may be the seed number caused some issue (while
generating sufficient samples to satisfy the constraints you set up using the
DOWHILE LOOP). For example I think the same seed number (7545) may work when
the DOWHILE condition is reversed
(RL .LT. PRN) however it may not be appropriate based on your problem.
.......or may be there is some other explanation to such occurrence.
Kind regards
Navin Goyal
On Tue, Jul 29, 2014 at 10:54 AM, Gerry Sheng
<[email protected]<mailto:[email protected]>> wrote:
Dear NMuser,
I encountered a strange problem when I used the following code to simulate
normal distributed data. When the data records >797, no result appears with
NONMEM run into an infinite loop . But when the records decreasing to 796
(delete the last row), the results will occurred immediately. Anyone else met
this phenomenon? Any comments and suggestions are appreciated. Thank you in
advance.
$PROBLEM PD
$INPUT ID,CONC,DV
$DATA data.csv IGNORE=@ ;
$PRED
NMEAN=THETA(1)+ETA(1)
SD=THETA(2)
;Simulate count
IF (ICALL.EQ.4) THEN
N=0
PRN=0
CALL RANDOM(2, R)
RL=1-R
DO WHILE (RL .GT. PRN)
LNNOR=LOG(6.283185)+2*LOG(SD)+((N-NMEAN)/SD)**2
PY=EXP(-0.5*LNNOR)
PRN=PRN+PY
IF (PRN .LT. RL) N=N+1
ENDDO
DV=N
ENDIF
$THETA
(30,41.7,60) ;MEAN
(2,14.4,50) ;SD
$OMEGA
0 FIX ;MEAN
$SIMULATION (6446) (7545 UNIFORM) ONLYSIM NOPRED SUB=1
$TABLE ID TIME DV ONEHEADER NOPRINT FILE=npctab1.dta
data.csv like this
ID CONC DV
1 0 .
1 0 .
1 0 .
1 0 .
1 0 .
1 0.01 .
1 0.01 .
1 0.01 .
1 0.01 .
1 0.01 .
.....
Yucheng Sheng
Research Associate
School of Pharmacy, UCL
--
Navin Goyal