« April 2008 | Main | June 2008 »

Two thumbs down, Typepad!

The recent "upgrade" of the Typepad interface has been an unmitigated disaster for me.  I wonder if some of you who blog may have the same issue.

The response time is painfully slow; I feel like we were back in dial-up modem world.

Simple functions like changing font size are mishandled.  E.g. switching from 13 to 14 to 15 made not a difference in the editing window to my eyes.  That's why yesterday's post looked so weird.

If you highlight several paragraphs of text, then change font size, while nothing noticable happens, now only the first paragraph is highlighted, implying that whatever changed was only applied to the first paragraph.

The automatic thumbnail generated by Typepad looks really poor, as Derek pointed out here.  The resolution is horrible; besides, the file size can be 3x that of a much larger, much clearer original image!

Trying to move around an image within the editing window has become impossible.  In addition, a blank space is now placed at the position where the image is inserted in the HTML where in the past, no extra space is inserted.  As a result, extra spaces show up in strange places.

BUT THERE IS MORE!  HERE IS THE HOWLER!

The HTML interface is now completely useless.  Look at the image below.  Typepad decided to eliminate all line breaks so the entire HTML now shows up in one big paragraph, making it impossible to edit at all.

Bad_typepad

This is how a previously great company shoots itself in its foot.

I'm open to suggestions for where I should move the blog to... (Assuming you can get the commenting function to work, because I just failed multiple times)


Back to basics

The holiday weekend permitted me to browse through stacks of unread magazines, and collect more examples of charts out there in the media.  The following chart managed to turn a series of six numbers into a brain-teaser!

Dmnews_confidence

The title "Consumer confidence in a strong US economy" reminded us of the consumer confidence index often cited by the media, except that indices are seldom expressed in terms of percentages.  Further, the use of pies hinted at proportions rather than indices.  The string of data labels above the pies added mystery, especially those red and green (down and up) arrows written next to percentages, indicating growth rates.  Indices, proportions, growth rates: talk about mixed metaphors!

 Big_confidence
Some investigation was in order.  The original press release from BIGresearch provided the solution. Helpfully it even came with a graph (shown left).  It's your typical Excel bar chart with most of the default options plus some shadowy coloring.

DM News managed to turn this pedestrian chart into the series of pies, which looked nicer but was confusing.  Here, we found that the data were proportions, specifically proportions of responders in annual polls who expressed confidence or high confidence in the chance of a strong US economy.  The key message concerned the sharp drop in proportion from 2007 to 2008.

  
Redo_confidenceA least harmful use of pie charts is to depict proportions.  However, as shown clearly here, while pies display proportions adequately, they do a poor job of showing changes in proportions over time.  We show two alternatives.  The stacked bar chart on top is superior if proportions are deemed important enough to depict directly.  If not, one prefers the line chart that brings out the rates of change in proportions over time.

 



Reference: DM News, Feb 25 2008.  BIGresearch Feb 08 Executive Briefing.

Finding a purpose

Sean C. asked a question that has been on my mind for some time: what do we think of treemaps?  Are they too busy?  Do they add to our understanding of the data?
Australiancpi

Generally, this type of chart is pretty good for exploration but not so for communication.  We can stare at the chart however long and still it isn't clear what the designer wanted to convey.

Sean used it to show the components of Australia's CPI and to explain the source of recent inflation.

It does present the hierarchical structure of the data in a compact way.  It also provides information on both the relative importance of each factor, together with its growth rate, with little fuss.

That said, the differing sizes and orientations of the boxes makes it hard to compare their sizes.  For example, is "home purchase" on the lower left larger  than "financial services" in the middle? How about household services (blue on the top) relative to audio, visual and computing (blue on the lower right)?

Also note that the two data series do not carry equal weight: readers are likely drawn more by the box sizes than by color gradations (which do not convey relative values well); as a result, the composition of the CPI rather than the changes in the components will gain more attention.

Redo_austcpiIf the purpose of the chart is to communicate findings, then a data table enhanced with colors and boxes can do a good job.  There are other ways to utilize the tabular format, such as sparklines or other symbols in lieu of numbers.

That said, the treemap is more intriguing and inviting than a table of numbers.

 




Turning in his grave 2

In a previous post, we used some nifty EDA techniques to explore the relationship between Starbucks density and Obama victory margin.  This post examines the intent of the original chart, and how we can use it to establish the same conclusion of not much correlation.

