Statalist


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

Re: st: RE: how to constrain rowtotal?


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: RE: how to constrain rowtotal?
Date   Sun, 27 Jan 2008 19:41:35 +0000 (GMT)

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"))) 
-- Maarten

--- 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
> 
> Nick 
> [email protected] 
> 
> Carlo Lazzaro
> 
> In a Markov Model I have four variables (A= 0.721; B= 0.202; C=
> 0.067;
> D=
> 0.010) showing transition probabilities from/to different health
> states,
> which are both exhaustive and mutual exclusive (that is: Prob_A+
> Prob_B+
> Prob_C+ Prob_D=1)
> 
> I would like to randomly resampling the base case value of each
> variable
> (let's say using -uniform()-): how can I constrain egen Resampling=
> rowtotal
> (A_uniform B_uniform C_uniform D_uniform) =1 after each random
> resample?
> 
> 
> *
> *   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/
> 


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      __________________________________________________________
Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com

*
*   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