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

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

From   Rachel <>
To   statalist <>
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

*   For searches and help try:

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