Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: RE: Generation of three uniform random variables that sum to one


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: Generation of three uniform random variables that sum to one
Date   Thu, 21 Oct 2010 14:56:18 +0100

foreach v in a b c { 
	gen `v' = runiform()
}
gen total = a + b + c 
foreach v in a b c { 
	replace `v' = `v' / total 
}

Nick 
[email protected] 

Fabien Bertho

I would like to generate three uniform random variables. And, the sum of these three variables equals to one.

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index