Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Saving intermediate results (variables) when running -simulate-


From   Rachel <academicgirl@gmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: Saving intermediate results (variables) when running -simulate-
Date   Wed, 22 Aug 2007 13:19:44 -0400

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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index