Statalist


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

st: RE: how to constrain rowtotal?


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: how to constrain rowtotal?
Date   Sun, 27 Jan 2008 17:15:07 -0000

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index