# Thread: Question for NorrisAlan (or anyone else good at statistics

1. Originally Posted by kidbourbon
You're a math major right? Help a kid out if you can.

What I did: go through the schedule of a given team (we'll go with the Vols), and assign to each game a probability of winning.
What I want to do with that: using the numbers I just came up with, figure out the chances that the team ends up winning [X] number of games. If we're talking the Vols, I might be looking to see what their chances of winning 8 games are, and if they're more likely (again, given my numbers) to win 6 games or 7 games.

That's it. I feel like this shouldn't be terribly hard, but I have absolutely no idea how to do it.
There may be a more clever formula for this, but the fact that each game can have a different probability takes away the greatest opportunities for really simplifying it. Regardless, it isn't hard, just a little cumbersome.

Basically to know the odds of winning x number of games out of y total games, you would multiply two quantities:

1) The odds of winning all games

by

2) The sum of the likelihood of losing all the games you need to lose divided by the likelihood of winning those games for each combination that satisfies your criterion of losing y - x games.

That second quantity might not be totally clear so I'll go into more detail. Basically if you have four games and you want to know the probability of winning three of them, you first enumerate the ways you can win three. In this case that is easy. You either lose game 1, 2, 3, or 4. So that second term would be the prob of losing game 1 divided by the prob of winning game 1 plus the prob of losing game 2 divided by the prob of winning game two plus the same for game3 plus the same for game 4. If it were the probability of winning two games out of four, now the games you need to lose come in combinations. There are 6 of them. For example, you could lose games 1 and 2. So the contribution to the sum in part 2 above for that particular combination would be (prob of losing 1*prob of losing 2)/(prob of winning 1*prob of winning 2). There would be a term in the sum for each of the six combinations of games you must lose to satisfy the condition of winning 2 of four games.

To write out the math, lets say we have a 4 game season and we want to know the probability of winning three games.

First, how many combinations is that. The answer is 4 choose 3, which is 4.

If the probability of winning game 1 is w1 and the probability of losing is l1, then the probability of winning three of four games is:

P3(4) = w1w2w3w4 * ( l1/w1 + l2/w2 + l3/w3 + l4/w4 )

On the other hand if we want to know the probability of winning 2 of 4 games, then the number of combinations is 4 choose 2, or 6. We can enumerate those as losing the following combinations, 1,2 ; 1,3 ; 1,4 ; 2,3 ; 2,4 ; 3,4. The probability becomes:

P2(4) = w1w2w3w4 * ( l1l2/w1w2 + l1l3/w1w3 + l1l4/w1w4 + l2l3/w2w3 + l2l4/w2w4 + l3l4/w3w4 )

Now, if your question is what is the probability of winning at least x games of y games, then you would just use:

P of winning at least x games of y is equal to: Sum from i = x to i = y of Pi(y)

Or, using the previous example, the probability of winning at least 2 is: P2(4) + P3(4) + P4(4).

--------------------

To give actual numbers, if there are four games and the the probabilities of winning are .2, .8, .3, and .9, then :

The prob of winning two games is 50.2%.

The prob of winning three games is 28.9%.

Note that this form should work for all numbers of games.

If it is the prob of winning one game then the terms in the sum look like l1l2l3/w1w2w3 ... Three terms per combination because you would have to have three losses.

The prob of winning zero games becomes w1w2w3w4 * (l1l2l3l4/w1w2w3w4), which reduces to the the obvious l1l2l3l4.

The prob of winning 4 games is just w1w2w3w4 since there are no losing combinations to sum over in the second portion of the probability equation.

This should be fairly straightforward in a spreadsheet but I don't like that you have to enumerate all combinations. To make sure you get them all use the following equation.

N choose r is n!/(r!(n-r)!).

2. Originally Posted by kidbourbon
If I then use the binomial theorem to compute what I need, are my numbers going to be correct? In other words, for multiple independent events with differeing probabilities for each event, it's okay to just find the mean probability, assign it as the probability for each event, and proceed accordingly?

That almost seems too easy.
No, that won't work.

3. This is actually done analytically very easily by writing some code. The nice thing is the combination sets are the same for everyone as long as they play the same number of games. All you need to do is define the probabilities you want at that point.

4. I smell an 8th maxim widget.

