Tuesday, March 31, 2009

Have Two Baseball Games Ever Played Out Identically?

A few year's back, one of my brothers asked this intriguing question while the two of us played a game of chess: considering the centuries of history that the game of chess has enjoyed the world over, and the millions upon millions of games that must have been played over that time, it seems likely, maybe even definite, that the game we were playing at that moment had been played at least once before at some point in history. Every move that we made from the first move to the last had, in all likelihood, played out in that exact same order by someone else, years or centuries before. It was a fascinating observation that really got me thinking - kind of the "if a tree falls in a forest..." question for nerdy gamers.

Well, a few months back, while pondering how spoiled we are to live in a world of Baseball Reference & Retrosheet, it occurred to me that, with the decades of baseball games under our belts, there might be two games that played out identically. In other words, are there any two games in baseball history that, if I were to pick up the scorecards for each, they would be indistinguishable? Granted, one century of baseball games (and only 50 years of Retrosheet data) is not quite the same as the five centuries of worldwide recreational play that chess as seen, but it still seemed at least possible to find a pair of identical ballgames among all those seasons. And since the Retrosheet data is all there, ready to be queried, it just seemed irresponsible not to go digging.

After getting a new faster laptop with a bigger hard drive a couple of weekends back, I was finally able to follow Colin Wyers' instructions for Creating a Retrosheet Database. It's a great, simple set of instructions that helps you get everything that you need to play around with Retrosheet's play-by-play data. If anyone is interested in that kind of thing, you owe it to yourself to read Colin's piece and get started. Be aware that running queries on a full Retrosheet database can take an incredibly wrong time, even on a fast computer.

Anyhow, with the Retrosheet database installed and ready to go on my computer, I decided to take some time this weekend to explore this question. The short answer to the question is, of course, no, there are not two games in the Retrosheet era of baseball history that played out identically. If you think about the numbers involved, it's not surprising in the least: with at least a dozen possible standard outcomes available for each plate appearance (and another dozen or more possible, but highly unlikely outcomes), and with 60 or 70 or even 80 plate appearances per game, the odds become fantastic that two games would be identical. Since there's only 100,000 or so games in the Retrosheet era, it is by no means surprising that I couldn't find any matching games. Below, I describe the methods that I took to come to this (non-)conclusion and explore some of the results. I know the answer may be slightly dull, but the journey there was still pretty interesting.

Like I said above, running a query on the full Retrosheet database can take an exceptionally long period of time, so the first thing I needed to do was to cut that list down to a more manageable number of games. I did this by looking at every game in the database and finding any games that had identical end-game statistics to it. If two games had the same number of innings played and identical home- and road- runs, hits, errors, and men left-on-base, I marked them as a unique pair. There were 3,479 such pairs of games.

Next, I went through each pair of games found above and counted the number of "events" (mostly plate appearances, though there are some other events that can sneak in there) in each. From there, if the two games in a given pair were found to have the same number of events in them, I set them aside for further study. After all, in order for two games to have played out identically, they must have the same number of events (batters, baserunners, etc). This left me with 608 pairs of games, all of which had the same number of home- and road-runs, hits, errors, men left-on-base and the same number of events and innings played as their pairing. If there ever had been two identical games played in baseball history, that pair of games would be somewhere on this list.

Finally, the last step was to take this list and match each paired game up, event for event. Ideally, we would find a pair of games that has every event in Game A match up with the same event in Game B - that is, if the first at-bat in Game A was a 5-3 groundout to third, then the first at-bat in Game B would be too, and so on, from the top of the first to the bottom of the ninth (and beyond). This query would be the moment of truth, telling us if there were any identical games and, if not, what games might be the closest.

I know, I've already ruined the surprise, but there are no two games (in the Retrosheet era, at least) that played out identically.

This may not be a surprise to some, as the odds were never in favor of it happening, but I'm still a little disappointed and surprised. "Disappointed" because, despite my knowledge of basic probabilities, I still was hoping to find something interesting. And "surprised" because, even without finding two identical games, I still expected to find a pair or two with significant similarities, and this just didn't really happen. Below are the ten "most identical" pairs of games in baseball history, as judged by the percentage of identical events between the two games.

PHI 0 @ CIN 1 (4/29/98) & CLE 0 @ DET 1 (10/1/70)
Num. of Events: 57 Num. of Similar Events: 10 Pct. of Similar Events: 18%

