### Overview

Perhaps it’s a Sunday afternoon and the baseball team you root for isn’t playing because the game is rained out. You’ve got a satellite season ticket and can watch any game you want.

Or maybe you’re fed up with the team that has broken your heart for one too many seasons and want to find a new team that will at the very least entertain you.

**Note:** The fully working dashboards described here may be found at the end of this blog post.

### Which team should you watch?

The **Personal Baseball Entertainment Index** (PBEI) looks at statistics for major league teams from 2009 through the All-Star Game break in 2011 and ranks each team using 16 different metrics. You can specify which of these metrics are more important to you than others (e.g., “Triples” vs. “Walks”) and then the system will calculate a customized ranking based on your preferences.

### What the Index Tracks

There are literally hundreds of different facets of baseball that people track with mind-numbing precision and affection. Don’t believe me? Check out www.fangraphs.com. For PBEI we look at the following 16:

**Batting:**

Home Runs

Triples

Stolen Bases

Runs

Hits

Walks

Strikeouts (actually, NOT striking out)

**Pitching:**

Strikeouts

Not Allowing Hits

Earned Run Average (ERA)

Not Allowing Home Runs

Not Allowing Walks

Time Between Pitches

**Fielding:**

Errors

Preventing Stolen Bases

Turning Double Plays

### Ranking Each Statistic and Each Category

There are three major categories (Batting, Pitching, and Fielding) and within each category there are three to seven different metrics.

Each team has a ranking of between 1 and 30 inclusive for each metric. For example, over the past two and one-half seasons the Seattle Mariners are ranked 26^{th} for Home Runs while the Minnesota Twins are ranked 4^{th} for Hits.

If you weigh each of the metrics equally, the top teams in each category would be…

**Batting:**

**Pitching:**

**Fielding:**

And if you weigh all three categories equally and combine the results into a master ranking…

**Your Personal Index:**

I’m a lifelong Mets fan. Do you have any idea how painful it is to see The Phillies and Yankees at the top of this list?

Fortunately, all these metrics do NOT have to be weighed equally. Indeed, I don’t think anyone would argue that a walk is as entertaining as a triple, so let’s explore how you can apply your own weights to the rankings.

### Personalized Batting Index

If you click the Step 1 of the interactive dashboard you will see a screen that looks like this:

Notice that all the slider controls are set in the center.

Move the sliders to the right for measures that are important to you and to the left for those that are less important. If you want to exclude a measure completely, just move the slider to 0 (all the way to the left).

In the example below we rank Triples and Home Runs as most important and ignore Walks.

Note: If you hover over a bar for a particular team you can see the underlying measures and rankings:

### Personalized Pitching and Fielding Indices

The Step 2 and Step 3 tabs allow you to specify your Pitching and Fielding preferences using similar slider controls we saw in the Step 1 tab.

I do want to draw your attention to one statistic that is a bit different from the others and that is **Time Between Pitches**.

Nothing sucks the joy out of watching a baseball game quite as much as a pitcher that takes a long time between pitches so I’ve included this somewhat atypical metric in the Pitching index. Moving this slider to the right will move teams that have pitchers that work fast up the list.

**Note:** Special thanks to Lucas Apostoleris for aggregating this metric by team for the 2010 season (I do not have the statistics for 2009 and 2011 yet.)

### Putting it all Together – Your Personal Index

Once you’ve specified the relative importance of each of the 16 metrics you should click the Step 4 tab.

Here you specify the relative importance of the three main categories. In the sample below the settings indicate that Pitching is most important, followed closing by Fielding.

### Raw Data and Rankings

The final tab allows you to look at the raw statistics and rankings for each team in the three categories.

You can look at a different category by clicking the Category drop down filter.

### A Quick Peek Under The Hood

I plan to write a separate blog post that explains some of the inner workings of the underlying Tableau workbook as well as some of the design decisions. In the meantime, here’s a quick look at the logic behind the indices.

For each category I wanted to have a maximum possible score of 100. That is, if a team ranked first in every metric and the user indicated that every one of those metrics should get a “10” then the top score would be 100.

Here’s the algorithm for Fielding.

((31-[Strikeouts Rank])* User Weight /3

+ (31-[Avg Time Between Pitches Rank])* User Weight /3

+ (31-[ERA Rank]) * User Weight /3

+ (31-[HR (Pitching) Rank])* User Weight /3

+ (31-[Hits (Pitching) Rank])* User Weight /3

+ (31-[Walk (Pitching) Rank])* User Weight /3)

/(6-[Number_Pitching_Ignores])

Let’s just look at the first piece.

