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.

Wednesday, December 18, 2013

Tales from the litecoin universe

With cyptocurrencies all the rage these days, I figured I should weigh in. I've done a few dozen posts about the monetary theory behind cryptocoins, so rather than write another, in this post I'm going to describe my somewhat zany experience over the last fourteen or so months with litecoin, one of the bitcoin clones.

Curious about bitcoin, I figured I should gain some practical experience with the medium of exchange on which I planned to write over the next few months. So one cold autumn day in 2012 I bit the bullet and transferred some money to VirtEx, Canada's largest online bitcoin exchange, bought a few coins (a small enough amount that I wouldn't wince if their price fell to $0), and then transferred those coins from my Virtex account to my newly downloaded wallet residing on my laptop. Voilà! I was now officially a bitcoiner.

...which wasn't as exciting as I had anticipated. There was little for me to do with my fresh digital pile of coins. I'm not a huge shopper, and the places where I do buy stuff, like grocery stores, don't accept bitcoin. I don't do drugs, so I couldn't use Silk Road, the now-shuttered online drug marketplace. And I don't gamble, the gambling website SatoshiDice being one of the big drivers of bitcoin transactions. So my coins just sat there in my wallet gathering electronic dust.

Later that autumn I read somewhere that bitcoin had a smaller cryptocurrency cousin called litecoin, which traded for a fraction of the price of bitcoin. Curious, and with little other avenue for my bitcoins, I sent a small chunk of my already small stash of bitcoin to BTC-e, a Russian online exchange specializing in bitcoin-to-litecoin trades, and proceeded to buy some litecoins for around 5 cents each (I can't remember their price in bitcoin). I transferred these to my freshly downloaded litecoin wallet, and voilà, I was also now officially a litecoiner.

Much like my experience with bitcoin, I was tad bit disappointed. As a medium of exchange, litecoin was even less liquid than bitcoin. Whereas a few online sites accepted bitcoin, no one seemed to want litecoin, providing me with little opportunity to play around with my new toys. Along with my bitcoins, my tiny hoard of litecoins gathered dust.

A few weeks later, however, I stumbled on an interesting avenue for my litecoins: an online litecoin-denominated stock exchange called LTC-Global. At the time, it listed around 20-25 stocks and bonds. I gleefully opened an account (which took seconds) to which I transferred about 75% of my stash of litecoins, and started to invest. I use the term "invest" very loosely, even sheepishly. Because the dollar-value of the shares I was purchasing amounted to a few bucks, it was hardly a large enough sum to merit a true analysis of the companies in which I was investing in. I glanced through the summaries of the various listed companies, picked some that I found interesting, and bought their shares. My investments included a website that published litecoin charts, a bond issued by a litecoin miner, a few passthroughs*, and some other companies.

Over the next months I'd get periodic notifications that my companies had paid me dividends. I bought a few more shares here and there, and some of them even rose in value. But when the novelty of this was over, I forgot about my investments. Then in March 2013 litecoin prices really started to race, quickly moving from $0.05 to $0.50. This amounted to a 900% rise since my autumn 2012 entrance into the litecoin universe, a far larger percent return than I'd ever made on my "real life" investments. My stash of litecoin had graduated from the "tiny" to the "smallish" category.

I hastened to LTC-Global to check the price of my investments, and much to my horror discovered that many of them had fallen in value by the exact amount of litecoin's rise. My 900% return was not to be. And as litecoin's price crossed the symbolic $1 mark, the price of my stocks continued to fall! After a few frenzied inquiries posted to the litecoin forums, I was informed by some savvy cryptocoin investors why this was occurring. Many of the companies into which I'd invested my litecoins earned fiat returns. My litecoin chart website, for instance, received advertising income in euros. As litecoin prices exploded, the website continued to earn the same amount of euros, but this equated to a much smaller litecoin equivalent. Thus the price of my stocks in terms of litecoin had declined, though they were still worth the same amount of dollars or euros. Better had I kept my funds in litecoin than ever investing them!

This made me wonder: in a world in which cryptocoins are expected to rise by 900% in a few days (why else would someone hold them), is there any point in investing one's litecoins? The expected return on hoarding far exceeds the return from investing litecoin in companies that by-and-large earn fiat returns. Yes, companies that earn litecoin income will not suffer a fall in share price, but at the time I was making my investments the litecoin universe was so small that few companies earned a pure litecoin revenue stream.

By April, litecoin had advanced another 900% to $5, giving me a return of 9,900% in just a few months. My shares, however, continued to deteriorate in value. To compound the problem, one of the companies I'd blindly invested in turned out to be a scam. I suppose in hindsight I might have guessed that a company called "Moo Cow Mining" might be a poor candidate for investing. The owner of Moo Cow had stopped paying dividends and absconded with the investors' assets. In the bricks & mortar world such actions would have very real consequences, but in the nascent litecoin universe there seemed to be little that could be done except make loud threats on the forums. This caused me some consternation because though my initial investment had been tiny, as litecoin prices advanced from $0.05 to $5 what had been a small scam in real terms quickly became a not-so-small one.

Once again I forgot about my litecoins. Without warning, this September LTC-Global announced it would be shutting its doors. One of the hazards of running an online stock exchange is that it probably breaks hundreds of SEC regulations. No doubt the exchange owners had decided to call it quits before they got in trouble. Worried that my funds might be confiscated or blocked, I quickly logged into my account. My shares had fallen in value (see this post) upon the announcement, but I was still able to sell everything I owned. I limped out of LTC-Global having lost 65% or so of the litecoins I'd invested. I vowed never again to spend away my hoard of coins on silly investments.

This November litecoin prices experienced another buying rush as they rose from $5 to just shy of $50, pushing litecoin up by a ridiculous 99,900% since I'd initially bumbled into them. Although I'd lost a large chunk of my litecoins by investing in stocks, the remaining stash now summed up to an amount that was no longer smallish (but not gigantic, either). Even tiny amounts of capital will grow into something substantial at those sorts of rates of return. Let's not kid ourselves though, this wasn't a canny trade, it was just dumb luck.

Getting out of litecoin isn't an easy task. I'll have to send my coins back to BTC-e where I can exchange them into bitcoin, incurring a 0.05% transaction cost on the deal. Then I have to transfer these bitcoins back to Virtex to buy Canadian dollars, which will exact a fat 2% commission on the trade. Then I'll have to wait a few days for my dollars to be transferred to my bank account. It's a lengthy and expensive process. Alternatively I could try and find someone who makes a market in litecoin, go to their house or a café, and consummate the trade there. But that just sounds awkward.

I also now have the headache of figuring out the tax implications of all of this. Which makes me wonder: how can litecoin and bitcoin ever be useful media-of-exchange if, for tax purposes, one must calculate the capital gain or loss incurred on every exchange? Even if I was able to buy groceries with my litecoin, I'm not sure I'd bother. The laborious process of going through my records in order to determine my capital gain/loss would probably have me reaching for my fiat wallet. The advantage of fiat money is that there are no capital gains taxes or capital loss credits, obviating the need for bothersome calculation.

The tax issue, combined with the general difficulty I experienced buying anything with my litecoins, topped off by the complexity of getting back into fiat all conspire to drive home the point that the main reason to hold litecoins for any period of time isn't because they make great exchange media—it's because they're the best speculative vehicles to hit the market since 1999 Internet stocks. I'll admit straight up that the speculative motive is why I'm still holding my litecoins, the educational motive having receded into the background some time ago. After all, if these little rockets can rise from $0.05 to $50, why not to $500, or $5000? All that's needed is a greater fool. I'm fully aware that the odds are that litecoin's value will fall to zero before $500 is ever reached, but my litecoin gains are so unreal to me that I wouldn't lose any tears if that particular worst-case scenario were to occur.

And it's millions of folks like me who explain the incredible volatility of cryptocoins, since we are the marginal buyers and sellers of the stuff. Since first starting to write this post, litecoin has lost over 60% of its value, falling back to below $20. These speculative-driven spikes and crashes don't seem like a very durable state of affairs to me, at least if cryptocurrencies are to take a more serious role in the world of exchange media. To be useful, an inventory of exchange media should be capable of purchasing the same amount of goods on Wednesday that it bought on Monday, but with cryptocoins one has little clue what tomorrow's purchasing power will be, let alone next week's.

Although I'm skeptical of cryptocoin mania, let me end on a positive note. Cryptocoin 2.0, or stable-value cryptocoins, is probably not too far away. It may take a price crash before they emerge, but I do think that stable value crypto coins will prove to be far better exchange media than the current roster of roller coasters.

*a passthrough is a bit like an ETF. Anyone who invests in a passthrough receives a stream of dividends thrown off by an underlying stock, one that is usually listed on another crypto stock exchange.

Sunday, December 8, 2013

Milton Friedman and moneyness

Steve Williamson recently posted a joke of sorts:
What's the difference between a New Keynesian, an Old Monetarist, and a New Monetarist? A New Keynesian thinks no assets matter, an Old Monetarist thinks that some of the assets matter, and a New Monetarist thinks all of the assets matter.
While I wouldn't try it around the dinner table, what Steve seems to be referring to here is the question of money. New Keynesians don't have money in their models, Old Monetarists have some narrow aggregate of assets that qualify as M, and New Monetarists like Steve think everything is money-like.*

This is a interesting way to describe their differences, but is it right? In this post I'll argue that these divisions aren't so cut and dry. Surprisingly enough, Milton Friedman, an old-fashioned monetarist, was an occasional exponent of the idea that all assets are to some degree money-like. I like to call this the moneyness view. Typically when people think of money they take an either/or approach in which a few select goods fall into the money category while everything else falls into the non-money category. If we think in terms of moneyness, then money is a characteristic that all goods and assets possess to some degree or another.

One of my favorite examples of the idea of moneyness can be found in William Barnett's Divisia monetary aggregates. Popular monetary aggregates like M1 and M2 are constructed by a simple summation of the various assets that economists have seen fit to place in the bin labeled 'money'. Barnett's approach, on the other hand, is to quantify each asset's contribution to the Divisia monetary aggregate according to the marginal value that markets and investors place on that asset's moneyness, more specifically the value of the monetary services that it throws off. The more marketable an asset is on the margin, the greater its contribution to the Divisia aggregate.

Barnett isolates the monetary services provided by an asset by first removing the marginal value that investors place on that asset's non-monetary services, where non-monetary services might include pecuniary returns, investment yields and consumption yields. The residual that remains after removing these non-monetary components equates to the market's valuation of that given asset's monetary services. Since classical aggregates like M1 glob all assets together without first stripping away their various non-monetary service flows, they effectively combine monetary phenomena with non-monetary phenomena—a clumsy approach, especially when it is the former that we're interested in.

An interesting incident highlighting the differences between these two approaches occurred on September 26, 1983, when Milton Friedman, observing the terrific rise in M2 that year, published an article in Newsweek warning of impending inflation. Barnett simultaneously published an article in Forbes in which he downplayed the threat, largely because his Divisia monetary aggregates did not show the same rise as M2. The cause of this discrepancy was the recent authorization of money market deposit accounts (MMDAs) and NOW accounts in the US. These new "monies" had been piped directly into Friedman's preferred M2, causing the index to show a discrete jump. Barnett's Divisia had incorporated them only after adjusting for their liquidity. Since neither NOW accounts nor MMDAs were terribly liquid at the time—they did not throw off significant monetary services—their addition to Divisia hardly made a difference. As we know now, events would prove Friedman wrong since the large rise in M2 did not cause a new outbreak of inflation.**

However, Friedman was not above taking a moneyness approach to monetary phenomenon. As Barnett points out in his book Getting it Wrong, Friedman himself requested that Barnett's initial Divisia paper, written in 1980, include a reference to a passage in Friedman & Schwartz's famous Monetary History of the United States. In this passage, Friedman & Schwartz discuss the idea of taking a Divisia-style approach to constructing monetary aggregates:
One alternative that we did not consider nonetheless seems to us a promising line of approach. It involves regarding assets as joint products with different degrees of "moneyness" and defining the quantity of money as the weighted sum of the aggregate value of all assets, the weights varying with the degree of "moneyness".
F&S go on to say that this approach
consists of regarding each asset as a joint product having different degrees of "moneyness," and defining the quantity of money as the weighted sum of the aggregate value of all assets, the weights for individual assets varying from zero to unity with a weight of unity assigned to that asset or assets regarded as having the largest quantity of "moneyness" per dollar of aggregate value.
There you have it. The moneyness view didn't emerge suddenly out of the brains of New Monetarists. William Barnett was thinking about this stuff a long time ago, and even an Old Monetarist like Friedman had the idea running in the back of his mind. And if you go back even further than Friedman, you can find the idea in Keynes & Hayek, Mises, and as far back as Henry Thornton, who wrote in the early 1800s. The moneyness idea has a long history.

* Steve on moneyness: "all assets are to some extent useful in exchange, or as collateral. "Moneyness" is a matter of degree, and it is silly to draw a line between some assets that we call money and others which are not-money."

...and on old monetarists: "Central to Old Monetarism - the Quantity Theory of Money - is the idea that we can define some subset of assets to be "money". Money, according to an Old Monetarist, is the stuff that is used as a medium of exchange, and could include public liabilities (currency and bank reserves) as well as private ones (transactions deposits at financial institutions)."

** See Barnett, Which Road Leads to Stable Money Demand?