Hi Marteen (or anyone else who's reading),
If I understand this correctly, the estimates resulting from the
simulation below should be the same for all 20 repetitions if the same
seed is used for each one. (Please correct me if I'm wrong.) The
issue is that I'd like the dataset to be different for each iteration
of the simulation.
Would it make sense to set the seed itself to be a random number and
then return the seed as a scalar so that the rest of the dataset could
be reproduced?
Thanks,
Rachel
>
> set seed 12345
> global i = 1
> cd c:\temp
> simulate _b _se rmse=e(rmse), reps(20): simprog
> list
>
> forvalues i = 1/20 {
> use temp`i', clear
> qui reg y x
> matrix list e(b)
> }
>
> * by setting the seed you can exactly reproduce
> * the datasets without saving them
> set seed 12345
> forvalues i = 1/20 {
> quietly {
> drop _all
> set obs 1000
> gen x=uniform()
> drawnorm resid
> local beta=2
> gen y=`beta'*x+resid
> regress y x
> }
> matrix list e(b)
> }
> *------------------ end example -------------------
> (For more on how to use examples I sent to the Statalist, see
> http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )
>
> Hope this helps,
> Maarten
>
> -----------------------------------------
> Maarten L. Buis
> Department of Social Research Methodology
> Vrije Universiteit Amsterdam
> Boelelaan 1081
> 1081 HV Amsterdam
> The Netherlands
>
> visiting address:
> Buitenveldertselaan 3 (Metropolitan), room Z434
>
> +31 20 5986715
>
> http://home.fsw.vu.nl/m.buis/
> -----------------------------------------
>
>
> ___________________________________________________________
> Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
> now.
> http://uk.answers.yahoo.com/
> *
> * 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/
>
*
* 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/