--- Haseeb said
> 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.
--- Christopher F Baum <baum@b...> wrote:
>> This may not be the most elegant way to do it
<snip>
One way to make Kit's code more elegant is to use the -simulation-
command:
program define sim, rclass
drop _all
set obs 100
drawnorm y x
reg y x
return scalar se = _se[x]
return scalar t = _b[x]/_se[x]
end
simulate "sim" se=r(se) t=r(t), dots reps(1000)
desc
sum
*
* 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/