Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Fwd: Saving results in program/loop
From
Maximiliano Méndez Parra <[email protected]>
To
[email protected]
Subject
st: Fwd: Saving results in program/loop
Date
Mon, 1 Mar 2010 17:37:02 +0000
Dear all,
I am trying to do a Monte Carlo experiment. Inside the program there is a
loop that performs a given regression 100 times with different
specifications for each of the simulations (5000). At the end, the program
pick up the minimum t statistic from each of the 100 set of simulations to
form a distribution . The problem I have is that I want to know from which
of those 100 regressions the minimum t stat come from. Therefore, I need to
save the intermediate results. I've tried with postfile, however, it only
saves the last set of 100 regressions and I want to have all of them. I've
tried putting the commands inside and outside the loop but I failed. Or at
least, if it is not possible to save the intermediate results, I would like
to know if there is some way of associating those minimum t stats with a
give iteration inside the loop.
Can you help me?
My program looks like this
program seascrit1, rclass
version 10.0
drop _all
set obs 300
*More commands...*
forvalues i=1/100{
*More commands...*
reg XXX YYY ZZZ SSS....
test l.z3t l.z4t
scalar Fa`i'=r(F)
test l.z5t l.z6t
scalar Fb`i'=r(F)
test l.z7t l.z8t
scalar Fc`i'=r(F)
test l.z9t l.z10t
scalar Fd`i'=r(F)
test l.z11t l.z12t
scalar Fe`i'=r(F)
scalar ba`i' = (_coef[l.z1t])/_se[l.z1t]
scalar bb`i' = (_coef[l.z2t])/_se[l.z2t]
}
*end of loop
return scalar b1...
return scalar b2...
....
scalar drop _all
end
simulate tbr=r(tbr) b1=r(b1) b2=r(b2) b3=r(b3) b4=r(b4) b5=r(b5) b6=r(b6)
b7=r(b7), reps(5000) : seascrit1
--
Maximiliano Méndez Parra
[email protected]
--
Maximiliano Méndez Parra
[email protected]
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/