Statalist


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

R: st: RE: how to constrain rowtotal?


From   "Carlo Lazzaro" <[email protected]>
To   <[email protected]>
Subject   R: st: RE: how to constrain rowtotal?
Date   Mon, 28 Jan 2008 11:55:35 +0100

Dear Maarten and Nick,

thanks a lot for your kind and helpful reply.

Kind Regards,

Carlo

-----Messaggio originale-----
Da: [email protected]
[mailto:[email protected]] Per conto di Maarten buis
Inviato: domenica 27 gennaio 2008 20.42
A: [email protected]
Oggetto: Re: st: RE: how to constrain rowtotal?

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/


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