MLB (Phillies @ Giants): How many RUNS will be SCORED during Innings 1-3?
7:09PM
3 Runs or Fewer
4 Runs or More
Inputs To Solve
Runs per Game by Team (Phillies and Giants)
##### User Estimates #####
PHI_RperG = 4.71
SFG_RperG = 4.25
expected_total_Rs = PHI_RperG + SFG_RperG
print("Use %s + %s = %s as total expected RUNS to be SCORED in the game." % (PHI_RperG,SFG_RperG,expected_total_Rs))
Use 4.71 + 4.25 = 8.96 as total expected RUNS to be SCORED in the game.
## Inputs Defined in the Problem
period_of_innings = 3
RUNS = [0,1,2,3]
Method to Solve
- [1] Estimate lambda - expected arrival rate of RUNS for 3 Innings (lambda_)
- [2] Use the Poisson Distribution to compute the probability of 0, 1, 2 or 3 RUNS being SCORED during Innings 1-3 (p_3orless)
## [1]
lambda_ = expected_total_Rs * period_of_innings / 9
print("lambda = the total expected RUNS SCORED over %s innings" % period_of_innings)
print("lambda = %s * %s / %s" % (round(expected_total_Rs,3),period_of_innings,9))
print("lambda ~ %s" % (round(lambda_,3)))
lambda = the total expected RUNS SCORED over 3 innings
lambda = 8.96 * 3 / 9
lambda ~ 2.987
## [2]
import math
str_ = ""
print("The probability of k events occurring in a Poisson interval = e^(-lambda) * (lambda^k)/k!")
print("where k = [0,1,2,3]")
print(' ')
p_3orless = 0
for i in RUNS:
p_3orless += math.exp(-lambda_)*(lambda_**(i))/(math.factorial(i))
if(i<=2):
str_ += str(round(math.exp(-lambda_)*(lambda_**(i))/(math.factorial(i)),3)) + " + "
print("e^(-%s) * (%s^%s)/%s! + " % (round(lambda_,2),round(lambda_,2),(i),(i)))
else:
str_ += str(round(math.exp(-lambda_)*(lambda_**(i))/(math.factorial(i)),3))
print("e^(-%s) * (%s^%s)/%s!" % (round(lambda_,2),round(lambda_,2),(i),(i)))
print('')
print('p_3orless = ' + str_)
The probability of k events occurring in a Poisson interval = e^(-lambda) * (lambda^k)/k!
where k = [0,1,2,3]
e^(-2.99) * (2.99^0)/0! +
e^(-2.99) * (2.99^1)/1! +
e^(-2.99) * (2.99^2)/2! +
e^(-2.99) * (2.99^3)/3!
p_3orless = 0.05 + 0.151 + 0.225 + 0.224
Solution
print("The probability that 3 RUNS or Fewer are SCORED during Innings 1-3 is ~%s" % round(p_3orless,3))
The probability that 3 RUNS or Fewer are SCORED during Innings 1-3 is ~0.65
Posted on 8/12/2019