NYM 4 @ CIN 3 ( 6/3/94) & CAL 4 @ MIN 3 (4/17/85)
Num. of Events: 70 Num. of Similar Events: 12 Pct. of Similar Events: 17%

ARI1 @ SD 3 (8/27/07) & CHC 1 @ LAD 3 (5/21/69)
Num. of Events: 64 Num. of Similar Events: 11 Pct. of Similar Events: 17%

WAS 2 @ FLA 5 (7/14/07) & SD 2 @ MON 5, 8/18/89
Num. of Events: 68 Num. of Similar Events: 10 Pct. of Similar Events: 15%

COL 1 @ NYY 2 (6/8/04) & CAL 1 @ BAL 2 (9/26/65)
Num. of Events: 67 Num. of Similar Events: 10 Pct. of Similar Events: 15%

MIN 1 @ CAL 5 (5/5/96) & LAD 1 @ ATL 5 (5/11/68)
Num. of Events: 70 Num. of Similar Events: 10 Pct. of Similar Events: 14%

TEX 5 @ BAL 1 (8/16/75) & CAL 5 @ CHI 1 (9/10/72)
Num. of Events: 70 Num. of Similar Events: 9 Pct. of Similar Events: 13%

DET 2 @ CLE 5 (8/15/07) & PHI 2 @ SD 5 (7/6/94)
Num. of Events: 69 Num. of Similar Events: 9 Pct. of Similar Events: 13%

TBD 1 @ BOS 2 (8/14/07) & CHC 1 @ STL 2 (9/28/97)
Num. of Events: 68 Num. of Similar Events: 9 Pct. of Similar Events: 13%

NYM 5 @ STL 1 (8/16/77) & NYM 5 @ SD 1 (5/29/71)
Num. of Events: 78 Num. of Similar Events: 9 Pct. of Similar Events: 12%

If I were to list each of the "similar events" from each pair of games, you would see that the most common outcome of identical events is the strikeout (I can provide that list to anyone interested). Again, this makes a lot of sense: with balls-in-play, there are at least a dozen different outcomes for the batted ball, from a base hit to a 5-4-3 doube play and more. However, with a strikeout, all that variance disappears and the pure result is recorded. I suspect that if I broke each at-bat down to it's more basic outcome (ie, "groundout" vs "4-3" or "flyball" vs "8"), then I would find many more matching events. I worry that this would distract some from the overall goal of finding identical games, but I think it's a worthwhile exploration. I've tried to come up with other ways to compare two games for similarities, but I haven't been able to think of anything else.

If anyone can come up with some other ways that I might want to compare two similar games for the purposes of finding the "most identical games in baseball history", I'm all ears. In the meantime, I hope you found this exploration at least a little interesting. I imagine I'll have a little more information on these "somewhat" identical games in the days to come, starting with the most common score in baseball history and going from there.

Update: This post has gotten a lot of attention, so I figured I'd repeat here what I wrote over at Baseball Think Factory yesterday:
I think I'm definitely going to run this list a couple of more times, though. First off, the "hit" data (ie, single, double, etc) in the retrosheet file is very specific ("S9" means single to right, "D8" means double to center, etc), so when I'm matching the hits, they have to be perfectly identical to match. I think that's a little more precise than I need to be.

And that may also go for the outs. Does a 6-3 putout need to match another 6-3 putout to be considered identical, or can I just lump it as a "groundout" and have it match any other "groundout"? I mentioned that at the end of the article, but I think I definitely need to explore it. Plus, I need to sanitize the event data a little, too, to get rid of remarks like "63!".

Finally, somebody commented on the piece that it might be interesting to see the games that have identical line scores across the 9 innings of play. I might run that too, just to see what it finds.

Still, for this level of precision (which is admittedly a little too high), it's pretty obvious that there aren't a whole lot of games that played out very similarly. I'm sure I'll find a larger number of similar games as I lower the precision, but I doubt I'll find anything as identical as I was hoping.


tHeMARksMiTh said...

Wow, you ... uh ... have a lot of time on your hands, but I'm glad you do. Nice.

Scott said...

Perhaps you could do something with line scores. I'm sure there have been some identical line score games- any 1-0 walkoff game, for starters- but I wonder how many, which are most common, etc, etc...

Ron Rollins said...

Good stuff.

