FREE hit counter and Internet traffic statistics from freestats.com

Thursday, October 21, 2004

How Probable Was the BoSox Comeback?

That seems to be the question on everyone's mind today. To have some fun with that question I constructed a simulator in Visual Basic .NET that plays seven games series in a 2-3-2 format. I calculated the probability of each team winning their home games using the log5 method described by Bill James in the 1981 Baseball Abstract and documented by Tom Tippett at Diamond Mind Baseball here.


A - (A * B)
WPct = -----------------
A + B - (2 * A * B)

So if TeamA played .550 ball at home and TeamB played .450 on the road the probability of TeamA winning a game at home would be .599 (.55-(.55*.45))/(.55+.45-(2*.55*.45)). Interestingly, I also found a slightly different formula by Rodney Sparapani posted this April that gives the same results.

For the 2004 season the Yankees played .704 ball at home, .543 on the road while the Red Sox played .679 at home and .531 on the road. Using the log5 formula for home games then the Yankees had a probablity of winning of .677 against the Red Sox while the Red Sox had a probability of .643 at Fenway Park against the Yankees.

I then used the random number generator to simulate the outcome of the contest and record the number of victories for each side and in how many of the them the team who did not have home field advantage (the Red Sox in this case) one the last 4 games of the series.

Drum roll please....

In 100,000 ALCS matchups the results were:

Yankees: 60,109
Red Sox: 39,891

So the Yankees win about 60% of the time and the Red Sox 40%. In those 100,000 contests the Red Sox won the series after going down 3-0 754 times or .754% of the time or once every 132 series. The Yankees took the first three games 16,701 times and so the Red Sox made their comeback 4.5% of the time. That's very close to the actual number of times that the feat has now been accomplished - 1 out of 26 or 3.8%.

As an aside the Yankees swept the series 5,789 times while the Red Sox swept it 4,269 times. Here is the complete breakdown:

In case you're interested here are the probabilities for the Red Sox facing either the Astros or Cardinals.

Red Sox versus Astros = Red Sox win 60.5% of the time
Red Sox versus Cardinals = Cardinals win 56.3% of the time

For those interested the VB .NET code to run each trial is as follows:

Module Module1

Public outcomes As New ListDictionary


Public Sub main()
outcomes.Add("40", 0)
outcomes.Add("41", 0)
outcomes.Add("42", 0)
outcomes.Add("43", 0)
outcomes.Add("04", 0)
outcomes.Add("14", 0)
outcomes.Add("24", 0)
outcomes.Add("34", 0)
Application.Run(New Form1)
End Sub

Public Function RunTrial(ByVal team1 As Team, _
ByVal team2 As Team) As Results

Randomize()

Dim team1Won, team2Won As Integer
Dim team1Home As Decimal
Dim team2Home As Decimal
Dim scores As String
' odds of team1 winning their home games
team1Home = (team1.HomeWPct - (team2.AwayWPct * team1.HomeWPct)) / _
((team1.HomeWPct + team2.AwayWPct - (2 * team1.HomeWPct * team2.AwayWPct)))
'team1Home = (team1.HomeWPct * (1 - team2.AwayWPct)) / _
' ((team1.HomeWPct * (1 - team2.AwayWPct)) + ((1 - team1.HomeWPct) * team2.AwayWPct))
' odds of team2 winning their home games
team2Home = (team2.HomeWPct - (team1.AwayWPct * team2.HomeWPct)) / _
((team2.HomeWPct + team1.AwayWPct - (2 * team2.HomeWPct * team1.AwayWPct)))

Dim i As Integer
For i = 1 To 7 '7 game series, 2,3,2

' team1 has the homefield advantage

Select Case i
Case 1, 2, 6, 7
If PlayGame(team1Home) Then
' team1 won
team1Won += 1
scores &= "1"
Else
team2Won += 1
scores &= "2"
End If
Case 3, 4, 5
If PlayGame(team2Home) Then
' team2 won
team2Won += 1
scores &= "2"
Else
team1Won += 1
scores &= "1"
End If
End Select

If team1Won = 4 Or team2Won = 4 Then
' series over
Return New Results(team1Won, team2Won, scores)
End If

Next
End Function

Public Function PlayGame(ByVal prob As Decimal) As Boolean
' choose a random number between 0 and 1
' if <= prob then game is won so return true else return false
If Rnd(1) <= prob Then
Return True
Else
Return False
End If

End Function

End Module

Public Class Team
Public Sub New(ByVal Home As Decimal, ByVal Away As Decimal, _
ByVal name As String)
HomeWPct = Home
AwayWPct = Away
TeamName = name
End Sub
Public HomeWPct As Decimal
Public AwayWPct As Decimal
Public TeamName As String
End Class

Public Class Results
Public Sub New(ByVal team1 As Integer, ByVal team2 As Integer, _
ByVal scores As String)
Team1Won = team1
Team2Won = team2
Games = scores
outcomes(team1.ToString + team2.ToString) += 1
End Sub
Public Team1Won As Integer
Public Team2Won As Integer
Public Games As String
End Class

No comments: