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: Saving simulation runs
From
John Antonakis <[email protected]>
To
[email protected]
Subject
st: Saving simulation runs
Date
Sat, 09 Oct 2010 12:41:14 +0200
My code here, which seemed to work fine before, stopped working (I am
sure that I did not change it, though can't find anything wrong with it).
***************************************
clear
capture program drop sim
version 11.1
program define sim, rclass
drop _all
syntax , nobs(integer )
set obs `nobs'
gen x1 = rnormal()
gen x2 = 2*x1 + .1*rnormal()
gen y = x1 + x2 + rnormal()
reg y x1 x2
end
mat b=e(b)
mat save = b
foreach nobs of numlist 100(100)1000 {
simulate _b _se, reps(100) seed (123) : sim, nobs(`nobs')
mat b=e(b)
mat save = save \ b
}
mat list save
***************************************
Also, how would I save the mean of the standard errors, along with the
mean of the coefficients, from each of the monte carlo runs?
Thanks,
John.
--
__________________________________________
Prof. John Antonakis, Associate Dean
Faculty of Business and Economics (HEC)
Department of Organizational Behavior
University of Lausanne
Internef #618
CH-1015 Lausanne-Dorigny
Switzerland
Tel ++41 (0)21 692-3438
Fax ++41 (0)21 692-3305
Home page:
http://www.hec.unil.ch/people/jantonakis
__________________________________________
*
* 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/