Saturday, 1 September 2012

Stanford Machine Learning Course

I've recently started the Stanford University Machine Learning course, which is a free online course offered through Coursera. It's taught by Andrew Ng, the Director of the Stanford Artificial Intelligence Lab and also a co-founder of Coursera.

The block of work I've recently finished in my Open University degree was all about multi-variate analysis including discriminant analysis, which is one technique used in machine learning. It was possibly the most interesting area I've studied to date so when I saw the machine learning course starting, I jumped at the chance to learn more.

So far I've just finished the intro and first week's work. Some initial thoughts:

It's not too late to sign up if you're interested!

Machine learning is a field that bridges statistics and computer science: it uses concepts from statistics, such as discriminant analysis and linear regression, but the emphasis is all on using those techniques to get computers to do interesting things. It's interesting to see the difference in emphasis between statisticians and computer scientists. So in my statistics course the aim is to apply the techniques to the data then write an analysis of the results. In the Stanford ML course, the aim is to write some code (in Octave) which uses the statistical techniques to accomplish a particular task.

The Coursera website works well and the course seems to be well designed. It consists of about a dozen videos each week of about 8-12 minutes each, plus a couple of sets of review questions each week and, starting in week 2, a programming assignment. All the questions and assignments are machine-marked, since obviously the cost of £0 doesn't cover a lot of tutor time to mark assignments.

I'd strongly recommend looking through the list of courses on Coursera, there are loads of interesting subjects from physics and maths to sociology and medicine. I think I even saw something on contemporary American poetry.

Overall, I don't see this kind of course replacing students going to university, not to any great extent.  However, it does give people a great way to find out a bit about subjects which are often quite specialised and difficult to start studying, perhaps a way for school leavers to get a feel for particular subjects before deciding what to go off to study, and an interesting hobby that's likely to be somewhat more rewarding than watching the latest reality TV show.

A final thought on machine learning. It is already used very widely, including to identify suspected fraudulent credit card transactions, to create "Other people also bought..." recommendations on Amazon, to drive real cars along real roads, and a million other things, but its usefulness rests on three things: large amounts of data to analyse, fast computers to run the analyses, people to come up with new areas to which to apply it. It strikes me that all of those things are growing and we have so far only scratched the surface of what's possible. The future for machine learning looks very bright.

Friday, 27 July 2012

Romney misses a tap-in

US Presidential hopeful Mitt Romney kicked off his world tour on the eve of the opening ceremony first by openly questioning whether London was ready to host the Olympic Games, then forgetting Ed Milliband's name and following through with a protocol error by referring to him as "mister leader" which is neither his name nor his title, before blabbing about his secret security briefing with the head of the UK intelligence agency, MI6. And it's only Day One. Slow hand clap for Mr Romney.

The Olympics cock-up was particularly foolish because the rules for this one are so simple: when a major international sporting event is about to begin, national leaders must always, as a bare minimum, say something optimistic and bland. You can go optimistic and visionary, optimistic and inspiring, or optimistic and go-getting if you like, but optimism is the basic ingredient in any recipe because it's not about you and you shouldn't overshadow the competitors.

Presidents and Prime Minsters are often called on to make nuanced comments on controversial topics in which they must speak to several different interest groups at the same time. On foreign trips, as a bare minimum, you're talking to both your home country and your host which can create tensions, but this was not one of those times. Even if you think a problem is likely, there are no prizes for saying so. "I have no doubt that will be a great success, and I hope everyone has a wonderful time," is the correct answer. As a bonus, Mr Romney had a nice opportunity to highlight his own experience with the Salt Lake City winter games with a follow up comment on how successful that was. Lots of back-patting all round.

In international diplomacy terms, this is a tap-in. It's hard to think of an easier situation. Yet Romney contrived to slice the ball wildly into the grandstand, leaving his team with a messy but avoidable clean-up and drowning coverage of his visit in a deluge of negative press.

If his plan was to tour the world looking like a President-in-waiting, he's going to need a plan B.

As an aside, Mr Cameron's angry response in which he implied that Salt Lake City is "the middle of nowhere" was also unwise and for the same reason: insulting people in Salt Lake City and those involved with those Olympic Games is unnecessary and bound to backfire. It's not their fault that Mr Romney made a daft comment. Better to smile graciously, thank him for his advice and leave people to form their own view about Mr Romney's good grace.

Facebook update, Q2 2012

Facebook's shares hit the stock market on the 18th May 2012 at $38 per share, and at the time I wrote that it was overvalued at that price. 

The shares did go on to perform badly and lose value, spending most of the time since May hovering around $27-$33, rather than in the $40s as many predicted. However, I didn't think it was worth another post to point this out and gloat about being right, for two reasons:

1) I didn't expect the shares to do so badly, so quickly. I thought the level of mass optimism was enough to keep them flying for months to come, so their actual performance was a pleasant surprise to me*.

2) The movements over short periods are largely random and unpredictable. It's stupid to try to predict them, or to claim credit for such predictions coming true. You might as well predict the rolls of dice.

I subscribe to Benjamin Graham's maxim that in the short term the stock market is a voting machine but in the long term it's a weighing machine. That is, market prices are always potentially subject to fashion, fads, and the whims of popular opinion which are unpredictable, but in the long term true value will out: the good will pull ahead and the bad will fade away.

So here's what I expected to happen: in the short term the price would continue to defy gravity, held aloft by mass delusion, but over time the drip-drip of successive quarterly results coming in below par would eventually become unbearable and reality would break through. Each disappointing set of results would be accompanied by a plausible-sounding excuse, but eventually even True Believers would begin to spot the pattern.

It's worth reiterating that "disappointing results" for Facebook aren't necessarily bad results, even very good results would be disappointing because the valuation is so high. The valuation requires them to consistently set the world alight with amazing results, especially if those original investors at $38 are ever to see any return on their investment. That's why I am sceptical that they ever will.

They released their Q2 results yesterday, so with actual new information to work with I thought I'd have another look. Overall, these are good results: 
  • revenue was strongly up both on the previous quarter and on the same quarter last year.
  • underlying profits were up. There was an overall loss based on what we are told were one-off costs from staff bonuses resulting from the listing (did I mention that each set of results would be accompanied by a plausible excuse for under performance?), but I accept the reason given and the underlying business performance does look good.
  • the number of active users grew strongly.
  • ignoring the exceptional costs, operating margin was 43% which is very good, though it's down from 53% a year ago. 
