MLB (Angels @ Athletics): How many EXTRA-BASE HITS will be recorded during Innings 6-8?
5:30PM
2 XBH or Fewer
3 XBH or More
Inputs To Solve
##### User Estimates #####
LAA_XperG = (240+17+197)/140
OAK_XperG = (246+19+219)/138
# 2b + 3b + hr / games
expected_total_Xs = LAA_XperG + OAK_XperG
print("Use %s + %s = %s as total observed XBH be in a game." % (round(LAA_XperG,3),round(OAK_XperG,3),round(expected_total_Xs,3)))
Use 3.243 + 3.507 = 6.75 as total observed XBH be in a game.
## Inputs Defined in the Problem
period_of_innings = 3
XBH = [0,1,2]
Method to Solve
- [1] Estimate lambda_xbh - expected arrival rate of XBH for 3 Innings
- [2] Use the Poisson Distribution to compute the probability of 0, 1, or 2 XBH being recorded during Innings 6-8 (p_2orless)
## [1]
lambda_xbh = expected_total_Xs * period_of_innings / 9
print("lambda_xbh = the total expected XBH over %s innings" % period_of_innings)
print("lambda_xbh = %s * %s / %s" % (round(expected_total_Xs,3),period_of_innings,9))
print("lambda_xbh ~ %s" % (round(lambda_xbh,3)))
lambda_xbh = the total expected XBH over 3 innings
lambda_xbh = 6.75 * 3 / 9
lambda_xbh ~ 2.25
## [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]")
print(' ')
p_2orless = 0
for i in XBH:
p_2orless += math.exp(-lambda_xbh)*(lambda_xbh**(i))/(math.factorial(i))
if(i<=1):
str_ += str(round(math.exp(-lambda_xbh)*(lambda_xbh**(i))/(math.factorial(i)),3)) + " + "
print("e^(-%s) * (%s^%s)/%s! + " % (round(lambda_xbh,2),round(lambda_xbh,2),(i),(i)))
else:
str_ += str(round(math.exp(-lambda_xbh)*(lambda_xbh**(i))/(math.factorial(i)),3))
print("e^(-%s) * (%s^%s)/%s!" % (round(lambda_xbh,2),round(lambda_xbh,2),(i),(i)))
print('')
print('p_2orless = ' + str_)
The probability of k events occurring in a Poisson interval = e^(-lambda) * (lambda^k)/k!
where k = [0,1,2]
e^(-2.25) * (2.25^0)/0! +
e^(-2.25) * (2.25^1)/1! +
e^(-2.25) * (2.25^2)/2!
p_2orless = 0.105 + 0.237 + 0.267
Solution
print("The probability that 2 XBH or Fewer are recorded during Innings 6-8 is ~%s" % round(p_2orless,3))
The probability that 2 XBH or Fewer are recorded during Innings 6-8 is ~0.609
Info
download md 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 9/5/2019