Archive | General Interest RSS for this section

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.

Advertisements

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.

Low Interest Rates, Excess Saving, and Bubbles

It seems like the belief that low interest rates cause bubbles is all the rage. Its superficially such an obvious relation “low rates” means “easy money” which means people “bid up” assets and hey presto instant bubble.

Unfortunately, its all wrong. What really causes bubbles is too much saving. For a given level of technical progress, an economy has an optimal capital stock. We define the the optimal capital stock through its equilibrium condition: there is no productive investment (which can be made by the private sector) which has a risk adjusted return which is better than zero.

Now of course, in the real world there is always new innovation, and replacing deprecated capital, so we would really expect the optimal (real) rate to be slightly above zero. Nevertheless, zero real return on capital is where an economy wants to be, where it strives to be. However, the optimal stock is not fixed, it is in fact rapidly changing. New technology can create new possibilities for investment, or it can render old capital irrelevant. The new tech industries are much less intensive than the old “heavy” industries that they are largely replacing. Nevertheless, this capital stock represents the maximum stock of savings  that can be carried into the future. If people want to save more than this, they have no choice but to invest in assets with a negative real rate of return.

Real capital investments are funded by foregoing consumption in the present in order to get more later. This is what the interest rate asks, it says, how much extra consumption do you need in the future to persuade you to forgo consumption now, so that we can build this useful investment. The more people want to save compared tot he optimal stock of assets, the more negative the real rate of return must become. The more the real rate or return becomes negative  the more “bubbles” people will see.

There is really only one possible strategy for this, and it amounts to aligning the stock of capital investments with peoples desire to save. This is possible because:

(1) Often capital investments are inhibited by real world factors like unstable government, poor human capital, poor infrastructure. Stabilising Africa and parts of the IndoChina region would offer plenty of investment opportunities.

(2) Government funded spending. There are plenty of productive investments that only a government can make, and through either higher taxes (on those who over-save – the rich) or higher deficits (providing more safe assets). These include: Education – the state of UK and US public education is a joke, and severely inhibits future productivity; Infrastructure – some projects are simply too large for the private sector to undertake; Regulation – the UK house market is a typical example, where poor government regulation prevents housing stock being built at the required pace; Free trade – this is a little less obvious, but take for example, US energy protectionism (preventing the export of shale gas), this prevents the optimal level of investment in shale technology, by keeping the price artificially low. On the other hand, it raises the risk premium for investing in oil and gas outside the US (as it could be made unprofitable through an arbitrary regulatory announcement), which reduces investment outside the US aswell. Essentially, people aren’t stupid – they will not invest in a product which depends purely on regulatory trade barriers unless they are convinced that they are here to say.

(3) Transfer payments. By transferring income from those with a high propensity to save (rich people/middle class) to poorer people, you lower the overall savings rate.However, this is not likely to be too effective in a UK/US centric view, as most of the excess savings appear to be coming from Japan, Germany and China as a response to their coming demographic disasters. UK particularly does not suffer from excess savings 🙂

Any time the total quantity of saving is in excess of the total stock of capital, a bubble is guaranteed, by draining savings out the system through government investment, we get higher total productivity, higher interest rates for savers, and fewer bubbles. Win Win Win?

About that housing boom….

It didn’t exist. No Seriously. There was no boom in housing construction.

The constructing in US housing was exactly what was needed to maintain the housing-population ratio in the face of increased population growth. You cannot have an “unsustainable boom” without oversupply. If you are building exactly the amount that you need, and prices are rising anyway, it is the very definition of a sustainable boom.

Its true that housing prices rose and then fell, but they fell exactly the amount that you would expect when there was a peak to trough fall in national income. What does that prove except when people are poorer they will pay less for housing. A change in prices is never the cause of anything, it is always the result of something. The correct way to reason is not “why did an asset crash cause a recession” it is “what caused asset prices to crash”.

