German Bundesliga: How many HOME TEAMS will WIN in the 9:30 AM ET Bundesliga matches? (5 Matches)
9:30AM
2 or Fewer
3 or More
Inputs Needed to Solve
##### User Estimates #####
p_home = [1/1.53, 1/2.09, 1/2.67, 1/1.5, 1/2.08]
count = 1
for p in p_home:
print("The probability that HOME Team " + str(count) + " wins is %s" % round(p,3))
count +=1
The probability that HOME Team 1 wins is 0.654
The probability that HOME Team 2 wins is 0.478
The probability that HOME Team 3 wins is 0.375
The probability that HOME Team 4 wins is 0.667
The probability that HOME Team 5 wins is 0.481
## Inputs Defined in the Problem
home_teams_win = 2
Method to Solve
- [1] Enumerate all the possible combinations (2^5) of HOME TEAMS WINNING and their probabilities.
- [2] Sum the probabilities for all the combination’s outcomes where the total number of HOME WINS is less than or equal to 2 (p_home2).
## [1]
import numpy as np
import pandas as pd
# Enumerate all possible combinations of AWAY TEAMS WINNING
win = [1,0]
y = np.array([(a,b,c,d,e) for a in win for b in win for c in win for d in win for e in win])
K = pd.DataFrame(y)
K['total_Ws'] = K.sum(axis=1)
K.head(10)
0 | 1 | 2 | 3 | 4 | total_Ws | |
---|---|---|---|---|---|---|
0 | 1 | 1 | 1 | 1 | 1 | 5 |
1 | 1 | 1 | 1 | 1 | 0 | 4 |
2 | 1 | 1 | 1 | 0 | 1 | 4 |
3 | 1 | 1 | 1 | 0 | 0 | 3 |
4 | 1 | 1 | 0 | 1 | 1 | 4 |
5 | 1 | 1 | 0 | 1 | 0 | 3 |
6 | 1 | 1 | 0 | 0 | 1 | 3 |
7 | 1 | 1 | 0 | 0 | 0 | 2 |
8 | 1 | 0 | 1 | 1 | 1 | 4 |
9 | 1 | 0 | 1 | 1 | 0 | 3 |
# Compute the probability of all possible combinations AWAY TEAMS WINNING
x = np.array([(a,b,c,d,e) for a in [p_home[0],1-p_home[0]] for b in [p_home[1],1-p_home[1]] for c in [p_home[2],1-p_home[2]]
for d in [p_home[3],1-p_home[3]] for e in [p_home[4],1-p_home[4]]])
probability = pd.DataFrame(x)
probability['p'] = probability.product(axis=1)
probability.head(10)
0 | 1 | 2 | 3 | 4 | p | |
---|---|---|---|---|---|---|
0 | 0.653595 | 0.478469 | 0.374532 | 0.666667 | 0.480769 | 0.037540 |
1 | 0.653595 | 0.478469 | 0.374532 | 0.666667 | 0.519231 | 0.040543 |
2 | 0.653595 | 0.478469 | 0.374532 | 0.333333 | 0.480769 | 0.018770 |
3 | 0.653595 | 0.478469 | 0.374532 | 0.333333 | 0.519231 | 0.020272 |
4 | 0.653595 | 0.478469 | 0.625468 | 0.666667 | 0.480769 | 0.062692 |
5 | 0.653595 | 0.478469 | 0.625468 | 0.666667 | 0.519231 | 0.067707 |
6 | 0.653595 | 0.478469 | 0.625468 | 0.333333 | 0.480769 | 0.031346 |
7 | 0.653595 | 0.478469 | 0.625468 | 0.333333 | 0.519231 | 0.033854 |
8 | 0.653595 | 0.521531 | 0.374532 | 0.666667 | 0.480769 | 0.040919 |
9 | 0.653595 | 0.521531 | 0.374532 | 0.666667 | 0.519231 | 0.044192 |
## [2]
p_home2 = probability['p'][K['total_Ws']<=home_teams_win].sum()
Solution
print("The probability that 2 or Fewer HOME TEAMS WIN is ~%s" % round(p_home2,3))
The probability that 2 or Fewer HOME TEAMS WIN is ~0.441
Info
download markdown file
email: krellabsinc@gmail.com
twitter: @KRELLabs
import sys
print(sys.version)
2.7.12 |Anaconda 4.2.0 (64-bit)| (default, Jun 29 2016, 11:07:13) [MSC v.1500 64 bit (AMD64)]
Posted on 2/8/2020