MLB (Rays @ Yankees): Will there be a HOME RUN hit during INNINGS 1-3?
7:05PM
Yes: 1+ HR hit during Innings 1-3
No: 0 HR hit during Innings 1-3
Inputs To Solve
##### User Estimates #####
Rays_HRperGame = 1.31
Yankees_HRperGame = 1.66
expected_total_HRs = Rays_HRperGame + Yankees_HRperGame
print("Use %s + %s = %s as total expected HRs to be hit for the game."
% (Rays_HRperGame,Yankees_HRperGame,round(expected_total_HRs,2)))
Use 1.31 + 1.66 = 2.97 as total expected HRs to be hit for the game.
## Inputs Defined in the Problem
period_of_innings = 3
HRs_hit = 0
Method to Solve
- Estimate lambda (expected arrival rate of HRs)
- Use Poisson Distribution to estimate the probability of zero HRs being hit in any three innings:
lambda_ = expected_total_HRs * period_of_innings / 9
print("lambda = the total expected HRs hit by both teams over three innings")
print("lambda = %s * %s / %s" % (round(expected_total_HRs,2),period_of_innings,9))
print("lambda ~ %s" % (round(lambda_,2)))
lambda = the total expected HRs hit by both teams over three innings
lambda = 2.97 * 3 / 9
lambda ~ 0.99
import math
zero_ = math.exp(-lambda_)*(lambda_**HRs_hit)/(math.factorial(HRs_hit))
print("The probability of k events occurring in an Poisson interval = e^(-lambda) * (lambda^k)/k!")
print('where k = 0')
print('')
print("p = e^(-%s) * (%s^%s)/%s!" % (round(lambda_,2),round(lambda_,2),HRs_hit,HRs_hit))
The probability of k events occurring in an Poisson interval = e^(-lambda) * (lambda^k)/k!
where k = 0
p = e^(-0.99) * (0.99^0)/0!
Solution
print("The probability of zero HRs being hit in a three innings interval is ~ %s" % (round(zero_,3)))
The probability of zero HRs being hit in a three innings interval is ~ 0.372
Posted on 7/16/2019