# "How Your Favorite Baseball Team Blows Its Money": Revisiting a FiveThirtyEight Analysis

In 2015, FiveThirtyEight published an article taking a look at one of the most common questions in baseball: does money buy success? Most major sports leagues in America have a "salary cap," a limit on the amount of money a team can spend on player salaries each year. This is used to promote parity across all teams - otherwise, teams with deep pockets could afford to sign all the top tier players, giving them a competitive advantage year after year. Major League Baseball doesn't have a salary cap though. The Los Angeles Dodgers paid their players a total of $265 million in 2015, while the Cleveland Indians had a payroll of only $59 million. So in general, FiveThirtyEight asked, does more money mean more wins?

It would appeal to our affinity for underdogs if the answer was no, but unfortunately that is not the case. The gray curve on each of those graphs is the league-wide trend in winning percentage as a function of salary. Basically, the upward slope indicates that teams with higher payrolls tend to win more games.

It's an interesting read. You'll notice that their x-axis is "standardized salary," ranging from about -2 to +2. The authors explain that "Salary and win percentage were standardized within each season to account for the league’s financial growth and changes in league competitiveness." They calculated a z-score for every team's payroll for each year. This means that for each team, they found the mean payroll for that year, subtracted it from the team's payroll, and divided by the year's standard deviation. The result is a number indicating how many standard deviations above or below the mean that team's payroll was. I wanted to look at a slightly different method for standardizing: percentiles. A percentile is a value below which a certain percentage of values lie. For example, the Dodgers had the highest payroll in the league in 2015, putting them in the 100th percentile; every other team's payroll was below theirs. The Pirates, on the other hand, had the 20th highest payroll of the 30 teams. They were in the 34th percentile.

I found some data put together by another blogger for a similar post. This data includes team-by-team payrolls and wins and losses, as well as a table mapping old teams (like the Montreal Expos) to the present-day versions (the Washington Nationals). There is also a table of official team colors that we'll use to make the final results look nice.

First of all, the data only has reliable payroll information dating back to 1985. Let's filter out all teams from before 1985, drop columns we won't be using for this analysis, and join the table to the other two.

So far so good. Next let's calculate the payroll percentiles for each year. To do that, we can group the teams by year and then use the `dplyr`

package's `percent_rank`

function.

To make the plots, we'll need a little bit of `ggplot`

magic. We will go one division at a time and create a list of plot objects, and then use the `cowplot`

package to plot them all at once.

Compare FiveThirtyEight's results, using z-scores, to mine above. They're actually pretty similar. The plots for some of the teams got "stretched" horizontally a little, which I think makes it easier to determine trends.

Let's take this a little further. Notice the grey lines on each plot. Those are all the same - the average winning percentage at each payroll rank across the entire league. Teams would obviously prefer to be above that line, meaning that given their spending they won more games than one would expect. So it seems like if we took the distance from each point to the line and averaged them, we would have one number representing each team's "bang for their buck". Once we have those, we can put the teams in order from wisest to least-wise spenders.

Let's do it!

We can see that the *Moneyball* Oakland A's come out on top by a long shot. For a detailed year-by-year breakdown of each team from 1985 to 2015, check out this cool app I made.