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

st: AW: re: basic monte carlo simulation

From   "Martin Weiss" <>
To   <>
Subject   st: AW: re: basic monte carlo simulation
Date   Sat, 21 Feb 2009 17:57:41 +0100


So, William, as you can see from Kit`s reply, the -cond-s nest without a
hitch. If you want more on that, try NJC`s (and his coauthor`s) tutorial:

The difference between one call to -cond- and several is that you have to
create the uniform random numbers as a permanent (could also be temp, but
would not make much of a difference here) variable, as you can see in Kit`s
third line. If you simply nested -cond-s and tossed -runiform- calls for
each one in there, these would deliver different values from the unit
interval and the whole thing would not work...

As for your -simulate- thing, look at -help simulate- at the bottom where
you will find a nice template. I have always thought of MC analysis as a
tool to investigate the behavior of an estimator where, say, the small
sample behavior is unknown. What you want from it amounts to a test whether
-runiform- is a good random number generator, because an obvious analytical
result for your dice thing is available...


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Kit Baum
Gesendet: Samstag, 21. Februar 2009 16:52
Betreff: st: re: basic monte carlo simulation

William said

Non-transitive dice would be something like:

     * die A has sides {2,2,4,4,9,9},
     * die B has sides {1,1,6,6,8,8}, and
     * die C has sides {3,3,5,5,7,7}.

A is likely to be higher than B
B is likely to be higher than C
C is likely to be higher than A

set obs 10000
g un1 = runiform()
g firstdice=cond(un1<`=1/3', 2, cond(un1<`=2/3', 4, 9 ))
prop firstdice

likewise for second and third.

Kit Baum, Boston College Economics and DIW Berlin
An Introduction to Modern Econometrics Using Stata:

*   For searches and help try:

*   For searches and help try:

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