There may be a more clever formula for this, but the fact that each game can have a different probability takes away the greatest opportunities for really simplifying it. Regardless, it isn't hard, just a little cumbersome.

Basically to know the odds of winning x number of games out of y total games, you would multiply two quantities:

1) The odds of winning all games

by

2) The sum of the likelihood of losing all the games you need to lose divided by the likelihood of winning those games for each combination that satisfies your criterion of losing y - x games.

That second quantity might not be totally clear so I'll go into more detail. Basically if you have four games and you want to know the probability of winning three of them, you first enumerate the easy you van win three. In this case that is easy. You either lose game 1, 2, 3, or 4. So that second term would be the prob of losing game 1 divided by the prob of winning game 1 plus the prob of losing game 2 divided by the prob of winning game two plus the same for game3 plus the same for game 4. If it were the probability of winning two games out of four, now the games you need to lose come in combinations. There are 6 of them. For example, you could lose games 1 and 2. So the contribution to the sum in part 2 above for that particular combination would be (prob of losing 1*prob of losing 2)/(prob of winning 1*prob of winning 2). There would be a term in the sum for each of the six combinations of games you must lose to satisfy the condition of winning 2 of four games.

To write out the math, lets say we have a 4 game season and we want to know the probability of winning three games.

First, how many combinations is that. The answer is 4 choose 3, which is 4.

If the probability of winning game 1 is w1 and the probability of losing is l1, then the probability of winning three of four games is:

P3(4) = w1w2w3w4 * ( l1/w1 + l2/w2 + l3/w3 + l4/w4 )

On the other hand if we want to know the probability of winning 2 of 4 games, then the number of combinations is 4 choose 2, or 6. We can enumerate those as losing the following combinations, 1,2 ; 1,3 ; 1,4 ; 2,3 ; 2,4 ; 3,4. The probability becomes:

P2(4) = w1w2w3w4 * ( l1l2/w1w2 + l1l3/w1w3 + l1l4/w1w4 + l2l3/w2w3 + l2l4/w2w4 + l3l4/w3w4 )

Now, if your question is what is the probability of winning at least x games of y games, then you would just use:

P of winning at least x games of y is equal to: Sum from i = x to i = y of Pi(y)

Or, using the previous example, the probability of winning at least 2 is: P2(4) + P3(4) + P4(4).

--------------------

To give actual numbers, if there are four games and the the probabilities of winning are .2, .8, .3, and .9, then :

The prob of winning two games is 50.2%.

The prob of winning three games is 28.9%.

Note that this form should work for all numbers of games.

If it is the prob of winning one game then the terms in the sum look like l1l2l3/w1w2w3 ... Three terms per combination because you would have to have three losses.

The prob of winning zero games becomes w1w2w3w4 * (l1l2l3l4/w1w2w3w4), which reduces to the the obvious l1l2l3l4.

The prob of winning 4 games is just w1w2w3w4 since there are no losing combinations to sum over in the second portion of the probability equation.

This should be fairly straightforward in a spreadsheet but I don't like that you have to enumerate all combinations. To make sure you get gem all use e following equation.

N choose r is n!/(r!(n-r)!).

Best post in the history of the site.

This is actually done analytically very easily by writing some code. The nice thing is the combination sets are the same for everyone as long as they play the same number of games. All you need to do is define the probabilities you want at that point.
Python is supposed to be good for these sorts of things, right?* I've never messed around with Python, but I'm fairly certain it's pre-installed on my macbook and, from what I understand, it's a fairly intuitive language. I may take a stab at it.

_____________
*But, man, I wish I still had Matlab.

This is actually done analytically very easily by writing some code. The nice thing is the combination sets are the same for everyone as long as they play the same number of games. All you need to do is define the probabilities you want at that point.
Yeah, for a 12 game schedule, doing that by hand would suck more than a little.

8. My contribution to this thread:

**** statistics.

9. Originally Posted by IP
This post made me look up to confirm, but it is cue. Might have been thinking of queue. So far as I can tell, there is no English "que"
There is a queue.

10. Originally Posted by kidbourbon
Python is supposed to be good for these sorts of things, right?* I've never messed around with Python, but I'm fairly certain it's pre-installed on my macbook and, from what I understand, it's a fairly intuitive language. I may take a stab at it.