Blog_elitistThe dual-axis plot is a misnomer as in fact there lies a third scale we have not previously mentioned.  This was the scale of the ranks of Obama victory margins sitting on the horizontal axis.  Notice that the states were placed in a particular order such that the blue dots fell into an increasing pattern.  Because of this, it is not sufficient for the green dots to show a weak linear trend.

At this point, lets reverse the axis and show the same chart but with the states ordered by increasing Starbucks density.  This arrangement is more appropriate so as to explore if Starbucks density can explain the variation in Obama victory margins.

Redo_obamaelitist3

Here, we consider not just the linear regression line (dotted) but also the jagged line that joined each state to the next state.  What is striking is the amount of gyrations from one state to the next.  This shows many cases in which the Obama margin dropped markedly from a lower-denisty state to a higher-density state.  This level of variability is seen along the entire horizontal range, and roughly indicated by the green arrow.  Compare this to the blue arrow which is the range of estimated Obama margins across all states under the linear regression. 

The fact that the green arrow dwarfs the blue one is indication that the correlation between winning margins and Starbucks densities is weak.  Roughly speaking, it tells us that given a level of Starbucks density, the linear regression line explains only a small proportion of total variation, which is the same as saying R-squared is small.


A matter of timing 2

Our last post generated much discussion around double axes.  In this post, we take up Michael's suggestion of a scatter plot, and several suggestions to retain the original units.

The scatter plot in this case did not provide any insight, unfortunately.  See below.  It just highlighted the jerkiness in the data so we ended with much zig-zagging.
Redo_bikecrash3


Retaining the original units is not advisable because those units were not comparable.  In the following caricature, we show how to shape the axis to tell any story we want.
Redo_bikecrash4

Panel plots are slightly better insofar as such mischief could be spotted by the amount of white space.

Another way to make the two data series comparable is to plot percentage change from year to year.  This is similar to indexing, just the difference between annual change and cumulative change.



A matter of timing

A reader Carly C. from Streetsblog created the following chart and wanted to know if there are better ways to present the data.  She already disliked the double axes and thought of various options including using relative scale.Blog_bikecrash

Generally speaking, dual axes in which each axis takes its own scale is like a football team with two "good" quarterbacks rotating under center, or two "great" CEOs sharing power.  We have never seen those situations work out.

When we have two quantities under comparison, we like to put them on the same scale.  In this case, converting the scale from absolute numbers to relative would do the trick.

The data paint a powerful story: as bike volume increased over time, bike accidents decreased.  The stitching together of two lines at year 1999 was an artifact of manipulating the scales.  What Carly had in mind can be accomplished using an index set at 100 in 1999.  Redo_bikecrash1This would lead to the chart shown left.  The substance of this chart and Carly's original is the same but the revised one has a single axis.

Indexing time series data is a widely used technique.  Each issue of the Economist, for example, contains many such charts.  This type of chart, however, suffers from a critical and under-appreciated problem: the visible pattern frequently and critically depends on timing.  Specifically, it makes a huge difference which year is selected as the baseline (index=100). 

A lot of mischief is possible by picking a special baseline.  Take for example, I created the same chart three times, using 1998, 1999 and 2000 respectively as baselines.  When 1999 wRedo_bikecrash2a_2 as 100 (middle chart), a criss-cross pattern showed up between 2001 and 2002, leading readers to conclude that the gap between growth in volume and growth in accidents developed during 2001.  In the other two charts, the gap appeared around 2000.  Also, the bottom chart exhibited a clear growing gap (after dumping the disagreeable data before 2000).

Unfortunately, this is a feature of such charts; whether or not timing distorts the information presented depends on how rugged the underlying data is.  Put another way, these charts can be affected by outliers.  (In this example, there were sharp changes in bike volumes in 1998-2000.)

 

Reference: Streets Blog



PS. [5/12/2008] How opportune was Andrew's post on R graphics default headaches.  I was too lazy to figure out the defaults and let R figure out the dimensions (poorly); with Jake's suggestions, the new set of charts looked much better.


Turning in his grave 1

(Thanks to reader Josh R. for the tip.)  The "plucky statisticians" at Urbanspoon decided to tackle the political hot potato: is Barack Obama an elitist?  Scratch that -- what they actually did was to determine if Obama supporters were elitists (of course, Obama would then be, due to guilt by association.)  Scratch that -- what they actually analyzed was if there tended to be more Starbucks per capita in those states in which Obama won Democratic primaries.

