French Ligue 1: How many AWAY TEAMS will WIN in the 1 PM ET French Ligue 1 matches? (6 matches)
Inputs To Solve
##### User Estimates #####
p_away = [1/6, 1/7.7, 1/3, 1/2.85, 1/3.85, 1/2.2]
count = 1
for p in p_away:
print("The probability that away team " + str(count) + " wins is %s" % round(p,3))
count +=1
The probability that away team 1 wins is 0.167
The probability that away team 2 wins is 0.13
The probability that away team 3 wins is 0.333
The probability that away team 4 wins is 0.351
The probability that away team 5 wins is 0.26
The probability that away team 6 wins is 0.455
## Inputs Defined in the Problem
away_teams_win = 1
Method to Solve
- [1] Enumerate all the possible combinations of AWAY TEAMS WINNING and their probabilities.
- [2] Sum the probabilities for all the combination’s outcomes where the total number of AWAY WINS is less than or equal to 1 (p_away0or1).
## [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,f) for a in win for b in win for c in win for d in win for e in win for f in win])
K = pd.DataFrame(y)
K['total_Ws'] = K.sum(axis=1)
K.head()
0 | 1 | 2 | 3 | 4 | 5 | total_Ws | |
---|---|---|---|---|---|---|---|
0 | 1 | 1 | 1 | 1 | 1 | 1 | 6 |
1 | 1 | 1 | 1 | 1 | 1 | 0 | 5 |
2 | 1 | 1 | 1 | 1 | 0 | 1 | 5 |
3 | 1 | 1 | 1 | 1 | 0 | 0 | 4 |
4 | 1 | 1 | 1 | 0 | 1 | 1 | 5 |
# Compute the probability of all possible combinations AWAY TEAMS WINNING
x = np.array([(a,b,c,d,e,f) for a in [p_away[0],1-p_away[0]] for b in [p_away[1],1-p_away[1]] for c in [p_away[2],1-p_away[2]]
for d in [p_away[3],1-p_away[3]] for e in [p_away[4],1-p_away[4]] for f in [p_away[5],1-p_away[5]]])
probability = pd.DataFrame(x)
probability['p'] = probability.product(axis=1)
probability.head()
0 | 1 | 2 | 3 | 4 | 5 | p | |
---|---|---|---|---|---|---|---|
0 | 0.166667 | 0.12987 | 0.333333 | 0.350877 | 0.25974 | 0.454545 | 0.000299 |
1 | 0.166667 | 0.12987 | 0.333333 | 0.350877 | 0.25974 | 0.545455 | 0.000359 |
2 | 0.166667 | 0.12987 | 0.333333 | 0.350877 | 0.74026 | 0.454545 | 0.000852 |
3 | 0.166667 | 0.12987 | 0.333333 | 0.350877 | 0.74026 | 0.545455 | 0.001022 |
4 | 0.166667 | 0.12987 | 0.333333 | 0.649123 | 0.25974 | 0.454545 | 0.000553 |
## [2]
p_away_0or1 = round(probability['p'][K['total_Ws']<=away_teams_win].sum(),3)
Solution
print("The probability that 0 or 1 AWAY TEAMS WIN is ~%s" % p_away_0or1)
The probability that 0 or 1 AWAY TEAMS WIN is ~0.453
Info
download markdown file
email: krellabsinc@gmail.com
twitter: @KRELLabs
import sys
print(sys.version)
3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
Posted on 2/5/2020