((31-[Strikeouts (Pitching) Rank])* User Weight Metric /3

There are 30 teams so the top ranked team would 1. 31 minus 1 = 30.

If the user indicates that this measure is of highest importance, the 30 will be multiplied by 10, giving us 300. Dividing by 3 gives us 100.

We repeat this for the other five metrics and get a total possible high score of 600.

Finally, we divide everything by 6 (the number of metrics in this category) and get a top possible score of 100.

(Actually, we divide by 6 minus the number of filters that may have been set to zero indicating that the user doesn’t care about the metric.)

The Batting and Fielding indices are computed in similar fashion. The PBEI (the custom master index) is computed as follows.

(([BattingIndex]* User Weight)+

([PitchingIndex]* User Weight

([FieldingIndex]* User Weight))/(30-(10*[Number_Composite_Ignores]))

Remember that the top possible Batting Index is 100, so if the user indicates this should be weighted as most important (a 10) this would give us 100 x 10, or 1,000.

Do this three times and you get a maximum score of 3,000 so we divide by 30 (okay, 30 minus 10 times the number of ignores) to get a maximum custom index score of 100.

## What Team Should You Watch?

The Personal Baseball Entertainment Index

Perhaps it’s a Sunday afternoon and the baseball team you root for is rained out. You’ve got a satellite season ticket and can watch any game you want.

Or maybe you’re fed up with the team that has broken your heart for one too many seasons and want to find a new team that will at the very least entertain you.

**Note:** The fully working dashboards described here may be found at the end of this blog post.

### Which team should you watch?

The **Personal Baseball Entertainment Index** (PBEI) looks at statistics for major league teams from 2009 through the All-Star Game break in 2011 and ranks each team on 16 different metrics. You can specify which of these metrics are more important to you than others (e.g., “Triples” vs. “Walks”) and then the system will calculate a customized ranking based on your preferences.

### What the Index Tracks

There are literally hundreds of different facets of baseball that people track with mind-numbing precision and affection. Don’t believe me? Check out www.fangraphs.com. For PBEI we look at the following 16:

**Batting:**

Home Runs

Triples

Stolen Bases

Runs

Hits

Walks

Strikeouts (actually, NOT striking out)

**Pitching:**

Strikeouts

Not Allowing Hits

Earned Run Average (ERA)

Not Allowing Home Runs

Not Allowing Walks

Time Between Pitches

**Fielding:**

Errors

Preventing Stolen Bases

Turning Double Plays

### Ranking Each Statistic and Each Category

There are three major categories (Batting, Pitching, and Fielding) and within each category there are three to seven different metrics.

Each team has a ranking of between 1 and 30 inclusive for each metric. For example, over the past two and one-half seasons the Seattle Mariners are ranked 26^{th} for Home Runs while the Minnesota Twins are ranked 4^{th} for Hits.

If you weigh each of the metrics equally, the top teams in each category would be…

Batting:

Pitching:

Fielding:

And if you weigh all three categories equally and combine the results into a master ranking…

Your Personal Index

I’m a lifelong Mets fan. Do you have any idea how painful it is to see The Phillies and Yankees at the top of this list?

Fortunately, all these metrics do NOT have to be weighed equally. Indeed, I don’t think anyone would argue that a walk is as entertaining as a triple, so let’s explore how you can apply your own weights to the rankings.

### Personalized Batting Index

If you click the Step 1 of the interactive dashboard you will see a screen that looks like this:

Notice that all the slider controls are set in the center.

Move the sliders to the right for measures that are important to you and to the left for those that are less important. If you want to exclude a measure completely, just move the slider to 0 (all the way to the left).

In the example below we’ve ranked Triples and Home Runs as most important and ignore Walks.

Note: If you hover over a bar for a particular team you can see the underlying measures and rankings:

### Personalized Pitching and Fielding Indices

The Step 2 and Step 3 tabs allow you to specify your Pitching and Fielding preferences using similar slider controls we saw in the Step 1 tab.

I do want to draw your attention to one statistic that is a bit different than the others and that is **Time Between Pitches**.

Nothing sucks the joy of watching a baseball game quite as much as a pitcher that takes a long time between pitches so I’ve included this somewhat atypical metric in the Pitching index. Moving this slider to the right will move teams that have pitchers that work fast up the list.

**Note:** Special thanks to Lucas Apostoleris for aggregating this metric by team for the 2010 season (I do not have the statistics for 2009 and 2011 yet.)

### Putting it all Together – Your Personal Index

Once you’ve specified the relative importance of each of the 16 metrics you should click the Step 4 tab.

Here you specify the relative importance of the three main categories. In the sample below the settings indicate that Pitching is most important, followed closing by Fielding.

### Raw Data and Rankings

The final tab allows you to look at the raw statistics and rankings for each team in the three categories.

You can look at a different category by clicking the Category drop down filter.

### A Quick Peek Under The Hood

I plan to write a separate blog post that goes explains some of the inner workings of the underlying Tableau workbook as well as some of the design decisions. In the meantime here’s a quick look at the logic behind the indices.

For each category I wanted to have a maximum possible score of 100. That is, if a team ranked first in every metric and the user indicated that every one of those metrics should get a “10” then the top score would be 100.

Here’s the algorithm for Fielding.

((31-[Strikeouts Rank])* User Weight /3

+ (31-[Avg Time Between Pitches Rank])* User Weight /3

+ (31-[ERA Rank]) * User Weight /3

+ (31-[HR (Pitching) Rank])* User Weight /3

+ (31-[Hits (Pitching) Rank])* User Weight /3

+ (31-[Walk (Pitching) Rank])* User Weight /3)

/(6-[Number_Pitching_Ignores])

Let’s just look at the first piece.

((31-[Strikeouts (Pitching) Rank])* User Weight Metric /3

There are 30 teams so the top ranked team would 1. 31 minus 1 = 30.

If the user indicates that this measure is of highest importance, the 30 will be multiplied by 10, giving us 300. Dividing by 3 gives us 100.

We repeat this for the other five metrics and get a total possible high score of 600.

Finally, we divide everything by 6 (the number of metrics in this category) and get a top possible score of 100.

(Okay, we don’t divide by 6. We divide by 6 minus the number of filters that may have been set to zero indicating that the user doesn’t care about the metric.)

The Batting and Fielding indices are computed in similar fashion. The PBEI (the custom master index) is computed as follows.

(([BattingIndex]* User Weight)+

([PitchingIndex]* User Weight

([FieldingIndex]* User Weight))/(30-(10*[Number_Composite_Ignores]))

Remember the top possible Batting Index is 100, so if the user indicates this should be weighted as most important (a 10) this would give us 100 x 10, or 1,000.

Do this three times and you get a maximum score of 3,000 so we divide by 30 (okay, 30 minus 10 times the number of ignores) to get a maximum custom index score of 100.

### Interactive Dashboards