# Programming, Life Lessons, and the Power of Forgetfulness

This post is somewhat whimisical, and is spaned by a fascinating article that I read on REgular Expression Pattern matching over at swtch.com .

Regular Expressions are a way of categorising strings of letters and symbols so that you can have a powerful tool for searching text for strings of a particular form, or for insisting that they come in a particular form. For example, you could search a block of text and pull our every set of 7 characters which could be a UK number plate.

Anyway, it turns out that there is an extremely efficient algorithm for doing this matching known as Thompson NFA. This algorithm has been known since almost the beginning of RegEx. It was implemented in early Linux Kernals from the 1970’s. It turns out, that almost no modern language implements this algorithm, instead, they use much much worse versions in their common library functions. How much worse? Well, for a 100 character string Thomson NFA takes 200 microseconds, while Perl would require 10^15 years.

The performance graph is here:

Sorry What? A powerful, fast and efficient algorithm has been known for years, yet most modern programming languages use a vastly inferior version. Why?

It turns out, that communities just forget things. RegEx became what JH Newman called “furniture of the mind”, a concept that you are comfortable with, but don’t really need to understand. When writing their libraries, RegEx functions are just things like maths functions, you implement them because every language should ahve them, but you don’t pay too much attention to them. They are just the boring bricks and mortar of programming.

So Pery, Ruby, Python and Java all shipped with a RegEx algorithm orders of magnitude worse than the best one, and often with more code needed to implement this badly.

Scott Sumner has a theory that Central banks are always fighting the last war, as their domain knowledge is formed when you are studying in your twenties and thirties. People who grew up in the 1970’s are obsessed with inflation. People who grew up in the 1930s were obsessed with deflation. Here is that dynamic in a totally context. Those CS graduates who grew up with RegEx was an interesting and open problem in the 50s and 60s knew about the best algorithms, and implemented in the languages and operating systems of that era. Then it was done, and everyone just used it without understanding it, and the knowledge was lost’. The next generation created exciting object orientated paradigms and just forgot that this was once an interesting problem with an optimal solution, and just “did the obvious thing”, which turned out to be slow. Then they tried to improve it with a variety of clever tricks like memoisation, but none of that got over the inherent inferiority of the backtracking approach to RegEx matching.

# How Much do NGDP expectations matter to the Stock Market?

The inspiration for this post was a brief discussion with a friend, when I attempted to explain why I think of the stock market as a prediction market for NGDP. We might pose the following question, if NGDP expectations were to increase from 5% per year to 6% per year for every year from now to forever, how much would that matter to the stock market?

The short answer is, a lot.

To answer this, lets take a slightly round about route of asking, what is the Net Present Value ,$M$, of Corporate America? Its reasonably well known that Corporate Profits as a share of NGDP has been a very stable time series for decades, oscillating in the band of 3-7%.

There is some evidence that we might expect it to be at the higher end of this range going forward due to having more tech with higher profit margins, and more overseas earnings. So lets assume that this is stable at $P = 6%$ going forwards. Let us likewise assume that the ten year interest rate,$i = 3%$, and the equity risk premium $\rho = 4.5\%$ is stable going forward. In that case we have a discount rate of 7.5%. The total net present value of corporate america’s future earnings would be

$\frac{M}{NGDP} = \sum_{t} \frac{P \times g^{t}}{(1+i+\rho)^{t}} \approx \frac{1}{i+\rho - g}$

Where we have $g$ as the growth rate of NGDP.

Given the assumptions above, if we assume that everything grows at a stable growth rate (i.e we are ignoring possible path dependency), then

$\begin{tabular}{|c|c|} \hline g & M /(P N) \\ \hline 4\% & 28.6 \\ \hline 5\% & 40 \\ \hline 6\% & 66.7 \\ \hline \end{tabular}$

So a 1% increase in NGDP gives about a 40% increase in the stock market, as a handy rule of thumb. No wonder the stock market loves QE!

If we take the EMH seriously, we must conclude that the combination of low TIPS spreads predicting low inflation, and a booming stock market predicting high NGDP, means that we can expect productivity/RGDP to come roaring back any minute now. A market Monetarist argument for Supply Side Optimism. Yes, I’m looking at You Britmouse. :)

# What is happening in the Bond Market?

Across the developed markets, long bond yields are moving lower. Lower long yields typically represent lower expectations of NGDP. After all, if NGDP is expected to grow robustly, then either it will cause inflation and bonds will get killed, or it there will be high productivity growth, and stocks will likely do better.

Lower NGDP expectations must mean tighter policy in the short term. At least in my world view that is more or less the definition of tighter policy. Thus, when I see long bond yields move lower, I immediately ask, “who is tightening policy?”.

The answer seems to be everyone. China’s central bank is hard to read, but it appears happy to accept some level of slowdown to put a lid on rampant credit growth. The US is tapering, and good economic data out of Japan is causing people to rethink their expectations of the BOJ easing further. Finally, no one really thinks that the ECB will have the political will to do the kind of Japan level QE that the EZ desperately needs.

