Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: how to constrain rowtotal?


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: how to constrain rowtotal?
Date   Mon, 28 Jan 2008 10:35:45 -0000

I am not clear why you think that better. 

Nick
[email protected] 

Maarten buis

Even better would be:
gen unif = uniform()
gen which = cond(unif < 0.721, "A",        ///
            cond(unif < 0.923, "B",        ///
	    cond(unif < 0.990, "C", "D"))) 

--- Nick Cox <[email protected]> wrote:

> This may help: 
> 
> . gen which = cond(uniform() < 0.721, "A", 
>               cond(uniform() < 0.923, "B", 
> 		  cond(uniform() < 0.990, "C", "D"))) 
> 
> Also see 
> 
> SJ-7-3  pr0032  Stata tip 48: Discrete uses for uniform()
> M. L. Buis
> Q3/07   SJ 7(3):434--435     
>         tip on using uniform() to create random draws from a
>         discrete distribution where each possible value has a
>         known probability
> 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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