Open Side Menu Go to the Top
Register
3-event probability question 3-event probability question

06-23-2015 , 11:52 AM
I'm not sure if this is exactly the right forum for this, but it seems like the closest.

I'm trying to figure out the formula (or, alternatively, a brute-force through Excel) method for the following problem:

An event can happen with an outcome of either A, B, or C (with probabilities Pa, Pb, Pc). C is essentially a "null event" and might be a red herring for me that I'm just too dumb to see.

What I'm trying to calculate is, given a number of iterations of that event happening, the relative chance that result A occurs more frequently, less frequently, and the same number of times as, event B.

(For context, imagine this as a soccer game where:

result A = team A scores
result B = team B scores
result C = an iteration of the event is counted off but neither team scores)

and I want to know, given a fixed Pa, Pb, Pc, how the number of iterations of the event affects the chance of team A or team B winning.)

Assume that Pa, Pb, Pc are fixed regardless of the number of iterations (i.e. the current "score" doesn't matter at all).
3-event probability question Quote
06-23-2015 , 11:52 AM
And yes, I don't know if I explained that clearly, but ask questions and I'll get there eventually.
3-event probability question Quote
06-23-2015 , 12:34 PM
For a given Pa, Pb, Pc, you can straightforwardly enumerate all of the possible combinations of outcomes and their probability of occurring. Say in Excel or any other programming environment. So you can tally the prob of number of A's exceeding B's, equaling B's, or less than B's. (I am sure you probably know or can easily determine the probs, but google Multinomial distribution if you want.)

Of course, the combinations grow large pretty quickly so this approach is best suited to small "samples".

I don't know if that helps or not.
3-event probability question Quote
06-23-2015 , 12:57 PM
The largest sample of event sizes I'd need is 10.

I'd be happy to brute force it in Excel but the method to do so is escaping me. (I can brute force it for 2 iterations easily enough, of course, but that doesn't really help much.)
3-event probability question Quote
06-23-2015 , 01:41 PM
Unless I'm overlooking something, this is just binomial distribution.

Take Pc out of the equation as follows:
Let p = Pa/(Pa+Pb)
Let q = Pb/(Pa+Pb)

Suppose the event will be iterated until outcomes A and B have happened a combined total of N times.

Then P(more outcome A than B) = sum from k=floor[n/2+1] to k=n of
C(N,k) * p^k * q^(N-k)
(But in Excel you'd just use the binomdist function.)

If you're only iterating the event N times (as opposed to repeating until N non-C outcomes), it's a little different and I can attempt that if you want.
3-event probability question Quote
06-23-2015 , 02:23 PM
Actually I wanna try that other variant anyway. My first idea is as follows.

Let R be the number of non-C outcomes.

Then P(R=r) = C(N,r) * (Pa+Pb)^r * (Pc)^(N-r)

If R=r then P(A>B) = the previous sum but with r's instead of N's.

Overall, P(A>B) will be a double-summation.

P(A>B) =
sum from r=1 to r=N of
sum from k=floor[r/2+1] to k=r of
[C(N,r) * (Pa+Pb)^r * (Pc)^(N-r)] * [C(r,k) * p^k * q^(r-k)]

I'm pretty sure that would work, but maybe there's a nicer way.

Last edited by heehaww; 06-23-2015 at 02:42 PM. Reason: Product of those binomials. Forgot the stuff in the first set of brackets in the product.
3-event probability question Quote
06-23-2015 , 02:26 PM
The above is what first came to mind for me. I suppose it's also possible to work an equivalent summation using the multinomial directly
3-event probability question Quote
06-23-2015 , 02:45 PM
Haha wow, I really might be your clone. I just returned to try it the multinomial way. I'll edit this post once I do. Already, after editing my last post, I notice that C(N,r)*C(r,k) is a trinomial coefficient, so I wonder if the trinomial approach won't result in the same exact expression.

Edit: oh wait, I messed up in previous post. Some stuff should be pulled before the 2nd summation. It should be:

P(A>B) =
sum from r=1 to r=N of
C(N,r) * (Pa+Pb)^r * (Pc)^(N-r) * sum from k=floor[r/2+1] to k=r of
C(r,k) * p^k * q^(r-k)

Edit #2: And now here's the trinomial approach.

sum from r=1 to r=N of
(Pa+Pb)^r * (Pc)^(N-r) * (N!/r!) * sum from k=floor[r/2+1] to k=r of
p^k * q^(r-k) / k! / (r-k)!

Different expression but should be algebraically equivalent if I did it right. Not really better or worse.

Last edited by heehaww; 06-23-2015 at 03:01 PM.
3-event probability question Quote
06-23-2015 , 03:19 PM
But you don't know N. It could be anything from 0 to the total number of Iterations.

I thought that was part of the challenge.

(Maybe I am being obtuse.)
3-event probability question Quote
06-23-2015 , 03:25 PM
Quote:
Originally Posted by heehaww
Edit #2: And now here's the trinomial approach.

sum from r=1 to r=N of
(Pa+Pb)^r * (Pc)^(N-r) * N!/(N-r!) * sum from k=floor[r/2+1] to k=r of
p^k * q^(r-k) / k! / (r-k)!
Fmp. Edit: no, now it's right.
Now we have N! / [(N-r)! * k! * (r-k)!] which is equal to C(N,r) * C(r,k)

Quote:
Originally Posted by whosnext
But you don't know N. It could be anything from 0 to the total number of Iterations.

I thought that was part of the challenge.
Quote:
Originally Posted by OP
and I want to know, given a fixed Pa, Pb, Pc, how the number of iterations of the event affects the chance of team A or team B winning.)
My formula gives the chance of Team A winning given the #iterations N. If he varies N, he'll get to see how N affects A's chance of winning.