Now, despite all that, I don’t think that that is the primary driver of what is happening. I think that falling inflation in the short term (less than 2 years), has resulted in a passive tightening of policy, and that is what is crushing long yields. The real short term rate is the nominal bank rate (in the UK 0.5%) less inflation (annual change GDP deflator). The following graph therefore gives a sense of the “real” short term rate in the US.

So its pretty clear that the low inflation in the US has caused policy to tighten by almost a full percentage point since 2012. If you were to make an adjustment to this for the taper the effective tightening would be even greater. Sadly, I could not make the usually excellent Fred give me up to date series for the EZ GDP deflator – for some reason it ends in mid 2013.    I strongly suspect the EZ is in an even worse position.

I think financial markets are waking up to the fact that low inflation might be here for a while, and that this has significant implications on where the “real” policy rate lies, even if there is no change in the expected path of the nominal rates. Remember, policy is expansionary *if and only if* the (real) natural short term interest rate is above the inflation adjusted Fed funds rate. Might we just have seen these cross over? If so, expect the US slowdown to continue, and Europe to go back over the cliff.

# BOE’s Inflation Report

So I had a look at the FT’s coverage of the inflation report, and it brought up one of my pet peeves about the commentary on the crisis, namely, measures of economic slack.

The bank of England apparently thinks that there is around 1.5% of slack in the economy. My first pet hate is that “slack” is not adequately defined in this context. Does this mean that Carney thinks that RGDP will develop a new trend line that is only 1.5% higher than the current level and at around 2% a year? Or does this simply mean that at the current moment companies estimate that with their current personnel and facilities they could only increase production by 1.5%.

This is important because there are two types of “slack”, there is the measure of “could we do more right now”, and there is the measure “given greater demand could I deploy more employees, capital, and technology to increase supply”. I am pretty sure the BOE’s estimate is about the former, but the macroeconomically important version  is the latter. In other words, the supply side constraints could be soft for a while, if technological improvements since 2008 have enabled greater production, but they just haven’t been deployed due to weak demand.

Lets take a quick look at the RGDP (constant prices):

Does this look like an economy with only 1.5% slack? Is it not possible that in the medium term we might recover nearly all of our lost productivity? Might we not find that as demand grows aggregate supply just continues to quietly grow so that the BOE’s measure remains stuck at 1.5% while GDP grows 4-5% a year for a number of years?

Stolen from an ONS publication, does this look like an economy with only 1.5% slack? Are you telling me that after 7 years of technological progress, the BOE expects slack in GDP to be exhausted before productivity per worker has even reached its 2007 high?

Are we really to expect that some (minor) institutional differences will mean that UK workers will not, over the medium term, enjoy the same advances that have allowed US productivity to grow 20% in the same period? The UK is structurally similar to the US, but the structural differences (might) mean that in the UK we get more hiring first, and productivity growth later, and in the US they get more productivity first, and then more hiring. That certainly seems more plausible to me  than that the differences in our institutions mean that the UK will not benefit from the same advances of the US in the long run. In that case, the technology exists already for a 20% rise in productivity in UK workers.

The real problem here is that the BOE is giving a short term definition of slack, where it doesn’t assume anything about the future investment and employment and capital improvement programs of enterprises. It just asks about capacity utilisation right now. Which, immediately following a recession, is a sensible enough thing to do. The problem is, that here we have moved into the medium term. There has been technological progress in that time, and the fact that this is waiting in the wings means that we should not regard current utilisation as in anyway a meaningful indicator of “slack”.

I predict that productivity per worker will recover its century long trend line of 2% a year growth. In that case, “slack” in the economy is more like 15% than 1.5%. Capital spending, training workers on new technology, the rise of robotics and machine learning will do the heavy lifting over the next 3-5 years, and we can expect strong growth along side benign inflation until we approach this productivity trend line.

# There is Still No Housing Bubble

Articles about Housing Bubbles are ten a penny at the moment, so I thought it was about time for another salvo in my lonely war against the Bubble Obsessed. When I was lying awake last night, it occurred to me that there is not really enough thought about what constitutes “expensive” or “cheap” when it comes to housing. When talking about an item like bread, we can see that over time the price tends to fall slowly as technology and farming improves, but with occasional spikes when there is some type of supply shock which lowers supply. So it makes sense to talk about when bread is expensive by comparing it to recent history. Fashion items, on the other hand, derive part of their value from their exclusivity, so their price relative to wages stays fairly constant to target a given type of consumer.

Then there are financial assets like the stock market, which make new highs most years, because they are a claim on a fraction of a pie which is growing. Since the housing market also a claim on future earnings, via rent, it too should logically make new highs most years.

It is my contention that housing is more of a luxury good than a commodity, and thus I would expect people to have a reasonably stable preference about what fraction of their income they are prepared to spend on housing. Thus, house prices are expensive, only in so far as they grow more than the total spending (perhaps per capita) in an economy. This makes sense, if my wages grow over time, I would expect to try to move to a better house, and pay more rent. Since, on average, everyone’s wages grow over time, so must house prices. Running to stand still as it were.