henry said...

Is someone going to volunteer to take a cut at either:

a) computing the theoretical probability of identical games, or

b) estimating it by simulation,

or am I supposed to sit here at my desk doing work while the idea slowly gnaws at the back of my brain?

if you'll pass along the data at the next-to-last step (the 608 pairs) i'd like to see how far you have to loosen 'identical' until you get somewhere. is it enough to call all 5-3's and 6-3's 'groundouts', or do you have to lump all outs and all hits together?

lar said...

Mark & Ron, thanks. Glad you enjoyed it. I wish it proved a little more fruitful, though.

Scott, that's a good idea. I think I'll have to run that just to see the results.

And Henry, I'll be more than happy to pass the info along. I'm at work now, so it'll have to be tonight sometime. I wonder that myself, about how much I have to loosen the precision before you can find something interesting. Rating outs as "groundouts" or "flyouts" is the first step. I hope that can find something cool. After that, it all depends. Your suggestion of "generic hit" and "generic out" may have to do, but I'd hope to find something before that.

Then again, if even that level of precision doesn't find anything, that might be a pretty interesting find in and of itself.

Paul said...

This was an awesome article. Great question, great research, great presentation. You're doing good work here, wezen-ball. I'm a fan.

Anonymous said...

If two games were identical up to the 9th inning, then diverged wildly, I'd consider them extremely similar, but they wouldn't show up in your study because the end totals would be different. It might be interesting to find out which two games had the longest identical starts, regardless of what happened in the rest of the game. Gerry

lar said...

That's a great point, Gerry. When I first approached this problem, I was pretty optimistic that I'd find something meaningful or interesting, so I didn't look at it from that perspective. Now that I've done this first pass-through of the Retrosheet-era games, though, I definitely plan on revisiting the games from a different perspective. Your suggestion is one to add to the list. Thanks.

Jason @ IIATMS said...

Signs that the blog you are reading was written by a single guy with no kids or other "encumberances":

Exhibit 1: this article!

Great work, Lar. I stand and salute your efforts and abilities.

Josh said...

Nicely done!


Creston said...

Love the research, but I think the odds are so astronomically huge that they can, for all purposes, be considered to be zero, right?

I mean, let's have a look at the first batter, and what can happen.

He can :

- Walk. (1)
- Strikeout. (1)
- Fly out to every 9 players. (9)
- Get thrown out at first base by every infielder (5)
- Made out by the first baseman. (1).
- Hit a single, double, triple or homerun. (4)

And now it gets funny.

- He can hit a single, then be thrown out trying to take second base. We'll say by the outfielders only, otherwise you get really weird stuff. So (3)
- Hit a double and get thrown out trying to take third base. (3)
- Hit a triple and get thrown out trying to take home. (3)

I'll ignore run downs as they can be considered to fall in the three above categories.