On the basis of these good results, the share price fell 9% on the day, from what were already low levels compared with May's listing price of $38. They now stand at less than $27. In a nutshell this is the problem that Facebook investors must confront: good results are not enough, expectation is off-the-scale high, so even if the company does well (which it has) people who bought at $38 may lose money (which they have).

Back in May I suggested that PepsiCo would be a better investment than Facebook, based on the arbitrary criterion that both Facebook and PepsiCo were valued at just over $1 billion. Since I expected Facebook to do badly, almost any successful company looked a better bet, so I picked PepsiCo just for grins. Back then PepsiCo's share price was $68, today it's $71.22 and they've also issued a $0.54 quarterly dividend, so buying PepsiCo at $68 you'd have been up by $3.76 or about 5.5%, compared with a 29% loss on Facebook. Slow and steady wins the race...

Disclaimer: I don't hold shares in either Facebook or PepsiCo and I'm not suggesting that anyone else should buy them either. It's just an interesting comparison between a hyped up newcomer and a solid old-timer. I generally I prefer to invest in solid old-timers rather than hyped newcomers, mainly because I invest to make money rather than to join in a party, but I'm a bit dull like that.

* Why am I pleased the price didn't "pop" up into the $40s as many hoped? Because I don't like seeing investors lose money. The higher the price, the greater the losses that will eventually be suffered by unsophisticated investors sucked into buying them on the back of media hype. The quicker the share price gets to a fair price based on sober analysis, the better.

Tuesday, 10 July 2012

Price discrimination

The Internet has been abuzz lately with rumours that on-line retailers are wringing extra cash from anyone judged to be rich, by sniffing through their data trail to work out whether they're a big spender. Are you using a Mac? OK, then you're obviously loaded so how about these more expensive hotels...

This article in The Economist gives a flavour of the debate: how deep are your pockets?

But price discrimination is all over the place and you can make yourself a much savvier consumer by opening your eyes to it, which is what I now attempt to do.

Suppose I run a widget factory, and each widget costs me £20 to make and sell. I have two customers: Alice who's willing to pay upto £30 and Bill who'll pay upto £50. What price should I charge? 

If I charge £30 I'll sell two widgets for a total of £60, minus £40 costs leaving me £20 profit. 

If charge £50 I'll lose the sale to Alice so I only sell one widget, but with only £20 costs I make £30 profit.

So £50 looks like the more profitable price, but I've lost a potential profitable sale to Alice. Charging £30 wins Alice's business but costs me £20 in lost profit on the sale to Bill. What I'd really like to do is charge Bill £50 while finding a way to sell to Alice for £30: that way I'd make both sales and come away with £40 profit. Get in! But how?

That is the art of price discrimination, and it's going on all around you. Here are some of the ways it's done.

Packaging. Bill's widget will come in a fancy "Neil's premium widgets" box and inside, the glossy instruction sheet will be full of colour photos of beautiful people gazing into the middle distance. Alice's widget will come in a plain white box marked "Basic Widget", the instructions will look like they were photocopied by a gibbon. There will be no beautiful people. Maybe the fancy box and instructions cost me an extra £2, but I'm happy to spend a bit on paper and cardboard if I can jack the price up by £20. There's nothing to stop Bill buying the Basic Widget, but he likes the shiny box and he wants to believe that the extra £20 he's paying is for more than just the box.

Environment. The premium widgets will be sold through upmarket retailers with fancy addresses, whose shops are immaculately appointed and staffed by yet more beautiful people. All of that costs money, but Bill's paying for it so that's fine. The basic widget will be sold in supermarkets or discount shops. Bill doesn't buy his widgets in those shops, if he even goes in them, so he never sees the Basic Widgets for £30. Even if he hears about them, he prefers the fancy shops and is happy to pay extra for what he considers a higher quality experience and/or product.

Coupons. Forget the premium/basic idea. Suppose I only sell one widget and it costs £50, but if you collect 14 coupons from the local newspaper, get them rubber-stamped at 5 different places then wave them above your head while standing on one leg I'll sell you one for £30. Alice is happy to do a bit of work to save £20 so she collect the coupons. Bill can't be bothered or he thinks there's social stigma attached to using a coupon, so he pays normal price. Since £50 is normal price he doesn't feel he's paying a premium.

Special discount. One widget, one price: £50. Everyone pays the same. Oh...except if you're a student, we have a student discount. Or over 60, we have an OAP discount, too. The game here is to guess why Alice is only willing to pay £30. If it's because she's in some identifiable group of people who're generally less willing to pay high prices, we can offer a discount to that group.  For this to work the group needs to be seen sympathetically by most people, since that's how we avoid a stampede of complaints from the customers left paying the higher price.

Premium product. My widget normally has a plastic on/off switch. It costs an extra £1 to install a fancy metal switch instead. Now it's not just a shiny box, the product has been made fractionally better! That'll be an extra £20, thank you.

Instant gratification. Bill's a busy commuter rushing to work, so I'll stand right in the most convenient spot on the train platform and sell him the widget for £50. He hardly has to break stride. If he cared to walk 2 minutes round the corner he'd find my other shop which is selling the same widget for £30. Here, customers are in less of a rush and are willing to price check a bit more, so I can't get away with the higher price.

Negotiation. The price is marked £50, but if you're willing to haggle you might find that I can be persuaded to offer a discount. Though if you look like a rich tourist you might find that I don't move very far.

Accessories. The widget costs just £30, but please do take a look at my exciting range of accessories. For example, this faux leatherette carry case for just £20: you want to be able to carry your widget, don't you Bill? The price sensitive shopper is likely to ignore this overpriced tat select range of enhancements, but Bill's just paid £30 for a widget when he was willing to pay £50 so he has some extra cash looking for a home, which I am happy to supply.

Shelf position. Neil's Premium Widgets enjoy a prominent shelf position on the end of the supermarket aisle or right at shoppers' eye level. My basic widget, in the plain box, is right down near your left ankle where you may not even notice it. This means I can have both products in the same shop practically next to each other, and still maintain the price difference. Supermarkets are brilliant at this, and they charge large sums of money to suppliers who want their goods positioned on the best shelves (around eye level). Even so, Bill's paying an extra £20 for the premium widget so that should cover the shelf positioning fee.

