Jul 292011
 

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 26th for Home Runs while the Minnesota Twins are ranked 4th 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 26th for Home Runs while the Minnesota Twins are ranked 4th for Hits.

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

Batting:

Description: C:\Users\STEVEM~1\AppData\Local\Temp\SNAGHTMLd1174b.PNG

Pitching:

Description: C:\Users\STEVEM~1\AppData\Local\Temp\SNAGHTMLd3a43e.PNG

Fielding:

Description: C:\Users\STEVEM~1\AppData\Local\Temp\SNAGHTMLd776e8.PNG

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

Your Personal Index

Description: C:\Users\STEVEM~1\AppData\Local\Temp\SNAGHTMLd71162.PNG

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:

Description: C:\Users\STEVEM~1\AppData\Local\Temp\SNAGHTMLddbbd3.PNG

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.

Description: C:\Users\STEVEM~1\AppData\Local\Temp\SNAGHTMLe68653.PNG

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

Description: C:\Users\STEVEM~1\AppData\Local\Temp\SNAGHTMLf6fc3d.PNG

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.

Description: C:\Users\STEVEM~1\AppData\Local\Temp\SNAGHTMLeaea62.PNG

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.

Description: C:\Users\STEVEM~1\AppData\Local\Temp\SNAGHTMLf31f09.PNG

Raw Data and Rankings

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

Description: C:\Users\STEVEM~1\AppData\Local\Temp\SNAGHTMLfd0909.PNG

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

 Posted by on July 29, 2011 6) Sports and Entertainment, Blog 8 Responses »
Jul 252011
 

Overview

Last year, UN Global Pulse launched a large-scale mobile phone-based survey that asked people from India, Iran, Mexico, Uganda, and Ukraine how they were dealing with the effects of the global economic crisis.

The survey (conducted from May-August 2010) asked two multiple choice and three open-ended questions focusing on economic perceptions.

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

Key Findings

Responses from Uganda – a country that ranks in the bottom 15th percentile in the UN’s Human Development index – were consistently more optimistic than responses from other countries.

What could account for this? Is it that Ugandans are, as a group, more hopeful and optimistic than people in the other countries surveyed?

Or could it be that survey responses were somehow skewed?

Let’s explore the data to find out.

Voices of Vulnerable Populations during Times of Crisis

Clicking the second tab displays the following view.

Economic Change Index

So, why in the first graphic does Uganda warrant a positive blue bar and Mexico a negative orange bar?  By moving your mouse pointer over a bar you can see just what it is that drives the Economic Change Index.

Here are the results for Uganda…

… and here are the results for Mexico:

The index itself (1.2 for Uganda and -1.6 for Mexico) is computed by applying Likert-scale values to each of the possible question responses.  We’ll discuss the advantages of using this approach in a moment.

Fixed Responses vs. Using One’s Own Words

The first two questions in the survey gave respondents four choices from which to choose.  The remaining three questions allowed people to respond in their own words.

You can explore these responses yourself by picking a question and a country from the drop down list boxes.

So, does the sentiment shown in the first fixed-response apply the open text responses as well?

Promising vs. Uncertain

Here is how people from Uganda responded to the question “In one word, how do you feel about your future?”…

… and here is a visualization of the responses from Mexico.

This, combined with responses to other questions, left me scratching my head. What are we not seeing that would lead to responses from Uganda — a country that is arguably in worse condition than the others — being so upbeat?

If you can’t wait for the answer, click here.

A Word about Word Clouds

I’ve analyzed a lot of survey data and I hate analyzing survey results where people get to provide free-form text responses because aggregating responses based on a common sentiment can be very difficult.

In many cases Word Cloud generators can convey the overall sentiment from multiple text responses.  They are also interesting to look at and I do believe the ones shown above are a good reflection of respondent sentiment.

A problem occurs, though, when respondents use different terms that describe the same or similar sentiment.  Consider the Word Cloud shown below.

One might think that most respondents were happy, but look what happens if we “linguistically normalize” the terms that are synonyms of “sad”:

It turns out that more people are in fact sad.

Note: There are products that are capable of parsing full sentences and are able to “disambiguate” and then normalize terms under umbrella concepts. The text responses to this particular survey, however, do not warrant this type of heavy artillery.