- He can be hit by a pitch. (1)
- He can be obstructed by the catcher (1)
- He can be made out by obstructing someone (1)
- He can be made out by illegal baserunning (or whatever it's called, running into the ball.) (1)

- He can reach base on an error by any one of 9 players. (9)

Did I miss anything? Probably, but that seems like a reasonable amount of options. So that's 43 possibilities.

The next batter has all these, but also has more options if the runner is on first, second or third. You add the possibility of a double play (1), a line drive catch and the runner gets picked off (1). The runner gets picked off by the pitcher (1). The runners steals a base (1). He gets caught stealing (1). He gets obstructed running the bases (1). He obstructs a fielder (1).
Then all the options where the second batter gets a hit, and the runner scores (I think that's 6, but I might be wrong)

So that's 56.

And then you start multiplying by at-bats. Even considering a potential perfect game on both sides with 27 at-bats for the visiting team, 27 at-bats for the home team with a homer in the final at-bat, that's, eh.... 43+(54^56th power)? (math was never my strong point.)


But still, love the idea and the research :)

(and the site!)

Creston said...

I think that should be 43+(52^56th power)+1. The first at-bat is the 43, and the last at-bat has one option, that of a game-winning homerun.

Eh, whatever. Like I said, I suck at math. :D

The Oriole Way said...

I'm glad that no two games are identical. Every time you go to the ballpark you're guaranteed to see something you've never seen before.

henry said...

well yeah, but you must also like it when you go to the park and see something unusual, right? identical games would be unusual -- especially because no one would realize it until after the fact.

the 'longest into the game that 2 games were identical' is the best variant i've seen so far, i think.

Eric said...

What about looking at the following games:

7-18-99 NYA-MON
5-17-98 NYA-MIN
7-28-94 TEX-CAL
9-16-88 CIN-LAD
5-15-81 CLE-TOR
5-08-68 OAK-MIN
9-09-65 LAD-CHN

9-30-84 CAL-TEX
5-18-04 ARI-ATL
7-28-91 MON-LAD
6-21-64 PHI-NYN

These are all of the official perfect games in the retrosheet era. They are grouped by whether it was the home team [group 1] or the visiting team that pitched the shutout.

These games [within groups] should be atleast 50% matching.

henry said...

i think they're 50 % matching if you lump all outs together -- if you distinguish between k's, GB, FB or worse, by method of put-out, that % will decline.

Eric said...
This comment has been removed by the author.
lar said...

Well, Eric, they're 50% matching in that each at-bat ended in an out. Anything more precise than that leaves a lot of room for matches.

Thanks for listing all those possible outcomes, Creston. It certainly does a good job of showing just how crazy this all is (I had considered a lot of those, but, until you go and list them, you never really realize how many it truly is). That's something I fully understand and appreciate. I was just hoping to find the two identical snowflakes/fingerprints/etc among thousands.

It's not likely at all (and may even be practically impossible), but just think of how *incredibly* cool it would have been to find that it was true. That's what I was hoping for. ... I'm shooting for the stars, I suppose.

For those who may not have noticed, I made a short update to the post above, describing why I'll be re-visiting this soon, and just what tacts I might take.

brianjkoscuiszka said...

Can you define "event"? I'm just curious as to how you arrived at the numbers you did, since you said it wasn't simply PAs. Were you simply adding things like pick-offs, SBs, and CSs? I can't think of anything else that would qualify, but am curious if I am missing something.

Anonymous said...

You mentioned that the most-likely single event at the current level of specificity is the strikeout. So I would guess that the best candidates for "most similar" games would be the handful of 18-20 strikeout games in MLB history. The ordering of events matters less when 2/3 of the outs are identical.

Anonymous said...

In my post a moment ago I was only thinking about one team's strikeouts. I would guess that if you found the 2 games with the highest strikeout total between the two teams, even if their hits and runs were quite unequal, you'd still get higher similarity score across events than you find in your subsample of games with identical game totals.

lar said...

Anon, I used "event" because that's how Retrosheet defines their play-by-play data. For the most part, these come down to plate appearances. but if something goes on that needs to be recorded but isn't a complete plate appearance, that still needs to show up. For the most part, I believe, that comes down to just a stolen base or caught stealing, but anything else along those lines would show up as an "event" (a balk, maybe. I'm sure there are others - i'm not a full-on Retrosheet expert yet).

As for the strikeouts being the most common similar event, I think that's a result of my precision, like I explained in the "Update". Two singles might show up in the same part of the game (leading off the game, or something), but I wasn't finding them because I was looking for matching "single to right" events, or "double to left that the runner from first scores on". With that kind of precision, it's exceedingly difficult to match.

My next step will be to look for more general events (matching "singles" or matching "groundouts", for example). Hope that answers your question.

Anonymous said...

Lar, thanks for your thoughtful response. If my comment sounded critical, it wasn't intended that way. I should have started by saying that your post was a great bit of analysis that had me thinking all day.

I also should have said yesterday that my "look for lots of strikeouts" suggestion was sort of cheating; I did say in the first part that it would lead to the highest scores "based on the current level of specificity". If there are more total groundouts than strikeouts, then once you switch to the lower specificity, the most similar games might be pairs of games with great sinker-ballers.

Regardless of how you define your events, you'll be looking for matches where both games have the same event in the same position - let's say the first batter of each game. In a simulation scenario, the most likely way for that first event to match is for both games to start with the event that is statistically most likely.

For the current specificity, that's the strikeout. I compared Kerry Wood's and Roger Clemons' first 20-K games, and both started with 4 straight strikeouts (home pitcher strikes out the side, visiting pitcher strikes out first batter). That isn't so surprising given that 30/61 batters struck out in the Wood game and 25/64 in the Clemons game. So even if you change the event definitions, pitcher-influenced events like strikeouts will probably be predictive of "very similar" games.