Social status. This cuts across a number of the tactics from shiny packaging to stocking the premium widget in fancy shops, but also includes money spent on advertising. The idea is to suggest that people who pay £20 extra for the widget in the fancy box are exactly the sort of people you want to be. The people with the basic widget are...well...they're not really your sort of people, are they? If you buy the basic widget you'll look like them, which means you won't be like the sort of people you want to be like. And you don't want that, do you? What would your friends think? Yes, naturally you want the premium widget, and it's just £20 extra, which people like you can easily afford.

In general, the game is to identify people who're willing to pay extra then find a fig leaf to justify your ruse to charge them more. Alternatively, you identify people who refuse the high price then you find a way of selling to them at a lower price while keeping the big spender locked onto the higher price. Preventing the big spender noticing the lower priced alternative, or preventing him from seeing it as a valid alternative, is the big challenge. 

If you're someone who likes to buy quality, someone who's willing to pay a premium for a superior product or a brand name, it's worth asking yourself how confident you are that the premium product actually is any better: have you tried the cheaper version? Sometimes you're paying extra for better quality, sometimes you're paying extra for the exact same thing in a shiny box sold by a beautiful person in a fancy shop. Only you can decide whether that's worth the extra. If you think it is, rest assured someone will be very happy to assist you.

Monday, 9 July 2012

Troll filters

Connecting people is the Internet's biggest achievement, but also its biggest problem. The ability to assemble a huge crowd of angry idiots is not new, but the scale and severity of the problem is growing and the tools to deal with it are weak.

For example, if thousands of people start mentioning you on Twitter, it completely spams out your feed making the whole thing unusable. It happened recently to a woman whose name is similar to a UK bank: she started receiving hordes of abusive tweets. It seems to happen to most celebrities and athletes: random morons decide to send abusive, derogatory or unpleasant messages. It seems to be especially vile when directed at women. It also appears on comments at the bottom of articles, and presumably it would also be a problem on other social networks, such as Google+, if anyone were actually using them.

There are two general ways of dealing with it and both are rubbish:

  1. Make it hard or annoying for people to send you a message. So blogs can force people to register or squint at an illegible word before making a comment, Twitter users can protect their tweets so only permitted followers can see and respond, but you may not want to block all strangers, only the morons.
  2. Block specific people. If Bob is harassing you, you can block Bob. That's great if it's just Bob, but if it's a seething mass of anonymous trolls, or if Bob keeps creating new sockpuppet accounts, it becomes tedious and impractical.
The status quo seems to work for most people, but it's a serious problem for some and if it happens to randomly strike you then you may be driven completely away from social media which you've hitherto been enjoying, because you're powerless to hold back the flood.

To me, this feels a lot like email spam a decade ago: annoying but tolerable, and the tools to deal with it sometimes caused as many problems as they solved. Then in the mid noughties email spam filtering got good: now it could block virtually all the bad stuff, let through virtually all the good stuff so email spam just went away. When we implemented this new spam filter on the email system where I worked it was as if we'd flipped the spam off switch.  I was sceptical of the company's claims because I'd read it all before and seen the mediocre reality, but for once the claims were accurate and I was instantly converted: it was one of the best things we ever bought.

Similar advanced filtering technology is the only realistic way we'll be able to deal with trolls and other social media spam. We'll ditch the unworkable idea that you can individually block everyone who's spamming you, we'll do away with peering at wobbly text: we'll find that humans can happily go about their business while all the trolls, spammers and sundry mouth frothers are pinned behind the invisible electronic barbed wire. 

You may think that it can't be done, that it's too subtle a problem, but I used to think that about filtering email spam. When was the last time you received email spam? We implemented that new spam filter in about 2005 and I've seen virtually none since then. Roll on the troll filters.

Sunday, 20 May 2012

Greece will stay in the Euro

A few months ago mention of the Euro currency area breaking up, of countries going back to a national currency, was officially verboten. Today the impossible has become the inevitable: between the crushing depression era poverty, the silent-but-deadly run on Greek banks, the clueless indifference of EU élites and the voters' flight from mainstream parties everyone is now confident that it's only a matter of time before Greece reverts to the Drachma and the Euro dream is officially over.

I think they're wrong. Today I bet* a modest sum that Greece will still be in the Euro at the end of 2012 and that the Euro will still exist as a currency in 2015. 

I wrote last week that there are only 3 possible ways out of the Euro problem:

1. Richer Euro members make large annual payments to poorer members.

2. Richer Euro members guarantee poorer members' debts.

3. The Euro breaks up.

All 3 solutions have been ruled impossible, but eventually at least one of them must happen. It's an interesting problem.

Media opinion seems to be swinging behind the idea that we're heading for breakup, but the more I think about the practical details of that the more I doubt that it will be allowed to happen. The logistics of the thing are overwhelmingly difficult and in the short term it will make life in Greece even worse, and already it's pretty bloody grim.

The argument for breakup is that it will cause even more short term pain, but in the long term things will be better. However, that's not the kind of decision that the EU's leaders tend to take. They do not like to be brave. They do not tackle difficult choices head on. They do not take a bold position and risk being wrong. 

Instead, they like to hide, to shrink from controversy, to smother people with warm words and euro-babble until their goal has been achieved without anyone really noticing. Most of all, they like to make the European Union bigger, grander and more powerful. For these reasons, and especially the last, I think they will do absolutely everything to avoid Euro break-up.

So we're back to impossible option 1 or impossible option 2. I suspect we will see a combination of the two: 

- a clear expression of solidarity that the whole eurozone will stand behind each of its members' debts. This is necessary (and hopefully sufficient!) to prevent the run on Greek banks which is already happening. I suspect mutual guarantees rather than official eurobonds, because it's fudgier and the EU likes to fudge.

- large cash transfers (which will be described as a temporary measure) to ease the burden on the Greek people, who are genuinely suffering. Offering more loans would be easier to sell, politically, but I think (or at least, I hope) they will realise that the arithmetic of even more debt simply doesn't work.

But the quid pro quo will be an enormous degree of EU control over national budgets, taxes and economic reform. The Fiscal Pact is just the beginning. If northern Europeans agree to underwrite and subsidise the Club Med states to this extent, then having different pension arrangements, employment protection, closed shop economies and so forth will become politically untenable. The south will have to reform and I can't see the north just trusting that they'll do it by themselves: it will be managed from Brussels.