How We Calculate the Indices

The next tab in the workbook shows some alternative ways of visualizing the fixed-response survey results.

For these questions respondents were given four choices:

Easier / Better

Same

Worse / More Difficult

Much Worse/ Very Difficult

Notice that we display the calculated index atop the Likert-scale stacked bar charts.  There are three advantages to calculating an index for Likert-scale responses:

  1. It makes it easy to weigh sentiment across many responses.
  2. It makes is possible to track sentiment changes over time.
  3. It makes it possible to compare results against various objective economic indices (e.g., GDP, UN HDI, etc.).

Note: I have no problem using even-numbered Likert scales, but I do think in this case sentiments will be skewed towards the low end as there are two levels of pessimism (e.g., “worse” and “much worse”) and only one of optimism (e.g., “better”).

I attempted to combat this by applying the following values to the responses:

Easier / Better = 3

Same = 0

Worse / More Difficult = -2

Much Worse/ Very Difficult = -4

While I think these values make sense, users of this dashboard are welcome to use the sliders and apply different values to each of the answers.  The indices will be recalculated automatically.

A Composite Index

In an earlier version of this dashboard I created a “composite index” that combined results from the two fixed-response questions:

I think this is a valuable metric and one that I would include should UN Global Pulse make this study longitudinal (see below).

Mobile Pulse Survey Results vs. Objective Economic and Human Development Indicators

In the next tab we see survey responses (first column) vs. the United Nations Human Development Index Ranking (second column).

What could account for Ugandan survey respondents being the most optimistic despite the fact that they rank 143 out of 169 countries in the UN’s HDI Ranking?

I believe that the survey’s SMS Text-based approach is skewing the results.

Consider the third column where we see the number of mobile subscribers within a country as a percentage of that country’s population.  In Uganda, at most 29% of the population has a mobile phone suggesting that those completing the survey may be better-off financially than others within their country. Survey responses may not, therefore, be a reflection of the country as a whole. (See The CIA World Factbook for mobile phone subscription information.)

This would not be the first time premature reliance on phone polls has derailed a survey (or in this case, just part of a survey).  See A Couple of Interesting Examples of Bias and Statistical Sampling.

Make the Survey Longitudinal

Despite the shortcomings, I think there is a lot of value in conducting these types of agile, real-time surveys.

One ongoing challenge will be comparing subjective data among different countries as there are so many cultural / proclivity issues that are difficult to compare.

One way to do this would be to conduct a longitudinal study and see how sentiment changes over time.  That is, instead of comparing Uganda with Mexico or India with Ukraine for a given year, track the changes over time, using an index.  This would allow you to see the percent change in sentiment between time periods without having to worry about normalizing cultural differences.

I hope that UN Global Pulse will update this survey on a regular basis as there’s much we would be able to learn from such a study.

 Posted by on July 25, 2011 4) Health and Social Issues, Blog 2 Responses »
Jul 132011
 

I was originally planning to write a top 10 Tableau feature request, but my latest project begs me to focus on just one issue.

I’m currently documenting how a truly zaftig collection of dashboards was put together and how it should be maintained. I am struck at just how much effort I (and soon my client) must apply work around the same Tableau shortcoming.

And just what is that shortcoming?

The inability to have a filter apply to everything on a dashboard.  That is, an option that exists somewhere between “Local” (one) and “Global” (all).

Don’t get me wrong, I love Tableau.  Maybe not as much as Alan Smithee, but I really do love it.

But this particular shortcoming has taken what is already a massive project and added a good 10 to 15 percent more mass.

That’s one big productivity suck.

So, Tableau, I’ll be your best friend if you make filters dashboard centric.

Note — My friend (and uber Tableau master) Joe Mako points out that I am not alone in seeking this feature.  See

http://www.tableausoftware.com/support/forum/topic/global-filters-moveable-quick-filters-turn-or-across-all-worksheets-make-local-o

http://www.tableausoftware.com/support/forum/topic/dashboard-global-filters

http://www.tableausoftware.com/support/forum/topic/how-use-filter-control-only-those-sheets-selected-dashboard

http://www.tableausoftware.com/support/forum/topic/global-filters-across-two-dashboards-need-each-dash-react-separately

 Posted by on July 13, 2011 Blog 3 Responses »