Last edited by heehaww; 06-23-2015 at 03:50 PM. Reason: My "fmp" was wrong too.
3-event probability question Quote
06-23-2015 , 03:51 PM
Quote:
Originally Posted by heehaww
Unless I'm overlooking something, this is just binomial distribution.

Take Pc out of the equation as follows:
Let p = Pa/(Pa+Pb)
Let q = Pb/(Pa+Pb)

Suppose the event will be iterated until outcomes A and B have happened a combined total of N times.

Then P(more outcome A than B) = sum from k=floor[n/2+1] to k=n of
C(N,k) * p^k * q^(N-k)
(But in Excel you'd just use the binomdist function.)

If you're only iterating the event N times (as opposed to repeating until N non-C outcomes), it's a little different and I can attempt that if you want.
Yeah, it's N times -- basically there are 10 occurrences, and either something happens, or something doesn't happen (but it counts as one of the 10).

I'll look at your other posts here shortly.
3-event probability question Quote
06-23-2015 , 03:53 PM
Hmm.

I think I can handle that -- will ask questions if I can't proceed but I think I'm at least in the ballpark.

Thanks for your help so far!
3-event probability question Quote
06-23-2015 , 04:02 PM
But do the modified-binomial formulas give the prob of more A's than B's if 10 occurrences if Pa=.25, Pb=.15, and Pc=.60?

You can probably get there but I don't think it is immediate.

P.S. I guess my point is that if yuu know Pa, Pb, Pc, and N, it is straightforward to calc all the permutations and simply tally the probs you seek
3-event probability question Quote
06-23-2015 , 09:00 PM
I just got back home and coded up the example I cited above (Pa=.25, Pb=.15, Pc=.60; N=10) in less than ten minutes in Excel and I am fairly pedestrian when it comes to spreadsheets.

Anyway, I get the respective answers to five significant digits to be:

- Prob(A>B) = .60177

- Prob(A=B) = .17637

- Prob(A<B) = .22186

Maybe this will help DWetzel in some way (presuming that these are indeed the correct probs).
3-event probability question Quote
06-25-2015 , 02:17 AM
Quote:
Originally Posted by whosnext
But do the modified-binomial formulas give the prob of more A's than B's if 10 occurrences if Pa=.25, Pb=.15, and Pc=.60
Yes. I don't use Excel anymore so I can't tell you the Excel syntax, but here it is in TI graphing calculator syntax:

sum(seq(binompdf(10,.4,R)*(1-binomcdf(R,.25/(.25+.15),iPart(R/2))),R,1,10,1))

= .6017744346

Or as a program:
Code:
Prompt N
Input "Pa = ",A
Input "Pb = ",B
Disp sum(seq(binompdf(N,A+B,R)*(1-binomcdf(R,A/(A+B),iPart(R/2))),R,1,N,1))
3-event probability question Quote
06-25-2015 , 10:34 AM
Thanks heehaww.
3-event probability question Quote
06-25-2015 , 01:29 PM
I didn't read this in detail to see exactly what your issue is, but I have a book of stats tables that predates computers and it has some multinomial tables in it. It is my favorite book, about 600 pages of just tables.
3-event probability question Quote

      
m