Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: random uniform variable with unequal probabilities


From   Tomáš Houška <xbender@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: random uniform variable with unequal probabilities
Date   Mon, 19 Nov 2012 12:44:49 +0100

Hello Statalist,

I need to generate a random variable from uniform distribution, but
the probabilities are not not same for each option. The variable is
discrete in interval [10,19] and is generated 10times. Each time one
of the options has twice as high probability of occuring as the
others. So in some sence, the draw is two-staged - in the first stage
a random number (n) between 1 and 10 is generated and then that
particular n-th option in the interval [10,19] has a probability 0.2
of occuring, the other options have a probability 0.8/9 each.

How can I generate such variable?
Thank you!!
Tomas
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index