NONMEM Users Network Archive

Hosted by Cognigen

Re: How to generate a random number with $EST

From: Nick Holford <n.holford>
Date: Mon, 14 Mar 2011 11:09:05 +0200

Nieves,

I have no idea why you want to do this but if you want to have the same
random number at every time then the simplest and most efficient way to
do this is to create the random number as a data item in your data set.
You can use the rand() function in Excel to generate a pseudo-random
uniform sample at each time. It is a waste of computer cycles to have to
keep calling the random number generator for every record if you want
the same random number value.

On the other hand if you want a different random number every time you
reach a particular record then that is a more complicated matter. I
expect it can be done with a verbatim code call but I do not know how.
Perhaps you can use?
" CALL RANDOM(2,R)

It would be interesting to know why you want the random number when you
are not doing simulation.

Best wishes,

Nick

On 14/03/2011 10:32 a.m., Nieves Vlez de Mendizabal wrote:
>
> Dear NONMEM Users,
>
>
> I'm developing a model with NONMEM6|7. In this model, I need to
> generate a random number at every time step. The problem is that the
> use of the function "CALL RANDOM (2,R)" is supposed to be only for
> simulation, isn't it?
>
> Thus, is it possible to generate a random number at every time step
> with NONMEM? Does anybody know how?
>
> This is part of the code that does not work (it's not working because
> the condition ICALL.EQ.4 never happens and for that it's not getting
> into the "if", but on the other hand, in order to use the function
> RANDOM(2,R), such function requires ICALL.EQ.4):
>
> ...
>
> $SUBS ADVAN6 TOL=5
>
> $MODEL
>
> ...
>
> $PK
>
> ...
>
> IF (ICALL.EQ.4) THEN
>
> CALL RANDOM (2,R) ;Rand number in[0,1[
>
> T=1-R
>
> ...
>
> ENDIF
>
> $DES
>
> ...
>
> $ERROR
>
> ...
>
> $ESTIMATION MAXEVAL=0 NUMERICAL METHOD=COND LAPLACE LIKE CENTERING
> PRINT=2 MSFO=msfo3
>
> Thank you!
>
> Nieves
>
> --
> --------------------------------
> Nieves Velez de Mendizabal, Ph.D
> Departamento de Farmacia y Tecnologa Farmacutica
> Facultad de Farmacia
> Universidad de Navarra
> Phone: (+34) 658 732 851
> Phone: (+34) 948 255 400 ext. 5827
> nvelez
> --------------------------------

--
Nick Holford, Professor Clinical Pharmacology
Dept Pharmacology& Clinical Pharmacology
University of Auckland,85 Park Rd,Private Bag 92019,Auckland,New Zealand
tel:+64(9)923-6730 fax:+64(9)373-7090 mobile:+64(21)46 23 53
email: n.holford
http://www.fmhs.auckland.ac.nz/sms/pharmacology/holford


Received on Mon Mar 14 2011 - 05:09:05 EDT

The NONMEM Users Network is maintained by ICON plc. Requests to subscribe to the network should be sent to: nmusers-request@iconplc.com.

Once subscribed, you may contribute to the discussion by emailing: nmusers@globomaxnm.com.