Random number generation

6 messages 2 people Latest: Jun 05, 2019

Re: Random number generation

From: Tingjie Guo Date: June 03, 2019 technical
Hi Sebastien, As far as I know, you could write verbatim code to generate random numbers during estimation. E.g: $PK|$DES|$ERROR RAN = any value ; initialization "RAN = RAND(0) ; start verbatim code A random number between 0 and 1 from uniform distribution will be assigned to RAN. This function is called for each record of your input data. I believe it's also possible to call it more/fewer times through checking ICALL. Warm regards, Tingjie
Quoted reply history
________________________________ From: [email protected] <[email protected]> on behalf of Sebastien Bihorel <[email protected]> Sent: Thursday, May 30, 2019 12:34 To: [email protected] Subject: [NMusers] Random number generation Hi, Is it possible for NONMEM to generate a random number during an estimation run? Thank you Sebastien Bihorel

Re: Random number generation

From: Sebastien Bihorel Date: June 03, 2019 technical
Thanks Tingjie for your suggestion Unfortunately, as is, the suggested code is rejected by NONMEM 7.3 if used in $ERROR. Some additional setup calls might be required. An (admittedly heavy-handed) alternative that actually works is to create and import a fortran routine (see NONMEM help topic about FUNCA, or VECTRA). runif.f90: FUNCTION FUNCA(X,X1,X2) USE SIZES, ONLY: DPSIZE REAL(KIND=DPSIZE) :: X,X1,X2,FUNCA FUNCB = RAND() RETURN END Control stream: ... $SUBROUTINES ADVAN_ TRANS_ OTHER=runif.f90 ... $ERROR VECTRA(1) = 0 VECTRA(2) = 0 VECTRA(3) = 0 RND = FUNCA(VECTRA) ...
Quoted reply history
From: "Tingjie Guo" <[email protected]> To: "Sebastien Bihorel" <[email protected]>, [email protected] Sent: Monday, June 3, 2019 12:58:56 PM Subject: Re: Random number generation Hi Sebastien, As far as I know, you could write verbatim code to generate random numbers during estimation. E.g: $PK|$DES|$ERROR RAN = any value ; initialization "RAN = RAND(0) ; start verbatim code A random number between 0 and 1 from uniform distribution will be assigned to RAN. This function is called for each record of your input data. I believe it's also possible to call it more/fewer times through checking ICALL. Warm regards, Tingjie From: [email protected] <[email protected]> on behalf of Sebastien Bihorel <[email protected]> Sent: Thursday, May 30, 2019 12:34 To: [email protected] Subject: [NMusers] Random number generation Hi, Is it possible for NONMEM to generate a random number during an estimation run? Thank you Sebastien Bihorel

Re: Re: Random number generation

From: Sebastien Bihorel Date: June 04, 2019 technical
ERRATUM: runif.f90: FUNCTION FUNCA(X,X1,X2) USE SIZES, ONLY: DPSIZE REAL(KIND=DPSIZE) :: X,X1,X2,FUNCA FUNCA = RAND() RETURN END
Quoted reply history
From: "Sebastien Bihorel" <[email protected]> To: "Tingjie Guo" <[email protected]> Cc: [email protected] Sent: Monday, June 3, 2019 4:54:46 PM Subject: [NMusers] Re: Random number generation Thanks Tingjie for your suggestion Unfortunately, as is, the suggested code is rejected by NONMEM 7.3 if used in $ERROR. Some additional setup calls might be required. An (admittedly heavy-handed) alternative that actually works is to create and import a fortran routine (see NONMEM help topic about FUNCA, or VECTRA). runif.f90: FUNCTION FUNCA(X,X1,X2) USE SIZES, ONLY: DPSIZE REAL(KIND=DPSIZE) :: X,X1,X2,FUNCA FUNCB = RAND() RETURN END Control stream: ... $SUBROUTINES ADVAN_ TRANS_ OTHER=runif.f90 ... $ERROR VECTRA(1) = 0 VECTRA(2) = 0 VECTRA(3) = 0 RND = FUNCA(VECTRA) ... From: "Tingjie Guo" <[email protected]> To: "Sebastien Bihorel" <[email protected]>, [email protected] Sent: Monday, June 3, 2019 12:58:56 PM Subject: Re: Random number generation Hi Sebastien, As far as I know, you could write verbatim code to generate random numbers during estimation. E.g: $PK|$DES|$ERROR RAN = any value ; initialization "RAN = RAND(0) ; start verbatim code A random number between 0 and 1 from uniform distribution will be assigned to RAN. This function is called for each record of your input data. I believe it's also possible to call it more/fewer times through checking ICALL. Warm regards, Tingjie From: [email protected] <[email protected]> on behalf of Sebastien Bihorel <[email protected]> Sent: Thursday, May 30, 2019 12:34 To: [email protected] Subject: [NMusers] Random number generation Hi, Is it possible for NONMEM to generate a random number during an estimation run? Thank you Sebastien Bihorel

