Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: question about monte carlo study


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: question about monte carlo study
Date   Tue, 14 Apr 2009 17:28:00 +0200

<> 

Easy answer: you must set it in the -simulate- call, as an option to it. See

*************
help simulate
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Rudy
Fichtenbaum
Gesendet: Dienstag, 14. April 2009 17:23
An: [email protected]
Betreff: st: question about monte carlo study

I am running a monte carlo simulation using the following program:

capture program drop olssim
program olssim, rclass
version 10.0
drop _all
set obs 100
generate e = invnorm(uniform())*2
generate x = uniform()*10
generate y = 1 + 0.5 * x + e
regress y x
return scalar b0 = _coef[_cons]
return scalar b1 = _coef[x]
end

simulate "olssim" b0 = r(b0) b1 = r(b1), reps(1000)

sum b0 b1, detail

The problem I am having is that each time I run the program I get a 
slightly different result. I know this is because I have not set the 
seed for the random number generator but I can't figure out how to set 
the seed in this program.

Rudy

-- 
Rudy Fichtenbaum
Professor of Economics
Chief Negotiator AAUP-WSU
Wright State University
Dayton, OH 45435-0001
937-775-3085

*
*   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/


*
*   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/



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