_____________
*But, man, I wish I still had Matlab.
I would gravitate toward matlab as well just because I'm more familiar. I've python scripted to call other code sand do some light math but that's about it. These are fairly simple equations so any code should breeze through it. The advantage of MATLAB is it's speed if you formulate in matrix form, which is doable here. Actually the key to making this really easy is figuring out a trick for populating those combination matrices on the fly. I bet there is a clever way of doing that but I haven't thought about it yet and I don't know if I'd see it if I did sit and think. If I have some time today I will let you know if I come up with anything.

It's less clever and more brute force, but nested for loops with logic in between might get you there. Basically populating the combination with zeros and ones for wins and losses for each x of y game scenario then ripping through the math using for loops from there (which is the most straightforward part).

11. Originally Posted by utvol0427

**** statistics.
I really don't love them either. I have to break down the statistics question every time into more simple scenarios every time to get to what, I hope, is the right answer by building back out again. That and the fact they can be used to make almost any point.

12. Sorry I am late to the party, as I was asleep through the whole thing. Because it involves combinatorial numbers, it can get a bit hairy. It is not as easy as just getting a mean games won and going with a bell curve and standard deviations, if I am not mistaken, because each game has a different weight to it.

And my studies were not in probabilities (only took a couple of courses on it). So I would trust someone else in this matter. I think TennTradition is who you want in this case.

Also, it has been 20 years and my work has involved zero mathematics since then, much to my sadness. I didn't want to get an advanced degree (lazy) and didn't want to crunch actuarial tables all day (boring), so I went into computer systems administration.

13. Just did a quick google because generating the unique n choose r combinations should be a common request. Found this, but I haven't read in detail.

14. One other note KB, I derived this assuming non-zero probabilities of winning because I'm a damn optimist. This simplified form will require you to at least give us a shot of winning.

One other note KB, I derived this assuming non-zero probabilities of winning because I'm a damn optimist. This simplified form will require you to at least give us a shot of winning.
Just did a quick google because generating the unique n choose r combinations should be a common request. Found this, but I haven't read in detail.

I would gravitate toward matlab as well just because I'm more familiar. I've python scripted to call other code sand do some light math but that's about it. These are fairly simple equations so any code should breeze through it. The advantage of MATLAB is it's speed if you formulate in matrix form, which is doable here. Actually the key to making this really easy is figuring out a trick for populating those combination matrices on the fly. I bet there is a clever way of doing that but I haven't thought about it yet and I don't know if I'd see it if I did sit and think. If I have some time today I will let you know if I come up with anything.

It's less clever and more brute force, but nested for loops with logic in between might get you there. Basically populating the combination with zeros and ones for wins and losses for each x of y game scenario then ripping through the math using for loops from there (which is the most straightforward part).
This is actually done analytically very easily by writing some code. The nice thing is the combination sets are the same for everyone as long as they play the same number of games. All you need to do is define the probabilities you want at that point.
There may be a more clever formula for this, but the fact that each game can have a different probability takes away the greatest opportunities for really simplifying it. Regardless, it isn't hard, just a little cumbersome.

Basically to know the odds of winning x number of games out of y total games, you would multiply two quantities:

1) The odds of winning all games

by

2) The sum of the likelihood of losing all the games you need to lose divided by the likelihood of winning those games for each combination that satisfies your criterion of losing y - x games.

That second quantity might not be totally clear so I'll go into more detail. Basically if you have four games and you want to know the probability of winning three of them, you first enumerate the ways you can win three. In this case that is easy. You either lose game 1, 2, 3, or 4. So that second term would be the prob of losing game 1 divided by the prob of winning game 1 plus the prob of losing game 2 divided by the prob of winning game two plus the same for game3 plus the same for game 4. If it were the probability of winning two games out of four, now the games you need to lose come in combinations. There are 6 of them. For example, you could lose games 1 and 2. So the contribution to the sum in part 2 above for that particular combination would be (prob of losing 1*prob of losing 2)/(prob of winning 1*prob of winning 2). There would be a term in the sum for each of the six combinations of games you must lose to satisfy the condition of winning 2 of four games.

To write out the math, lets say we have a 4 game season and we want to know the probability of winning three games.

First, how many combinations is that. The answer is 4 choose 3, which is 4.