Germany has benefited greatly from being in the Euro: its export-driven economy has been able to relentlessly sell goods to most of the rest of Europe without its currency rising, which would have made its exports dearer to foreigners. This has been a windfall for German businesses and a burden on almost everyone else. The Germans are not keen to acknowledge this, preferring the "hard working Germany, lazy southern neighbours" narrative, but it's true nonetheless. I think that will provide the cover to sell the idea.

The other benefit is that it avoids any dramatic climax. Money will be quietly bled from one group and given to another, but the hope will be that no one really notices and there'll be no key moment to galvanise opposition. That's exactly how the EU likes to operate. 

Coincidentally, the plan involves the EU becoming even more powerful at the expense of member states, which is really the only thing that they care about.

That's why, for my money, the Euro will survive and Greece will probably stay in it.

* William Hill offer a market to bet on the euro, albeit intermittently. They were offering 3 markets earlier today: Greece to leave Euro in 2012, Euro to still exist in 2015, and which country will be the first to leave. But this evening they are no longer taking bets on any of those markets. There was no explanation given, but I assume they'll reappear at some point. I presume that volatility is the reason, or perhaps they're only willing to take so much exposure. Ladbrokes have sometimes offered a market on the euro, as well.

Friday, 18 May 2012

Facebook is overvalued

You may have heard in the news that Facebook gained a stock market listing today, trading at around $38 per share. That values the company at $104 billion which is 88 times its annual earnings, or an earnings yield of about 1.1%. 

Oh, hold on, my phone's ringing.

That was the 90s on the phone, they want their insane tech stock valuations back. Actually, that's not fair: Facebook is at least profitable and cash generative, so we are spared idiotic analysis about rates of cash burn.

Personally, I am inclined to value Facebook at between $6.30 and $8.60 per share. That would value the company at 15 to 20 times its earnings or an earnings yield of 5% to 6.7%. If you feel really optimistic, maybe go to $10 which would be just over 23 times its earnings or 4.3% earnings yield. But $38 is just batshit insane, it's hard to see how anyone buying at that price will make money, other than by selling it to someone even more stupid (the Greater Fool Theory of investment).

Many would call my valuations over-cautious, especially all those people today who've paid 5 times my suggested price to buy Facebook shares. They will argue that Facebook is growing rapidly, will continue to grow rapidly, its future profits will be immense and I am an idiot to pass up such an opportunity. Perhaps that's true.

I would argue that Facebook's profits must grow about 500% even to justify today's price, and once they've grown by that amount those profits would still need to show strong signs of future growth if you expect to make any money as a shareholder. There is a vast reservoir of optimism baked into that $104 billion price. Even if the company does grow, its shareholders could lose money if the growth isn't rapid enough. As the economy recovers I'd expect advertising revenue to pick up, even so Facebook is a long way from demonstrating that it can actually generate $5 or $6 billion in profits; currently it's earning about $1.1 billion from revenues of $4 billion. Assuming it maintains its 24% profit margin, its revenues need to reach about $25 billion to justify today's price, and would need to look like continuing to grow from there. Maybe they will, maybe they won't.

There is also the risk that 2, 4 or 10 years from now people are just kinda bored with Facebook and go somewhere else. Ten years is a long time away: no one can predict online social trends so far into the future, but Facebook's price says they can predict at least that far. 

As it happens, the snack and beverage group Pepsico is valued at about the same price as Facebook: $106 billion on today's share price of $68. Last year they had $67 billion in revenue and earned $6 billion in net profits. Which company looks like the stronger bet? What are the odds that people are still drinking Pepsi, 7up, Tropicana, Mountain Dew or Lipton, while eating Walkers, Doritos or Lay's, or Quaker oats 10 years from now, versus the odds that Facebook is still going and has revues and profits 10x today's?

Just for fun, I'll track the revenue, profits and valuation of Pepsico and Facebook to see how things pan out. Feel free to bookmark this post so you can pop back periodically to laugh in my face, comments will remain open :)

All financial data from Yahoo! finance, correct as far as I'm aware. I've not personally taken a financial position in either Pepsico or Facebook.

Thursday, 17 May 2012

Every major's terrible

I'm a big fan of the XKCD comic, but Randall has truly surpassed himself with this effort. Genius.

If you need a refresher on the original, or want to sing along with the new lyrics, try this:


Inevitably, YouTube is now full of people performing this! I vote for this one as the pick of the crop:

Monday, 14 May 2012

Greek arms spending

Enlightened Economist Diane Coyle blogs about a surprising and little-reported area of Greek government spending: weapons.

Greek flag

She points out that by 2008 Greece was the 5th largest arms importer in the world, and the 2nd and 3rd largest customer for German and French arms exporters, respectively. France and Germany are Europe's biggest arms exporters. (The UK is 3rd)

Last year Greece spent 3.2% of its GDP on arms, the highest in Europe. Apart from big military spenders UK and France (2.6% and 2.3%) most European nations spend around 1.5% of GDP on arms. As it battles a 9% deficit, why isn't there any debate about the very large 3.2% share of national income being spent on the Greek military? 

It also underlines the circular nature of some of the bailouts: if Greece had no bailouts it may be forced to slash arms spending and contemplate defaulting on the loans (presumably from French and German banks) which funded previous purchases. In which case, the benefit is really falling on the French and German arms exporters and banks rather than the Greek people.

The popular narrative that strong, prudent nothern Europeans are being asked to ride to the rescue of feckless Greeks is simplistic. The financial and trade relationships are complex: the ultimate beneficiaries much less obvious than it first appears.

Friday, 11 May 2012

Happy Birthday Mr Feynman

Richard Feynman was born on the 11th May 1918 in Queens, New York. Had he not died in 1988, today would be his 94th birthday.

Idolising people is not my style, but Feynman is one person whose attitude and approach to life I would be happy to follow. The importance of cutting through received wisdom to find the truth using experiment and evidence; the sense of fun and exploration of the world; valuing real accomplishments over honours, titles and pomposity; the playful intelligence that is at once toying with a problem and seeing through it with great insight; the humanity and compasson. Both genius and buffoon.

I offer some thoughts from the man himself.

