Home Archives Search Feed Football Squares How To Use


MLB (Blue Jays @ Dodgers): Which will OCCUR FIRST during Innings 1-4?


10:10PM
Blue Jays: Score 1+ Runs or Neither Occur
@ Dodgers: Score 2+ Runs


Inputs To Solve

Distribution of Runs Scored per Inning MLB

##### User Estimates #####

p_NoRuns = .75

p_LAD_NoRuns = .72
p_LAD_1Run = .13
## Inputs Defined in the Problem
period_of_innings = 4

Method to Solve

## [1]

import numpy as np
iterations = 9999
_1st_count = 0


for i in range(iterations):
    win = False
    lad = 0
    inning = 1
    team = 'NONE'

    while not win and inning <= 4:
        tor = np.random.choice([1,0],1,p=[1-p_NoRuns,p_NoRuns])
        if tor == 1:
            win = True
            team = 'TOR'
        else:
            flip = np.random.choice([0,1,2],1,p=[p_LAD_NoRuns,p_LAD_1Run,1-(p_LAD_NoRuns+p_LAD_1Run)])
            lad += flip
            if lad >= 2:
                win = True
                team = 'LAD'
        
        inning += 1
        
    if team == 'TOR' or team == 'NONE':
        _1st_count += 1
        
    if i < 10:
        print(team)
TOR
TOR
TOR
LAD
LAD
LAD
LAD
TOR
LAD
TOR
## [2]

p_tor_orN = _1st_count/iterations

Solution

print("The probability the Blue Jays score one run before the Dodgers score 2 runs or neither happens is ~%s" % round(p_tor_orN,3))
The probability the Blue Jays score one run before the Dodgers score 2 runs or neither happens is ~0.717



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 8/22/2019






← Next post    ·    Previous post →