Aggregate demand is the only story. The world’s central banks let it fall off a cliff in 2008, when they could have prevented it, purely because they were focused on inflation and forgot about nominal income. They assumed that because, historically, inflation and NGDP had been pretty well correlated, that controlling inflation would automatically control aggregate demand at a healthy level. They, in fact, made exactly the mistake that others accuse banks of having made – that they showed too much trust in their theory and didn’t have enough prudence. If the central banks had been watching aggregate demand, this recession could have been a non event.

HT to Marcus Nunes for the graph.

Ben Bernanke’s Senate Testimony

I always feel that these hearings are usually nothing more than a chance for political leaders to grandstand portray their ignorance. It is usually always easy for a technical expert to come up with an answer which sounds impressive while not really saying a lot, and that most people will be unable to decipher. However, there was one great question, by Klobuchar, which deserved a follow up. (This was well covered by Yglesias):

[Mr Bernanke]… what would you have done differently under a single mandate to target inflation

and Ben Bernanke hummed and hawed and said, essentially, that he would have done nothing differently. This seems a pretty damning indictment of BB’s policy really, if, with unemployment high and inflation consistently below target, you are not going to take the opportunity to do extra stimulus to lower unemployment, what exactly is the point in a dual mandate?

The dual mandate exists because central bankers have known since forever that a little bit of extra demand, which usually creates a little extra inflation, is helpful in lowering unemployment. This is the wisdom of the Philip’s curve, which, for all its flaws, at least underlines the truth that very low inflation is nearly always correlated with high unemployment.

Of course, perhaps BB was aiming an under the radar shot at his FOMC hawks: I mean, with the board that he has, perhaps he is unable to force through policy that is expansionary enough for him to feel that he his fulfilling his legal mandate, but he could have chosen to put forwards the hawk’s argument, which would be that excess stimulus would not help unemployment fall any faster. This is a nice argument for this type of hearing, as there is clearly some empirical limit on how fast unemployment can fall – no matter how expansionary, the Fed could not restore full employment in one day. I am completely certain that it could do a hell of a lot better than it is doing, but I accept that falls in unemployment of more than 2% a year are fairly implausible. And if they attempted that they really might cause some inflation.

Nevertheless, I cannot help but think that BB’s decision to say nothing was itself an overtly political statement about his feelings on the manner. He is required to go and defend Fed policy, even if he was on the losing side of the FOMC consensus. Just as Mervyn King is forced to talk about how the committee feels there the “costs and risks” of further QE outweigh the benefits, even though we know he voted for more QE.

Finally, we can speculate on some nice follow up questions that I might have asked:

BB, do you believe that a more expansionary policy would cause unemployment to drop faster, while keeping inflation expectations steady?

He would almost be forced to answer yes, and now he would be in a really tight spot, then we could ask

BB, given that you believe that expansionary policy would bring down unemployment faster, while maintaining inflation expectations, do you believe that your policy is legal?

Could ask this instead:

BB, it is my understanding that the dual mandate exists because of the well known relationship between higher inflation and lower unemployment. Thus, logically, a dual mandate must lead to higher inflation than a single mandate whenever unemployment is significantly above its natural rate. Do you agree?

Or how about this one:

BB, which members of the FOMC do we need to impeach to enable you to legally fulfil your mandate?

Wouldn’t that have made great TV!

The Apple Tax Senate Hearings

So I did not follow these in particularly great detail, but one thing did catch my ear. Senator McCain accused Apple of pernicious practices which violated the “spirit of the Law”. I really have no time for this argument. If they are interpreting the Law in a manner which the courts uphold as justified, then they are in the clear. In fact, I would say that it is an excuse that politicians use for writing law that is so riddled with contradictions and conflicts as to be essentially garbage.

It is literally the job of legislators and lawmakers to write laws which are clear, concise, and unambiguous. It is a basic requirement of competent government, that the powers that be should be capable of writing Law that does what then intend for it to do. Claiming that a company “violated the spirit if not the letter” is just having a tantrum because you aren’t willing to admit your own incompetence. Its childish and disingenuous.