I am using simulate to run a series of regressions and return the
coefficients and standard errors. What's the easiest way to have
Stata save the values of the independent and the residuals for each
observation after each repetition?
For the sake of brevity, here's a simple version:
The command is as follows:
simulate simprog, reps(20)
The program is as follows:
capture program drop simprog
program simprog
set obs 1000
gen x=uniform()
drawnorm resid
local beta=2
gen y=`beta'*x+resid
regress y x
end
Thanks,
Rachel
*
* 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/