The following shows the change in the house price index relative first to NGDP (=total spending), and secondly to the median wage.

Look how stable house prices/median wages have been!!!

The first thing to note is how amazingly stable both these measures are over time. Particularly house prices/median wages. It was basically flat for decades. On the housing/nominal spending measure, US housing has never been cheaper! The difference in trajectory is a measure of the fact that median wages have not risen in line with total spending due to declining labour share over the period. It is interesting that prices relative to median wages really did show a marked increase in the 2000s, but that is all but fully unwound, and I look forward to watching house prices going flat relative to median wages for many more decades.

I tried to recreate the same graph for the UK, but FRED seems to only have rental income. However, that is interesting in its own right, so lets look at rental prices vs NGDP and vs the median wage in the UK:

Where is that house price bubble again?

This data goes over a much shorter period than the US data above. However, its pretty clear that the cost of renting has been in a reasonably long term decline throughout the nineties. I look forward to watching the cost of renting resume its decade long decline.

Its also interesting that the crash has actually made housing more expensive since it caused wages to fall much faster than house prices. A salutory warning to the Bundesbank and Swedish who seem determined to make the case that you should try to put a lid on house prices by raising rates.

Anyway, the main point is clear – forget the media’s obsession. Housing is cheap by the most important measure – its cost relative to median wages.

Also, if you are a BOE Hawk determined to raise rates to put the break on the housing market, then have another look at the evidence. And then don’t.

PS:If someone can find the data for UK house prices in a handy format somewhere, I will redo the US graph for the UK.

# Thomas Piketty and Inequality

I haven’t read this book, but judging from the blog reviews, it seems that is central point is that if the return on capital is higher than economic growth, then the owners of capital should become richer over time.

However, it seems that there are certain problems with this thesis. Firstly, an economy has an optimal capital stock, and thus can carry only a finite amount of wealth into the future. Attempts to save beyond this simply drive the return on capital negative. In the long run then, the capital stock approaches the optimal, and the return on savings should approach zero. Given the epic lack of capital in EM, we are still some 50-100 years from that, at least. On the other hand, we can comfort ourselves with the thought that even if Piketty is correct now, he won’t be correct forever.

If we think that the inequality in capital ownership is a problem, there is a simple solution. Simply have world governments buy up large quantities of the capital stock, say half of the stock and bond markets over a few decades. By reducing the supply of capital, savers, and by extension the wealthy, would have to compete for a smaller and smaller share of the optimal capital stock.

In the short term, this will drive up the price, but in the long run it limits the supply of available savings vehicles, and exposes the wealthy to inflation by giving them the choice between holding cash, or buying capital at such prices that returns are bound to be negative.

Of course, it seems that this would not be a politically acceptable move. For one thing, people seem to believe in the divine right of savers to reasonable returns. Of course, no one seems to equate the very wealthy with hard working’ savers, but economically they are largely identical. To make it politically acceptable, the government would have to provide bonds at a reasonable rate of return. This could be managed, simply start selling bonds directly to savers at some limit such that no one person can own more than, say \$500,000.  This is not very different from the UK’s pensioner bonds.

Driving down inequality by having the government buy up the capital stock. Its just the modern repackaging of Marxist ideas, but the difference is that we could do it now, without the terrible side effects. Just buy ETF’s and the government can be a silent partner in the world’s stock and bond markets. No interference in workings of capitalism, just lots more capital.

# The Importance of Charity in a Market Economy.

Ever since I first read “I pencil”, I have been somewhat in awe of market economies. The ability of price signals to transmit demand along supply chains containing millions of individuals is akin to magic. The market appears almost limitless in its ability to reshape the contours of labour and capital in order to produce goods that we never even knew that we wanted. It is the ultimate democracy: every £ of spending is one vote, directing research and development, production, and marketing.

Just as, in the case of a pencil, it is impossible to derive precise causal links between buying a pencil and the production forecasts of saw-makers, so it is not possible to see how our consumption drives the research and development which produces new products. Nevertheless, the link is real.

Thus, when you buy clothes, you are voting for the development of new clothes. When you buy clothes based on how they look rather than how they last, you are driving research into sartorial elegance over the production of hard wearing fabrics. As consumers, we hold ultimate responsibility for the make up of the market. If we stopped demanding the latest fashions, we could instead direct that energy and talent into Medical research, or ending poverty.  I, for one, have every faith that the market can make huge strides towards improving some of our most intractable social problems. All it takes is demand. Sadly, often those most affected are those with no voice. If you are poor, your problems are invisible to the Market. So who will speak on their behalf?

Thus we come at last to the point. When you make a charitable donation, you are voting for a solution to that problem. So vote for an End to Cancer, or an End to Homelessness, or for the Elimination of Poverty. Vote to end Child Trafficking, or the Sexual Exploitation of Vulnerable Women. Together, we can reshape our economy, and build a better world. All it takes is a little charity.

==========

Charitable giving in the UK by adults is currently less than 0.5% of GDP.