"The first principle is that you must not fool yourself, and you are the easiest person to fool."

"We are at the very beginning of time for the human race. It is not unreasonable that we grapple with problems. But there are tens of thousands of years in the future. Our responsibility is to do what we can, learn what we can, improve the solutions, and pass them on."

"It doesn't seem to me that this fantastically marvellous universe, this tremendous range of time and space and different kinds of animals, and all the different planets, and all these atoms with all their motions, and so on, all this complicated thing can merely be a stage so that God can watch human beings struggle for good and evil — which is the view that religion has. The stage is too big for the drama."

"Looking back at the worst times, it always seems that they were times in which there were people who believed with absolute faith and absolute dogmatism in something. And they were so serious in this matter that they insisted that the rest of the world agree with them. And then they would do things that were directly inconsistent with their own beliefs in order to maintain that what they said was true."

"The real question of government versus private enterprise is argued on too philosophical and abstract a basis. Theoretically, planning may be good. But nobody has ever figured out the cause of government stupidity—and until they do (and find the cure), all ideal plans will fall into quicksand."

"For a successful technology, reality must take precedence over public relations, for nature cannot be fooled."

"It doesn’t matter how beautiful your theory is, it doesn’t matter how smart you are. If it doesn’t agree with experiment, it’s wrong."

"I can live with doubt, and uncertainty, and not knowing. I think it's much more interesting to live not knowing than to have answers which might be wrong. I have approximate answers, and possible beliefs, and different degrees of certainty about different things, but I’m not absolutely sure of anything, and in many things I don’t know anything about, such as whether it means anything to ask why we’re here, and what the question might mean. I might think about it a little, but if I can’t figure it out, then I go to something else. But I don’t have to know an answer. I don’t feel frightened by not knowing things, by being lost in a mysterious universe without having any purpose, which is the way it really is, as far as I can tell, possibly. It doesn’t frighten me."

"The first ... has to do with whether a man knows what he is talking about, whether what he says has some basis or not. And my trick that I use is very easy. If you ask him intelligent questions — then he quickly gets stuck. It is like a child asking naive questions. If you ask naive but relevant questions, then almost immediately the person doesn't know the answer, if he is an honest man."

Back in 1981 BBC Horizon interviewed Feynman at length: the entire programme was Feynman talking about his life, family, work, influences and ideas. It's been put on YouTube and I highly recommend watching it in full, not only for the fascinating interview but just to marvel that 30 years ago it was possible to make a TV science programme that treated its viewers as intelligent, thoughtful, and able to concentrate on something interesting for 50 minutes. Though it appears that even back then, cheesy computer graphics were de rigeur.

Feynman's BBC Horizon interview, 1981.

Liquidity or solvency problem?

It's rarely discussed in the media, but at the heart of the crisis in government borrowing is one question: is this a liquidity crisis or a solvency crisis?

You can't understand the problem without understanding that question. I think the media avoid it because it seems technical, and perhaps the people in the media don't understand it themselves, but the technical-sounding terms hide two very simple concepts which I shall now explain.

Scenario 1. You are on a night out but you've lost your wallet leaving you unable to pay for your taxi home. You have money in the bank, but at this precise moment you have no way of using it to pay the taxi driver. You have a liquidity problem: you have money but temporarily can't get to it.

Scenario 2. Your owe money, the bills are piling up, you have no savings, no assets to sell and therefore no realistic chance of paying those bills. Even if You borrowed money to cover the shortfall you are only delaying the inevitable. You have a solvency problem: you have run out of money.

In the beginning, the debt crisis was seen as a liquidity problem: struggling banks and countries were good for the money, but they needed a little help to get though a temporary tight patch. Rich countries agreed to lend them money to tide them over, on the assumption that they would get all the money back, plus interest. Everyone's a winner.

Over time the problem grew and people started to wonder whether this really was just a liquidity problem: could it be a solvency problem after all? Is it possible that the money may not be repaid? That is the stomach-churning thought that led the bond markets to flee at-risk countries and raise the interest rates of many others. Who wants to lend money to someone if they cannot pay it back? Is it even ethical to do so? As each successive bailout failed to solve the liquidity problem it was aimed at, the concern that this was really a solvency problem grew stronger.

But if the distinction is so simple, how could so many smart people confuse them? To see how it can be difficult in practice to distinguish the two, imagine scenario 3. It's 5 days until pay day, you are owed your wages by a reliable employer but you've had a difficult month with car repairs, have run out of money and need to borrow a few quid to buy food. This looks like a liquidity problem: in 5 days you will receive your salary, repay the loan and all will be well. A friend, relative or pay day loan company might well decide to lend you the money, confidently expecting to see it repaid.

But what if you return again with the same story the following month? And then the month after that? Your temporary difficulty, your exceptional expenditure, starts to look less exceptional and your financial difficulty seems less like a lack of liquidity and more like a flat-out lack of money: insolvency. Suddenly people start calculating that if they lend you money that'll be the last they see of it, and if you're going to go bankrupt it's better that you don't take their money down with you. But what if you really are just having a terrible run of luck and with help you will thrive and repay? If so, your creditors may be cutting you adrift and, if you're a country, creating enormous problems which could be avoided. That is the dilemma.

The dilemma is obscured in the maelstrom of daily discussion about other things: should you try to kick your expensive smoking habit? Pack in your gym membership and cable TV? Find ways to earn more money? Break away from a disastrous currency union which is preventing you from using monetary policy to ease the pressure on fiscal policy? But your overall strategy must always be guided by whether you are solvent but illiquid and therefore in need of bridging finance, or insolvent and destined for bankruptcy, in which case you may be better to grit your teeth and get on with it.

Specifically with Greece, it has now "restructured" some of its debt, which is the euphemism for telling its creditors that it is insolvent and making an agreement to repay a lower amount on extended terms. But most of the debt that remains is not owed to banks, who were strong-armed into agreeing to a restructuring, but to fellow European countries who lent money when Greece was already in difficulty with specific assurances that they would definitely be repaid. This borrowing was not "restructured" alongside the commercial loans, because doing so was considered politically impossible. I think it is also economically inevitable. Just one more part of the Euro problem in which political ambition will eventually be smashed on the unyielding rocks of economic arithmetic.

Quote of the day - euro complacency

From David Frum on Twitter:

