Re: How to generate a random number with $EST
Dear nmusers,
Thanks everybody. The generation of a random number from a uniform distribution finally works. Below you can see the code. You also you can see the table that NONMEM7 generated. The generated random values can be seen at the 6th column. The aim of this model is to estimate a parameter (PERT) that I use to predict a probability (PROB). Such probability represents the probability of suffering one event. There is individual variability in such probability. During the estimation process I have to produce a train of events for every individual. I don't know yet if it makes sense to do that in the way I'm trying to, but I thought it could be worth it.
$PK
.....
PERT=THETA(3)*EXP(ETA(1))
PROB=EXP(PERT)/(1+EXP(PERT))
...
$DES
PER=0
KK=0
"KK=RAND(0)
IF (KK.LT.PROB) THEN ;perturbation
PER=1
ENDIF
....
$ESTIMATION MAXEVAL=9990 NUMERICAL METHOD=COND LAPLACE LIKE CENTERING PRINT=1 NOABORT MSFO=msfo5
$TABLE ID TIME DV PER PROB KK PER NOAPPEND ONEHEADER NOPRINT FILE=sdtab5
TABLE NO. 1
ID TIME DV PER PROB KK
1.0000E+00 1.0000E+00 0.0000E+00 1.0000E+00 5.2498E-01 2.1428E-01
1.0000E+00 2.0000E+00 1.0000E+00 0.0000E+00 5.2498E-01 6.6192E-01
1.0000E+00 3.0000E+00 1.0000E+00 0.0000E+00 5.2498E-01 7.7577E-01
1.0000E+00 4.0000E+00 0.0000E+00 0.0000E+00 5.2498E-01 6.1920E-01
1.0000E+00 5.0000E+00 0.0000E+00 1.0000E+00 5.2498E-01 1.6852E-01
1.0000E+00 6.0000E+00 1.0000E+00 1.0000E+00 5.2498E-01 2.1436E-01
1.0000E+00 7.0000E+00 0.0000E+00 0.0000E+00 5.2498E-01 6.9345E-01
1.0000E+00 8.0000E+00 0.0000E+00 0.0000E+00 5.2498E-01 5.6443E-01
1.0000E+00 9.0000E+00 1.0000E+00 0.0000E+00 5.2498E-01 6.0616E-01
1.0000E+00 1.0000E+01 0.0000E+00 0.0000E+00 5.2498E-01 8.2914E-01
1.0000E+00 1.1000E+01 0.0000E+00 0.0000E+00 5.2498E-01 5.9900E-01
1.0000E+00 1.2000E+01 1.0000E+00 0.0000E+00 5.2498E-01 7.6669E-01
1.0000E+00 1.3000E+01 0.0000E+00 0.0000E+00 5.2498E-01 8.5406E-01
1.0000E+00 1.4000E+01 0.0000E+00 0.0000E+00 5.2498E-01 8.0210E-01
--
--------------------------------
Nieves Velez de Mendizabal, Ph.D
Departamento de Farmacia y Tecnología Farmacéutica
Facultad de Farmacia
Universidad de Navarra
Phone: (+34) 658 732 851
Phone: (+34) 948 255 400 ext. 5827
[email protected]