i want to generate two random normally distributed
(with centain mu and sigma) and run a regression to
save t stat and se to a data file. I want to replicate
the simalation by 1000 times.
This may not be the most elegant way to do it, but this does it for 10
reps:
clear
local nrep 10
set obs 100
gen z = uniform()
postfile handle se t using haseeb, replace
forv i = 1 /`nrep' {
capt drop y x
drawnorm y x
reg y x
post handle (_se[x]) (_b[x]/_se[x])
}
postclose handle
use haseeb, clear
desc
su
Note that you may also specify a covariance (or correlation) between
the variables drawn from the multivariate normal with drawnorm. I am
using the default here, which draws them independently.