Abstract

The uniform() function generates random draws from a uniform distribution between zero and one ([D] functions). One of its many uses is creating random draws from a discrete distribution where each possible value has a known probability. A uniform distribution means that each number between zero and one is equally likely to be drawn. So the probability that a random draw from a uniform distribution has a value less than .50 is 50%, the probability that such a random draw has a value less than .60 is 60%, etc. The example below shows how this can be used to create a random variable, where the probability of drawing a 1 is 60% and the probability of drawing a 0 40%. In the first line random draws from the uniform distribution are stored in the variable rand. Each case has a 60% probability of getting a value of rand that is less than .60 and a 40% probability that it receives a value more than .60. The second line uses this fact to create draws from the desired distribution. Using the cond() function (Kantor and Cox 2005) it creates a new variable, draw, which has the value 1 if rand is less than .6 and 0 if rand has a value more than .60.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.