Statalist


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

Re: st: RE: Calculating binomial probability distribution of cumulative outcomes of independent events with differing values and probabilites


From   Wally Knox <[email protected]>
To   [email protected]
Subject   Re: st: RE: Calculating binomial probability distribution of cumulative outcomes of independent events with differing values and probabilites
Date   Sun, 11 Jan 2009 15:18:06 -0800

Maarten,

Thanks for your reply. I'm unfamiliar with matrix commands but will learn. I tried running your do-file and got the
response "unrecognized command:     forvalues invalid command name" .

I agree and understand that I am just using Stata as a glorified calculator, but that is fine with me.

Wally

On Jan 11, 2009, at 11:06 AM, Maarten buis wrote:

--- Wally Knox <[email protected]> wrote:
I would like to calculate the probability distribution of the
cumulative outcomes of independent events each of which has
a different value and a different probability.  For instance, take
three events.  Event One has a probability of .9 and would
contribute 12 to the overall outcome.  Event Two has a probability
of .5 and would contribute 2 to the overall outcome.  Event Three
has a probability of .2 and would contribute 6 to the overall
outcome.
<snip>
I am told that to obtain the likely outcome of the events to multiply
their individual probabilities by their individual values and sum the
results.

The probability distribution will give you the probability of each
possible outcome, so in that case you need to multiply the
probabilities and not the probabilities with the outcomes. The
computation someone else told you to do will not give you the
probability distribution but the expected value.

There is thus no need to use Stata for computing this probability
distribution, but you can us Stata as a calculator. In the example
below I use the fact that Stata sees the value 0 as false and 1 as
true, for more on this trick see:
http://www.stata.com/support/faqs/data/trueorfalse.html .

*--------------------- begin example --------------
matrix res = J(8,5,.)
matrix colnames res = event_1 event_2 event3 Prob y
local i = 1
forvalues e1 = 0/1 {
   forvalues e2 = 0/1 {
       forvalues e3 = 0/1 {
           local p = cond(`e1', .9, .1) * ///
                     cond(`e2', .5, .5) * ///
                     cond(`e3', .2, .8)
           local y = cond(`e1', 12, 0) +  ///
                     cond(`e2', 2, 0)  +  ///
                     cond(`e3', 6, 0)
           matrix res[`i',1] =            ///
                  `e1', `e2', `e3',       ///
                  `p', `y'
           local `i++'	
       }
   }
}
matrix list res
*--------------------- end example ------------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

Hope this helps,
Maarten

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

visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515

+31 20 5986715

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



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

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index