Many thanks to Nick Cox for his prompt reply - I will use the recommended
direct method.
Best regards,
Amani
-----Original Message-----
From: n j cox [mailto:[email protected]]
Sent: Thursday, 24 April 2003 13:47
To: [email protected]
Subject: Re: st: The function " invnorm(uniform())"
[email protected] wrote:
>
> I am using the function "invnorm(uniform())" which returns normally
> distributed random numbers with mean zero and standard deviation
one,
> inside a program "linsim.ado". The latter is used with:
>
> simul linsim, reps(10000)
>
> program define lnsim
> version 7.0
> if "`1'"=="?" {
> global S_1 "eff diag1 diag2"
> exit
> }
> drop _all
> set obs 1
> gen eff = uniform()*100
> gen diag1 = invnorm(uniform())
> gen diag2 = invnorm(uniform())*1.5 + 5
> post `1' (eff) (diag1) (diag2)
> end
>
> Can I say that the variable "diag2", is a normally distributed random
number
> with mean 5 and standard deviation 1.5.
Yes, but you need not use -simul- to get this. Just do it directly:
set obs 10000
gen eff = uniform()*100
gen diag1 = invnorm(uniform())
gen diag2 = invnorm(uniform())*1.5 + 5
outfile eff diag1 diag2
Nick
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/