Re: Random number generation

From: Tingjie Guo Date: June 05, 2019 technical
Hi Sebastien, It worked perfectly for me in $ERROR, but I tested it on NONMEM 7.4.3. Maybe nm version matters. Warm regards, Tingjie
Quoted reply history
From: Sebastien Bihorel <[email protected]> Date: Monday, 3 June 2017 at 22:54 To: Tingjie Guo <[email protected]> Cc: "[email protected]" <[email protected]> Subject: Re: Random number generation Thanks Tingjie for your suggestion Unfortunately, as is, the suggested code is rejected by NONMEM 7.3 if used in $ERROR. Some additional setup calls might be required. An (admittedly heavy-handed) alternative that actually works is to create and import a fortran routine (see NONMEM help topic about FUNCA, or VECTRA). runif.f90: FUNCTION FUNCA(X,X1,X2) USE SIZES, ONLY: DPSIZE REAL(KIND=DPSIZE) :: X,X1,X2,FUNCA FUNCB = RAND() RETURN END Control stream: ... $SUBROUTINES ADVAN_ TRANS_ OTHER=runif.f90 ... $ERROR VECTRA(1) = 0 VECTRA(2) = 0 VECTRA(3) = 0 RND = FUNCA(VECTRA) ... ________________________________ From: "Tingjie Guo" <[email protected]> To: "Sebastien Bihorel" <[email protected]>, [email protected] Sent: Monday, June 3, 2019 12:58:56 PM Subject: Re: Random number generation Hi Sebastien, As far as I know, you could write verbatim code to generate random numbers during estimation. E.g: $PK|$DES|$ERROR RAN = any value ; initialization "RAN = RAND(0) ; start verbatim code A random number between 0 and 1 from uniform distribution will be assigned to RAN. This function is called for each record of your input data. I believe it's also possible to call it more/fewer times through checking ICALL. Warm regards, Tingjie ________________________________ From: [email protected] <[email protected]> on behalf of Sebastien Bihorel <[email protected]> Sent: Thursday, May 30, 2019 12:34 To: [email protected] Subject: [NMusers] Random number generation Hi, Is it possible for NONMEM to generate a random number during an estimation run? Thank you Sebastien Bihorel

Re: Random number generation

From: Sebastien Bihorel Date: June 05, 2019 technical
Good to know! Thanks for the follow up.
Quoted reply history
From: "Tingjie Guo" <[email protected]> To: "Sebastien Bihorel" <[email protected]> Cc: [email protected] Sent: Wednesday, June 5, 2019 6:08:44 AM Subject: Re: Random number generation Hi Sebastien, It worked perfectly for me in $ERROR, but I tested it on NONMEM 7.4.3. Maybe nm version matters. Warm regards, Tingjie From: Sebastien Bihorel <[email protected]> Date: Monday, 3 June 2017 at 22:54 To: Tingjie Guo <[email protected]> Cc: "[email protected]" <[email protected]> Subject: Re: Random number generation Thanks Tingjie for your suggestion Unfortunately, as is, the suggested code is rejected by NONMEM 7.3 if used in $ERROR. Some additional setup calls might be required. An (admittedly heavy-handed) alternative that actually works is to create and import a fortran routine (see NONMEM help topic about FUNCA, or VECTRA). runif.f90: FUNCTION FUNCA(X,X1,X2) USE SIZES, ONLY: DPSIZE REAL(KIND=DPSIZE) :: X,X1,X2,FUNCA FUNCB = RAND() RETURN END Control stream: ... $SUBROUTINES ADVAN_ TRANS_ OTHER=runif.f90 ... $ERROR VECTRA(1) = 0 VECTRA(2) = 0 VECTRA(3) = 0 RND = FUNCA(VECTRA) ... From: "Tingjie Guo" <[email protected]> To: "Sebastien Bihorel" <[email protected]>, [email protected] Sent: Monday, June 3, 2019 12:58:56 PM Subject: Re: Random number generation Hi Sebastien, As far as I know, you could write verbatim code to generate random numbers during estimation. E.g: $PK|$DES|$ERROR RAN = any value ; initialization "RAN = RAND(0) ; start verbatim code A random number between 0 and 1 from uniform distribution will be assigned to RAN. This function is called for each record of your input data. I believe it's also possible to call it more/fewer times through checking ICALL. Warm regards, Tingjie From: [email protected] <[email protected]> on behalf of Sebastien Bihorel <[email protected]> Sent: Thursday, May 30, 2019 12:34 To: [email protected] Subject: [NMusers] Random number generation Hi, Is it possible for NONMEM to generate a random number during an estimation run? Thank you Sebastien Bihorel