"Weird punditry moment. I just taped a segment for Fareed Zakaria's weekend show in which 2 distinguished Europeans refused even to take notice of my suggestion that the employment crisis in southern Europe was attributable to the Euro. It was as if I'd committed some horrible social gaffe, from which decent people must avert their eyes.

Totally agree (obviously!) that countries like France have deep structural problems, need more flexible labor markets, etc. But Europe is like a patient with high blood pressure who has just been hit by a truck. Diet and exercise will only do so much..."!/davidfrum

In a nutshell, this captures the problem with the EU: a self-appointed elite is dogmatically pursuing its warped vision of European unity come what may, and no evidence or opinion which challenges that dogma is allowed to be taken seriously.

If half of Europe hadn't decided to band together in a single currency, today's problems would be serious but solvable. Instead, the Euro club has turned a difficult problem into a borderline unsolvable problem - the burning building with no exits, in Mr Hague's shrewd analogy. Meanwhile, the refusal to accept even the possibility that the Euro currency is part of the problem means that far from working towards a solution, the EU's cheerleaders continue to make things worse.

There are only 3 possible solutions to the problem:

1. Rich eurozone countries agree to large, permanent subsidies, called transfer payments, to the poorer countries. This would continue for ever, or until the poor countries become as rich as the rich countries (ie: for ever).

2. Rich eurozone countries guarantee to underwrite the credit risk of poorer countries, by issuing joint debt: so-called eurobonds. So euro countries wouldn't issue their own debt, it would be issued centrally and all of the countries would be jointly liable.

3. The eurozone breaks up.

Basically, option 1 means that rich countries give cash to the poor countries to cover their debts, option 2 allows weak countries to shelter under the strong credit rating of richer nations, option 3 means that poor countries gain a floating exchange rate to ease pressure on national finances (ie: devalue their currency) and are no longer in a position to drag richer countries under.

Anyone who talks about solving the European economic problem without doing one of those or a combination of them, is not actually talking about solving the European economic problems. There are no alternatives.

Option 1 is how Germany mainly dealt with reunification: the richer West Germany has so far spent about €1.4 trillion rebuilding East Germany's infrastructure and economy. Rapid catch-up growth and "a flowering" in the east were promised, but more than 2 decades later the former East German areas are still the poor relation, still needing transfer payments, still lagging far behind their western compatriots. Worse, the process seems to have stagnated. Hardly surprising that Germans suspect that if the same experiment were tried again, but this time with Greeks, Spaniards, Portuguese, etc, it would be even less successful. Throw in that some southern Europeans are retiring to a life of Mediterranean sunshine in their 50s while Germans would toil into their late 60s to pay for it, while still carrying former East Germany, and it's easy to see why Germans aren't rushing to sign up.

Germany has point blank refused option 2, which is sensible because it would be reckless to take on liability for another country's debts unless you control their spending. It would be like agreeing to become jointly liable for your over-spending cousin's credit cards: unless you can gain control of his overspending, he'll just drag you down with him. Interestingly, this is a big part of why Greece got itself into this difficulty in the first place: the presumed guarantee from creditworthy eurozone countries allowed Greece to borrow far more (and at far lower interest rates) than it could have as an independent nation. Chaos broke out when it became apparent that the presumed guarantee was not really there. So the eurobond plan is unlikely to fly unless eurozone countries give up most of their autonomy and become states within a federal EU with the bulk of spending and taxation policy decided at the EU level. The EU Fiscal Pact and associated budget monitoring powers are designed as a major step in that direction, but it's still a long way short, and already it is proving difficult to agree.

More to the point, the flurry of Euro summits over the last 12 months has proven that Germans in particular are unwilling to countenance either option 1 or option 2, and for sensible reasons. So that leaves option 3: breakup. But no one wants to talk about that either.

Instead people are sipping their wine, nibbling their canapés, making polite conversation about the weather and pretending that this is just a liquidity problem. One last heave on the Borrow & Bailout Plan, lads, I think it might work this time!

The problem behind all of this is the point made so often that it has become a cliché, but it is no less true for that: there can be no European democracy because there is no European demos.

When push comes to shove, Greeks, Germans, French and Portuguese will each vote in their own national interest, so even if national leaders agree on a way to face down a difficult problem, that agreement is always at risk of voters deciding to renege on their commitments and replace their leader. I predict that we will see that happening again and again in elections across Europe.

Monday, 30 April 2012

Mayor of London

With just 3 days to the election, former Labour Party and GMB union man Dan Hodges becomes the latest Labour Party supporter to come out against Ken Livingstone, in fact he is urging Labour supporters to vote for Boris:

"That’s why on Thursday I’ll be casting my vote for Boris Johnson. I’ll be supporting my local Labour GLA candidate Len Duvall, and voting Labour in the top-up. But I’ll also be voting against Labour’s mayoral candidate, and I hope he loses."

 And here's why: 

"Forget the number of cycle lanes or who attends how many meetings of the Mayor’s office on crime. The number one responsibility of the Mayor is to unify our capital, and give a voice to all of its citizens. And there is a single, absolute, uncontestable truth known to anyone who has worked with Ken Livingstone, written about Ken Livingstone, observed Ken Livingstone or spent more than five minutes in a room with Ken Livingstone. Ken Livingstone is one of the most crudely divisive figures in British politics.

And there is another truth that has emerged over this campaign, one which Labour activists cannot stomach, but which needs to be faced all the same. The candidate who has come closest, at a time of renewed political polarization, to being a unifying figure is Boris Johnson. As Labour’s own campaign coordinator Tom Watson admitted last week, “there are a number of people who tell us on the doorstep that they would vote Labour if there was a general election tomorrow but are currently considering voting Conservative because they either a) like Boris Johnson or b) don’t like Ken”.
Unpalatable though it may be, it’s the Blue rosette-wearing, Bullingdon-baiting posh boy who is reaching out across party lines. It is Boris Johnson who is defying the laws of political gravity, and is now favourite – thanks to the support of hundreds of thousands of Labour voters – to prevail on Thursday. And it’s Ken Livingstone, self-styled man of the people, who has become so unpopular with those supporters that he has had to remove his name and photo from his own campaign leaflets.
No more excuses, and turning of blind eyes, and resigned shrugs about “Ken just being Ken”. London needs someone who can speak for all of London, not just the balkanized segments whose votes he craves. If that guy happens to be a Tory, or a Martian, it doesn’t bother me. I’m obviously not quite as tribal as I thought I was.
We’ve held our noses and voted for Ken again and again and again. Not this time. On Thursday hold your nose, and vote for Boris Johnson."

