clock menu more-arrow no yes mobile

Filed under:

Learning R: Revisiting a claim with better data

Everyone thinks their team is horrible with the bases loaded, nobody out. Which fan base is justified?

Tampa Bay Rays v San Francisco Giants
Kevin Pillar getting ready to end a bases loaded, nobody out situation.
Photo by Thearon W. Henderson/Getty Images

Something bizarre happened to me this week while reading Chapter 5 of Analyzing Baseball Data with R. After reading and re-reading a paragraph explaining how to set up some lines of code, I thought to myself “This is confusing, I’m just going to look at the code to see what they’re doing.” In the past few weeks, I’ve become familiar enough with R that I vastly prefer it to Excel, but now, I might actually prefer it to the English language.

Okay, that might be a stretch, but it’s true that I’m getting the hang of it. In just two months, I’m now able to complete certain research tasks in about 45 minutes that previously would have taken me all day.

Last season, for instance, I looked into whether the Giants were truly bad with the bases loaded and nobody out. I think it’s true that every fan base jokes that their team will someone manage to step in a bucket when facing the baseball equivalent of an empty net, but “I regret to inform you the Giants have the bases loaded with nobody out” tweets were rampant last year.

The Giants set expectations for failure early. On April 5, the Giants were trailing the Rays 5-2 in the bottom of the eighth, but their first three batters reached base. Evan Longoria reached on an error by the second baseman. Buster Posey hit a double down the right field line. Brandon Crawford got hit by a pitch. One swing of the bat could tie the game or even give the Giants the lead.

They entered the inning with just a 13 percent chance to win, but those three events brought that up to 35 percent. Kevin Cash left Adam Kolarek in to face Gerardo Parra who struck out on four pitches, and Kevin Pillar, recently acquired from the Blue Jays rolled a double play ball to short to end the inning. The Giants left the inning with just a 3 percent chance to win.

To initially investigate this claim that the Giants always screwed up like they did against the Rays, I searched on Baseball Savant for plays matching the criteria and then I had to manually figure out what happened after this. That meant looking up game logs on Baseball Reference which took a long time and meant I couldn’t look at every team to get a baseline for what success actually looked like.

My conclusion in the linked article was that the Giants were surprisingly good with the bases loaded and nobody out, but this was based on a lot of assumptions. The biggest was that it felt like the Giants always failed to come through because they failed a lot. However, they succeeded a lot. Simply put, they got into a ton of bases loaded, nobody out situations. Only the Royals, Rangers, and Angels wound up creating more of these opportunities.

Another assumption I made was that the Brewers were the worst team in these situations. At the time, the Brewers were 1-for-15 with bases loaded, nobody out and they had hit into three double plays where a runner was thrown out at home.

Now that I know how to use R to search through Retrosheet files, I was able to go back and revisit this idea. It turns out that I was sort of right about the Giants being surprisingly good with the bases loaded, nobody out, but I was also wrong about some things.

It’s true that the Giants got into a lot of these situations, but they were ever so slightly worse than league average at coming through. On average, when a team loaded the bases with no one out, they scored at least one run 85.4 percent of the time. The Giants converted 84.3 percent of their opportunities. They weren’t as dreadful as the Pirates, Orioles, and Blue Jays, but they weren’t nearly as good the Dodgers. That’s a little unfair because no one was. The Dodgers never failed to bring at least one runner home with the bases loaded, no one out.

From that, it looks like the Giants were about average at converting the bases loaded, no one out situations, but that’s only looking at if they scored at least one run. In 2019, teams expected to score, on average, 2.32 runs with the bases loaded and nobody out. Only scoring one run could be considered a failure in this circumstance.

The Giants were expected to score 74 runs in their 32 opportunities. They scored 70, so again, they were a little worse than average, but not by a ton. The team that converted the fewest runs relative to their number of opportunities was the White Sox who had 26 chances and came away with just 45 runs when they were expected to get 60.

The Giants were good at loading the bases, but they weren’t necessarily good at capitalizing on it. They were a little worse than you’d expect, but not nearly so bad as some other teams. Thanks to R and Retrosheet, I can definitively say that the Giants were about average in this one particular out state. What wonders will next week bring?

Kenny Kelly is the managing editor of Beyond the Box Score. You can follow him on Twitter @KennyKellyWords.