Suffice it to say, even if it can be proven that most states with high densities of Starbucks are more likely to have more Democratic primary voters who prefer Obama to Clinton, it is a far cry from proving Obama an elitist.  However, we take the leap of faith and look at the evidence presented to us.

Blog_obamaelite The star witness was this chart plotting the "vote spread" of Obama minus Clinton and the per-capita Starbucks density.  The black line was a linear fit to the Starbucks data as shown in green dots.  Since the black and blue lines both pointed northeast roughly speaking, we were told: "States with more latte-purveying Starbucks stores are more likely to have gone for Obama."  (So Obama is indeed an elitist.)

To cover all bases, the creator of this chart suggested that "my statistics professor might be rolling over in his grave to hear me say it, but there's a mild but real correlation here!".

Mr. Urbanspoon, the statistics professor is here and he disapproves.  As discussed before (and here), plotting two series of data on the same chart and applying two different scales is a recipe for disaster.  Not reaching immediately for the scatter plot when one has two data series is another serious misstep.  (Indeed, Josh sent the link in with a note wondering why "people dislike scatter plots so much".)  So here is the appropriate graphic:

A quick first glance at the left chart indicates that any correlation, if it exists, is very weak indeed.  A simple linear regression analysis shows that Starbucks density explains only 14% of the variability in vote spread.  Note especially the wide dispersion of dots around the line.  Further, for the vast majority of the states (say those with vote spread between -20% and 40%), there appears to be no correlation.  This is seen on the right chart.

Redo_obamaelitist

To the extent that there is a linear correlation, the points (orange dots) would be most influential.  The top cluster included Alaska, Kansas, DC, Hawaii and Idaho in which Obama had a large winning margin while the Starbucks density was above average.  The bottom cluster included Arkansas and Olkahoma where Obama was wiped out and where Starbucks had the lowest density.  These two clusters alone explained the mild relationship; removing them wiped it out.

Redo_obamaelitist2Following Nyhan, we should remove some obvious outliers, such as Arkansas, Illionois and New York (home states), Michigan and Florida (disputed) and New Hampshire and Iowa (Edwards territory).  The result is also mild correlation (R-sq = 0.075).


Till next post, when the professor rolls over again ...


 

Notice that I prefer the number of people per Starbucks metric, as opposed to the number of Starbucks per thousand people (See prior discussion on Gelman's blog.)  The reason is that every number on the former metric is reality-based while the latter metric produces imaginary numbers for small states, i.e. the imputed number of Starbucks is smaller than what actually exists!

Also note that I used a renormalized vote spread so that the Obama proportion and the Clinton proportion added up to 100%.  This made the assumption that Edwards and other voters would split among Obama and Clinton in the same proportions as those who explicitly voted for the two frontrunners.


Turning the table

Nyt_runningbacks We recently showed an example of when data tables worked well to clarify the data.  Last week, there was an example from the Times which did the opposite.

The accompanying article boldly claimed that

the 40-yard dash stands above them all as having the strongest correlation to success in the NFL.  The three-cone drill, the shuttle run, the bench press -- none correlate to NFL success.  The 40 is king.

Further, it cited Bill Barnwell from FootballOutsiders.com who created an "index" using both 40 time and body weight that is "an even better predictor than 40 time alone".  In other words, this formula Nyt_runningback_eqt

does the trick.

The data table, shown above, presumably clinched the case.

Redo_runningback1 We were mystified when we put the data to the test, however.  Among the set of 15 running backs, the Index did not predict the Yards Per Carry at all!  The Index explained only 8% of the variation in Yards Per Carry between the backs.

The data table obscures this bivariate relationship.  As it was sorted by the Index, we would look for the column showing Yards Per Carry to be naturally sorted in the same order.  But it is hard to tell the trend from the noise in a table.

What went wrong?  It turned out neither 40 Time nor Body Weight had any relationship with Yards Per Carry.

Redo_runningback2

These variables did not explain the range of Yards Per Carry attained by this set of running backs.

Redo_runningback3Finally, we found strong correlation between 40 Time and Body Weight.  (The heavier you are, the slower you run!) This meant that both variables contained similar information and some unlikely formula involving the two would be unlikely to perform significantly better than each variable alone.

So we are left to turn the table on the table.  More pertinent evidence is needed to prove the case.

The entire analysis suffers from survivorship bias as only the top running backs are examined, and no adjustment is made to deal with wide-ranging tenures.  Apparently, there is more data available in a book.  There is no indication of how the model shown above was validated.

Reference: "The Race of Truth: 40-Yard Times Can Tell the Future", New York Times, April 27, 2008.