Meanwhile, despite promising a month ago to clean up his act and campaign "on the issues that matter to Londoners", this morning Ken's campaign is putting out a photoshopped image of Boris, Cameron and Osborne looking like blue space slugs. That is actually Ken's campaign message in the final week: "Vote for the red newt not the blue slug!". And this man would be Mayor of London?

Vote Boris on Thursday.

Friday, 27 April 2012

Europe's Embarrassing Problem

No, not the Euro, the other one - measles.

"While every country in the Americas, including its poorest, wiped measles off the map in 2002, Europe has been unable to do so. Cases have quadrupled since 2009, and the reemergence has become a threat to other countries. In 2011, the United States had 222 cases, the highest number since 1996, and most importations come from Europe."

So says Kai Kupferschmidt in the latest Science magazine.

Notice that the USA is concerned about a rise in cases to 222 in 2011, whereas Europe had 26,074 cases just from January to October 2011. Even worse, Kai points out that:

"Measles' stubborn persistence in Europe would also be a stumbling block in any plan to eradicate the disease globally."


Here in the UK we were well on our way to eradicating measles thanks to the MMR vaccine introduced in 1988 and the MR catch-up campaign in 1994, as this graph from the Department of Health shows:

"MR campaign" was the measles and rubella catch-up vaccination campaign run in 1994 to vaccinate 5-16 year olds who missed the MMR vaccine which didn't exist when they were babies. The yellow line (using the scale on the right) shows the percentage of population vaccinated against measles.

Three things jump out from this graph.

  1. MMR vaccine is amazing, it came close to stamping out measles in this country.
  2. MMR is better than single measles vaccine. There's no conspiracy theory here.
  3. Andrew Wakefield published his discredited lies about MMR and autism in 1998, watch the yellow line nosedive. Way to go Dr Andrew *slow hand clap*
You hear a lot of rose-tinted claptrap from adults about childhood diseases, "measles didn't do us any harm when we were kids", but the people who say that are the ones who didn't die from it. Survivor bias. 

In 1988, the year that MMR was introduced in the UK, 16 people died of measles. Between the start of the measles vaccination in the late 1960s and the MMR vaccine arriving in 1988 the UK typically saw between 10 and 20 measles deaths every year. If you're one of my old school friends born in 1977 or 1978, those years saw 23 and 20 measles deaths respectively. That was everyday life before MMR.

Before the single measles vaccine it was even worse: seeing 50-100 measles deaths in one year was quite normal, and a bad year such as 1961, 1963 or 1965 over 100 were killed by measles. Back in the 1950s it was worse still: the year my dad was born, 1950, there were 221 measles deaths followed by another 317 in 1951. The majority of all these measles deaths were children, of course.

It's little surprise that people hailed the measles vaccine in the 1960s and then the MMR vaccine in the 1980s as a wonder, and why there was a big push to get older children caught up with the MMR vaccine once people had seen just how effective it was. In the UK alone, thousands of deaths and millions of cases of measles have been avoided thanks to measles and MMR vaccination programmes.

More recently, there's been a huge worldwide effort to cut measles deaths through vaccination. Around half a million people died from measles in 2000, but ten years of effort to vaccinate brought that down to 140,000 in 2010. Most of these remaining deaths are in India and parts of Africa where vaccination levels remain low. It's hard to think of any health programme that's saved more lives and avoided more suffering than vaccination, apart from water sanitation.

Meanwhile, measles outbreaks continue to rage across Europe thanks to European parents who do not vaccinate their children, in contrast to the Americas where concerted vaccination effort has almost eliminated the disease even in poor nations. As the rest of the world strives to eradicate measles, Europe remains a major source of infection not because of poverty or lack of vaccine availability but through choice.

* Measles data from the UK's Health Protection Agency:

Sunday, 15 April 2012

The eurozone recession strategy

Nouriel Roubini has written an excellent article summing up the basic problem in the EU: a big push to solve the problem of too much government debt by cutting government spending without any apparent thought to boosting economic growth. This is a self-defeating recipe for, at best, anaemic growth and, at worst, continuous recession. Unfortunately, the UK government seems to be pursuing a depressingly similar plan. 

Roubini captures the problem neatly:

"The trouble is that the eurozone has an austerity strategy but no growth strategy. And, without that, all it has is a recession strategy that makes austerity and reform self-defeating, because, if output continues to contract, deficit and debt ratios will continue to rise to unsustainable levels. Moreover, the social and political backlash eventually will become overwhelming."

Regarding the social backlash, it amazes me that the Greeks have remained so stoic considering the demands being made of them. If the economy does not start to grow this year, people may reach the conclusion that all this was for nought at which point all bets are off. Unsurprisingly, opinion polls in Greece show strong and rising support for political parties which advocate a "default and exit" approach and if the current plan continues to yield nothing but hardship people will naturally start to wonder whether the alternative could be much worse.

Thursday, 12 April 2012

Statistical joke

"This chart indicates the probability that I am
bleeding heavily from my index finger."

A trio of statisticians was on a train going to a conference, sitting alongside them was a trio of economists. As they chatted about this and that, the economists learnt that the statisticians only had one train ticket between the three of them.
"How do you expect to get away with that?" Asked one economist.
"No problem, we have a technique for that," came the reply.

When the conductor came along checking tickets the three statisticians all hid in a toilet. The conductor knocked on the toilet door, their one ticket was slipped underneath, punched and handed back.

"That is an impressively cunning plan!" observed the senior economist after the statisticians had returned to their seats, "I wish we'd thought of that."

Seeing the opportunity to reduce costs, for the return journey the economists bought just one ticket between them and boarded the train. Shortly afterwards, the statisticians boarded and sat next to them. They exchanged pleasantries whereupon the economists excitedly revealed that they had adopted the statisticians' technique and planned to travel using just one ticket between three.

"Jolly good," nodded the senior statistician, "though in fact we have no ticket at all this time."
"What? How can you get away with that?" gasped the economist,
"Don't worry, we have an advanced technique for that,".