If the probability of winning game 1 is w1 and the probability of losing is l1, then the probability of winning three of four games is:

P3(4) = w1w2w3w4 * ( l1/w1 + l2/w2 + l3/w3 + l4/w4 )

On the other hand if we want to know the probability of winning 2 of 4 games, then the number of combinations is 4 choose 2, or 6. We can enumerate those as losing the following combinations, 1,2 ; 1,3 ; 1,4 ; 2,3 ; 2,4 ; 3,4. The probability becomes:

P2(4) = w1w2w3w4 * ( l1l2/w1w2 + l1l3/w1w3 + l1l4/w1w4 + l2l3/w2w3 + l2l4/w2w4 + l3l4/w3w4 )

Now, if your question is what is the probability of winning at least x games of y games, then you would just use:

P of winning at least x games of y is equal to: Sum from i = x to i = y of Pi(y)

Or, using the previous example, the probability of winning at least 2 is: P2(4) + P3(4) + P4(4).

--------------------

To give actual numbers, if there are four games and the the probabilities of winning are .2, .8, .3, and .9, then :

The prob of winning two games is 50.2%.

The prob of winning three games is 28.9%.

Note that this form should work for all numbers of games.

If it is the prob of winning one game then the terms in the sum look like l1l2l3/w1w2w3 ... Three terms per combination because you would have to have three losses.

The prob of winning zero games becomes w1w2w3w4 * (l1l2l3l4/w1w2w3w4), which reduces to the the obvious l1l2l3l4.

The prob of winning 4 games is just w1w2w3w4 since there are no losing combinations to sum over in the second portion of the probability equation.

This should be fairly straightforward in a spreadsheet but I don't like that you have to enumerate all combinations. To make sure you get them all use the following equation.

N choose r is n!/(r!(n-r)!).
Called it.

16. Originally Posted by IP
This post made me look up to confirm, but it is cue. Might have been thinking of queue. So far as I can tell, there is no English "que"
Typo / auto correct / laziness.

17. Originally Posted by IP
I feel like there is a decent chance Tenny is some sort of crime boss akin to those portrayed on Justified that sort of hide in plain sight, so I wouldn't say it like that.
I am easily the least imposing / menacing person on this board, and of below-average intelligence when compared to the mean of this board's collective intellect. I may only exceed the collective average in the event that we measured BMI.

18. Originally Posted by Tenacious D
Typo / auto correct / laziness.

Nice save, Tenacious Dooley.

19. Originally Posted by utvol0427
Nice save, Tenacious Dooley.
Holy Shit. I think wars have started for much less than that.

20. Originally Posted by kidbourbon
Python is supposed to be good for these sorts of things, right?* I've never messed around with Python, but I'm fairly certain it's pre-installed on my macbook and, from what I understand, it's a fairly intuitive language. I may take a stab at it.

_____________
*But, man, I wish I still had Matlab.
A good jumping off point if you really want to learn. (Codecademy is great for getting your feet wet. Not so much for intermediate and mastery).

And yes, python and an interpreter do come pre-installed on Macs.

21. Originally Posted by utvol0427
Nice save, Tenacious Dooley.
Well done.

I would gravitate toward matlab as well just because I'm more familiar. I've python scripted to call other code sand do some light math but that's about it. These are fairly simple equations so any code should breeze through it. The advantage of MATLAB is it's speed if you formulate in matrix form, which is doable here. Actually the key to making this really easy is figuring out a trick for populating those combination matrices on the fly. I bet there is a clever way of doing that but I haven't thought about it yet and I don't know if I'd see it if I did sit and think. If I have some time today I will let you know if I come up with anything.

It's less clever and more brute force, but nested for loops with logic in between might get you there. Basically populating the combination with zeros and ones for wins and losses for each x of y game scenario then ripping through the math using for loops from there (which is the most straightforward part).
Even if I were using Matlab, I wouldn't attempt to do it as a matrix operation. I forgot those lessons long ago.

One other note KB, I derived this assuming non-zero probabilities of winning because I'm a damn optimist. This simplified form will require you to at least give us a shot of winning.
I'm a blind homer. I won't go below .15.

24. Originally Posted by utvol0427
Nice save, Tenacious Dooley.

Ooooooh

25. #sh!tjustgotreal

Page 2 of 6 First 1 2 3 4 ... Last