Wednesday, December 25, 2013

The best way to use stacked area charts to visualize crazy central bank balance sheets

Before 2008, visualizations of central bank activity largely focused on interest rates. These visualizations were easy to make, just a line graph showing a central bank's target rate and the actual overnight rate, perhaps within a narrow channel bounded at the top by the central bank's lending rate and at the bottom by its deposit rate. The one below, pinched from the Economist, is a decent example.

But then the credit crisis hit. Rates plunged to zero where they have stayed ever since. Central bank policy moved away from conventional manipulation of the short term rate towards more unconventional policies, thus rendering the classic line graph less relevant.

Two of the more important of these new unconventional tools are quantitative and qualitative easing. A good chart must be capable of illustrating the expansion of a central bank's balance sheets (quantitative easing) and contortions within that balance sheet (qualitative easing). In this context, stacked area charts have become the go-to visualization. Not only can they convey the overall size of the central bank's balance sheet and its change over time, but they are also capable of showing the varying contributions of individual stacked areas, giving a sense of movement within the balance sheet.

Because the stacked area chart's large flat areas are typically filled with colours, it reigns as one of the charting universe's more visually stunning specimens, appearing almost Van Gogh-like in its intensity. However, there are a few interesting technical problems with using stacked area charts, two of which I'll describe in this post:

1. Small sums get squished

QE has in many cases caused a quadrupling in size of central bank balance sheets. However, pre-QE and post QE periods must share the same scale on a stacked area chart. As a result, pre-QE data tends to get squished into a tiny area at the bottom left of our stacked area chart while post QE data gets assigned to the entire length of the scale. This limits the viewer's ability to make out the various pre-QE components and draw comparisons across time. The chart below, pinched from the Cleveland Fed, illustrates this, the data in 2007 being too squished to properly make out.

The classic way to deal with the squishing of small amounts by large amounts is to use a logarithmic scale. Log scales brings out the detail of the small amounts while reducing the visual dominance of large amounts. The chart below, for instance, illustrates what happens when we graph Apple's share price data on the two different scales.

But log scales don't work with stacked area charts. Below, I've stacked three data series on top of each other and used a logarithmic scale.

Upon a quick visual inspection, you might easily assume that the blue area, Series1, represents the greatest amount of data, the purple the second most, and the yellow the third. But all three represent the same data series: 4, 4, 6, 8, 3, 4. If you look closer and map each series to the logarithmic scale, it becomes evident that all three areas indeed represent the same amount of data. Since the series represented by the blue area happens to be the first series, the log scale assigns it the largest amount of space. If by chance the data represented by the yellow series was first in line, then it would be assigned to the bottom part of the scale and would take up the most area. This is an arbitrary way to go about building a chart.

So applying a log scale to a stacked area chart will cause most people to gather the wrong conclusions. They are interested in the size of the areas, but a log scale assigns equal data series different size areas (or unequal data series the same size area). We've created a mess.

2. Loss of clarity as the stack increases.

Central banks will often have dozens of items on both the asset and liability side of their balance sheets. As each series is stacked on top of the other, volatility in a given series will by amplified across all subsequent stacked layers. This will tend to make it harder for the reader to trace out movements over time in series that are nearer to the top of the stack.

Below I've charted five data series:

Although it may not be apparent to the eye, areas A and E represent the exact same underlying data series. While the eye can easily pick out the gradual rise in A, this simply isn't possible with E. The volatility in the intervening layers B, C, and D make it impossible to pick out the fact that E is a gradually increasing data series, and that A = E.

The fix

My solution to these two problems is an interactive chart. This one shows the Federal Reserve's balance sheet since 2006:

This chart was coded in d3, an awesome javascript library created by Mike Bostock.

The first problem, squished sums, is solved by the ability to create a percent area chart. Try clicking the radio button that says "percent contribution". Rather than each series being assigned an absolute amount, they will now be scaled by their proportional contribution to the total balance sheet. This normalizes pre-QE and post QE data, thereby allowing for comparisons over both periods.

The second problem, the loss of clarity as the stack increases, is solved in two ways. By choosing the unstacked radio button, the chart will drop all data series to a resting position on the x-axis. The volatility of one series can no longer reduce the clarity of another series. This causes some busyness, but the viewer can reduce this clutter by clicking on the legend labels, removing data series that they are not interested until they've revealed a picture that tells the best story.

The loss of clarity can also be solved by leaving the chart in stacked mode, but clicking on legend labels so as to remove the more volatile data series.

There you have it. By allowing the user to 1) shift between stacked, unstacked, and percent contribution modes and 2) add and subtract data, our interactive Fed stacked area chart solves a number of problems that plague non-interactive area charts.


Some interesting random observations that we can pull out of our interactive area chart.

1. If you remove everything but coin (assets), you'll see that every February the Fed shows a spike in coin held. Why is that?
2. Try removing everything but items in the process of collection (assets) and deferred availability cash items (liabilities). Note the dramatic fall in these two series since 2006. The reason for this is that prior to 2001, checks were physically cleared. The Fed leased a few hundred planes which were loaded every night with checks destined for Fed sorting points. Prior to these cheques being settled, the outstanding amount in favour of the Fed was represented as items in process of collection, and those in favour of member banks be deferred availability items. The arrival of digital check technology has reduced the time over which checks remain unsettled, and thus reduced these balance sheet items to a fraction of their previous amounts. Timothy Taylor has a good post on this subject.
3. Unstacking the assets data shows that unamortized discounts/premiums represent the third largest contributor to Fed assets, up from almost nothing back in 2006. Basically, the Fed has been consistently buying large amounts of bonds via QE at a price above their face value. This premium gets added to the unamortized premium category.


  1. An article that, for its footnotes alone, is worthy of something like Grant's Rate Observer, and I'm reading it for free after it was written on Christmas Day. God bless you sir.

    1. "and I'm reading it for free after it was written on Christmas Day"

      Thanks John, that's the blogosphere for you.

      Merry Christmas & Happy New Year.

  2. Nice work on the visualizations and sharing insights into how to tell a numerical story. it is an important skill. D3 looks pretty cool.

    1. Thanks, Nick. D3 is an incredible library, very powerful.

  3. Stunning. And written on Christmas Day, too. JP, that's WAY beyond the call of duty. Thanks.

    1. Thanks Frances. T'was posted on Chistmas Day, but written in the days prior.

  4. JP - unrelated, by I finally replied to your post here , trying to use some of the machinery I've learned from Bindseil and Woodford. I also attempted to incorporate your terminology (convenience yield, pecuniary return, etc.), although still find it a bit awkward (probably is me rather than you). You probably get comment notifications, but just wanted to make sure since the post was from so far back.

  5. O/T: JP, what do you think? An easy $100 prize?

    "Reward for historical example of 4x on monetary base and low-inflation
    I will pay $100 US by paypal to the first person to comment below about a case where a central bank increased the monetary base by a factor of 4 or more in 5 years or less and did not get at least double digit inflation sometime during the 5 years after. Must provide links to reliable info on central bank balance sheet expansion and subsequent inflation."