Just then the conductor was sighted so the economists disappeared to the toilet with their ticket and their plan. Meanwhile, two of the statisticians went to the adjacent toilet while the third paused a moment then walked over to the economists' toilet and knocked firmly, "Tickets, please!". The ticket was slipped underneath and the third statistician joined his colleagues.

A few moments later the conductor knocked on the toilet door: the overture to a long, heated and rather embarrassing scene involving one angry conductor, three red-faced economists caught together in flagrante in a train toilet and much amusement for the rest of the train.

The lesson: make sure you understand the principles behind a statistical technique before trying to apply it.

Monday, 9 April 2012

Simpson's Paradox

Simpson's Paradox is one of those subtly baffling situations in which statistics leads you along a perfectly logical path, where everything is simple and obvious, until suddenly you're left with your head spinning in confusion. It illustrates how the ideas of "on average" and "overall" can be surprisingly misleading, so beware of taking them at face value.

Edward Simpson, a WWII codebreaker in Bletchley Park, described the effect named after him back in 1941.

To see how it works let's look at a 1986 study* into different methods for treating kidney stones: keyhole surgery versus open surgery. All the figures below are taken from this study, they are real results from actual patients.

Treatment of kidney stones using keyhole and open surgery

Treatment         Success  Failure  Total  Success%
Keyhole Surgery       289       61    350       83%
Open Surgery          273       77    350       78%

The table shows the result of 700 patients, 350 receiving each treatment, how many were successful and unsuccessful under each treatment, and finally the percentage success rate per treatment

So based on 350 patients undergoing each treatment, this paper found that the overall chance of a successful operation was 83% with keyhole surgery versus 78% using open surgery. So keyhole surgery was, on average, more successful than open surgery. That's simple enough. But not all kidney stones are the same, so let's pull out just the results for large stones, defined in the paper as 2cm or more in diameter:

Treatment of large kidney stones

Treatment         Success  Failure  Total  Success%
Keyhole Surgery        55       25     80       69%
Open Surgery          192       71    263       73%

Ahh, interesting: this shows a higher success rate for open surgery. So in this study it seems that despite keyhole surgery being more successful overall, when dealing with large kidney stones open surgery is better: it succeeded 73% of the time, compared with 69% for keyhole surgery. This must mean that for small stones keyhole surgery is far has to be, otherwise how could it come out ahead of open surgery on average? Let's check:

Treatment of small kidney stones

Treatment         Success  Failure  Total  Success%
Keyhole Surgery       234       36    270       87%
Open Surgery           81        6     87       93%

So open surgery has a higher chance of success, by 93% to 87%. Er, what? How can open surgery be more effective at treating small stones as well? One treatment is better in all situations, but worse overall?

What's going on?

So the study found that open surgery is better than keyhole surgery for large stones and it's also better for small stones, but overall it's worse! How can that be? You may be thinking that I've omitted to mention a "medium" category, but there isn't one. You can check the tables to confirm that the total number of patients (700) is equal to all the small cases (357) plus all the large cases (343): nothing is missing. 

So what's going on? How can open surgery be better for both large and small stones, but come off worse overall? Simpson's Paradox! But is it just a statistical trick or is there something real going on? Remember we're dealing with real research into real patients with real (and probably very painful) kidney stones. The point of the research is to find out which treatment gives patients get the best chance of success, so what is a doctor supposed to recommend based on this? A coin flip?

The answer becomes clear if we look closer at the two tables breaking down small and large cases. Here they are again.

Treatment of large kidney stones

Treatment         Success  Failure  Total  Success%
Keyhole Surgery        55       25     80       69%
Open Surgery          192       71    263       73%

Treatment of small kidney stones

Treatment         Success  Failure  Total  Success%
Keyhole Surgery       234       36    270       87%
Open Surgery           81        6     87       93%

First, notice that regardless of which treatment is used, the chance of success when treating a small stone (87% or 93%) is always much higher than the chance of success when treating a large stone (69% or 73%). Small stones seem to be inherently easier to treat.

Second, notice that keyhole surgery was mostly used to treat small stones whereas open surgery was mostly used to treat large stones. The overall table shows 350 treatments using keyhole surgery, but more than 3/4 of them were treating the inherently less risky small stones. In contrast, 3/4 of the open surgery treatments were on patients with a large kidney stone. 

So in this study, keyhole surgery was mainly used to treat the lower risk cases, while open surgery was mainly used in the higher risk cases. This flatters the performance of keyhole surgery when you put all the results together because you're not comparing like with like. The true picture emerges when you separate (or stratify) the easier and harder cases. The stratified results produce a fairer, like-for-like comparison, revealing that in this study open surgery outperformed keyhole surgery for both large and small stones.

Mr Brilliant and Mr Average

Here's another way to picture it. Imagine a hospital with two surgeons, Mr Brilliant and Mr Average. To give patients the best chance of success you would aim to give all the difficult cases to Mr Brilliant since he has the best chance of pulling off a successful treatment. Mr Average can then concentrate on simple, run-of-the-mill cases where the chance of success is always quite high. In that situation, it's quite possible that Mr Brilliant could have a lower overall success rate than Mr Average, despite being the better surgeon. Such a crude comparison flatters Mr Average because Mr Brilliant is taking all the difficult cases. To make the comparison fair you need to compare the surgeons' performance on similar cases.

In an ideal world, statistically speaking, you would allocate patients between the two surgeons at random so they'd both tackle the same mix of easy and difficult cases. That would make it very easy to see who's best, but it doesn't generally happen this way in real life because hospitals tends to prioritise the successful outcome for the patient over the easy life for the statistician. Hey-ho.

Final Thought

I've focussed on one study into treating for kidney stones dating back to 1986. In practice this one study is rather old and its findings outdated. My aim here was to look at the interesting statistical features of its findings rather than to recommend to you a particular treatment for kidney stones - I'm not a doctor. My guess is that treatments and patient outcomes have moved on a lot in the last 30 years.

* Charig, R., Webb, D.R., Payne, S.R and Wickham, J.E.A. (1986) Comparison of treatment of renal culculi by open surgery, percutaneous nephrolithotomy, and extracorporeal shockwave lithotripsy. British Medical Journal, 292, 879-882.

Success was defined as the stones being eliminated or reduced to <2mm. Success % rounded to 2 significant figures. The paper also looked at a 3rd treatment: using sound waves to break up kidney stones.