Original thinking in a derivatives market
How those models work
Analysis At some point in the latter decades of the 20th century, someone sat down and thought: wouldn't it be nice if all the money in the world was controlled by scientists rather than accountants and nice chaps from Eton?
Now, as we march headlong into the 21st century, full of sub-prime fallout, to a decent approximation, what we're seeing is just that: a better quality of screwup.
The way banks lend money has changed, and in step with this, so has the way they calculate and manage risk.
I can still leave a deposit on a Porsche
What are the odds?
Banks use highly complex mathematical models to estimate what is going on and what they should do about it. In the olden days (the 1980s), when a bank lent you money, it was risking its own capital. If you ran off laughing, they took the hit. If you were asking them for a mortgage to buy a house, banks lent up to 75 per cent of the value of the property, and if they really liked you might go from the standard 2.5 multiple of salary, to 3. If your wife worked, then tough, and don't even mention gay couples.
Credit derivatives have made borrowing both cheaper and more flexible, which is mostly good. Banks have sold off the cashflow from loans for many years, typically in large portfolios to keep the admin costs down and avoid one bad risk being an issue. This securitisation moves the risk off the books of the bank, and is the basis of a wave of financial innovation, led by banks in London. Moving risk to those who will take it on for a price is critical to how modern investment banking works, and almost any set of cash flows can be engineered so that they can be sold as a single product.
David Bowie was one of the first to benefit from this. Whereas Paul McCartney lost control of his music, Bowie borrowed $55m secured against future royalties, and ten years later he now has the songs back with no loss of control. Bernie Ecclestone raised $1.4bn in much the same way, but unlike shares, bonds don't vote, so he kept control. So how does this work?
If a bank has mortgages with a face value of 100 million (chose a currency, any currency), it can be sure it's going to lose some, but not lose the lot either. That means you can chop up the risky portfolio into tranches, giving first call on (say) 90 per cent which is pretty much risk free, with layers of increasing risk. Some investors are quite happy to take a lower rate of return, if they can be sure what that rate will be. So in addition to the risk being concentrated in a smaller group, so is the reward.
But how do you decide where to draw the line? Is it 90 per cent or 91 per cent? You have to convince both the customer and the ratings agencies, such as S&P or Fitch, that your portfolio really is as safe as you say.
Riskier tranches have higher returns, on average, but with increasing variance, with a bottom "equity" layer which takes the first hit of any losses. This is potentially the most profitable, but when they go bad these risky layers get called "toxic waste". As we've seen recently a credit rating is not constant. Not even slightly.
Computer says 'no'...
So there is a really interesting and lucrative optimisation problem here in balancing risk and reward, so complex that some outfits use genetic algorithms to crack it. Although efficient, the problem is that the answer "just works", without anyone understanding the underlying problem. And of course this means that when it goes wrong, no-one really knows why.
There are firms selling data on the frequency with which a given type of debt has defaulted, and a bit of regression will give a decent approximation to losses in a given time.
We know that interest rates and defaults correlate, but of course we don't know how rates will move.
So take a rubber band with a weight on one end. Prod it, and the result will look at bit like the way interest rates move over time.
There is a long-term average, of the weight when standing still, and a volatility which is how hard you kick it. The further away from the middle it gets, the more it gets pushed back, so it jumps about more violently the further away from the average it gets. This Vasicek model is in common use, not because the results are brilliant - there are better multi factor models - but because it's easy to code up in C++ or VBA.
The stock market: it's a gas
In an ideal gas...
Quant finance models are no more "real" than the infinite infinitesimal points in an ideal gas, or the small green peas that we as teenagers were told were electrons moving through a wire, let alone the menagerie of perfectly rigid, frictionless and elastic objects with zero thickness and mass we fought in maths classes.
They allow us to generate an approximation to reality which we can express in mathematics and turn into VBA. Excel is very common, and it's not done very well. Financial VBA  is rarely if ever done well , but it is quick. So the basis for working out prices of derivatives is based upon the diffusion of heat through a metal bar, and Paul Wilmott has sold cartloads of books to bankers using partial differential equations lifted from fluid dynamics, and the banks pay good money  (£60-120k/$50-250k) for a very good physics PhD straight from university to become a quantitative analyst.
It's not just physics PhDs. There are thousands of quants in banks and hedge funds with the CQF  or a masters in finance. Banks don't yet seem to have cut back employment noticeably, but no one is expecting bonuses to be as good as last year, even for those in areas like FX, which aren't connected.
Collateralised debt obligations can be put together with many different components, for different customer demand, or more cynically to make them look attractive to fund managers and the advisors of high net worth individuals.
The problem is that these black boxes are tough to understand, even if they are explained gently by the bankers. Just because you have the Linux kernel source, doesn't mean you know what it will do. The mathematics of Copulas are sufficiently hard that most banks simply don't expect most people they hire to really understand them at first. It's been clear for a while that some of the banks have been pushing products whose risks are far from clear, unless you are a specialist. However, no investment is risk free, and many money managers are quick to call foul when they've looked at the pretty return graphs, not the dull mathematical caveats.
For more security, it is possible to insure a bond against default, and if you are keeping up, you will recognise that this insurance can also be sold on, so the decrease in risk is balanced by complexity in working out who is actually affected by an event.
Nor have the banks completely washed their hands of the original risk, since many act as prime brokers to hedge funds in mortgage derivatives, lending money secured against holdings in instruments, which may have been created by the retail arm of the same bank.
Thus, the risk is now spread very widely in complex ways, which meant that when the sub-prime mortgages started to smell bad, no one could work out which institutions were being hurt.
Banks are quite well equipped to deal with rapid price swings in volatile markets. Some actually make good money in them, but uncertainty meant that the wisest action seemed to be not to lend money to anyone. This is how recessions or even depressions can begin, as it may become a vicious circle.
Handwashing in a risky liquid
However, the US and UK governments seem (for once) to have taken on a useful role in the markets, and pumped in liquidity. The sub-prime shakeout has caused a lot of people to question all sophisticated credit instruments, which in the short term is making it harder to borrow, and cost more, so some sort of economic slowdown is inevitable. Banks will also make less money, and I can feel your sympathy from here.
A problem with securitisation is the bank issuing the loan has some seriously bad incentives once someone else is going to take the downside. US retail bankers pretty much threw money at passers by, allowing people with tragic credit histories to borrow against property. This was made worse by borrowing the idea from credit cards where you start off paying a lot less than the standard rate, making default rates look low, before moving to the British model of floating rate mortgages, at a time when rates were going up.
Even before all this, banks had hordes of risk managers, whose job is to make market glitches survivable. They validate the models produced by quants, and try to run them into the future, to guess the probability of it all going wrong.
Of course, it's simply not possible to work out all the combinations of price movements, so they throw a vast array of randomly generated values at it to simulate the next couple of weeks. Of course the same Monte Carlo approach is also used to value them in the first place which is powerful, if more than a little slow.
The nature of these randoms means that their handling requires care. First off, the standard VBA/C++ library functions are garbage, but still get used. Then there is the question of which distribution you should choose, which is controversial.
Many use the lognormal distribution , which resembles what we see in real life. Except that it gravely under-estimates the probability of big price movements, as Nassim Taleb has been telling people  for a long time. Ignoring this has led several banks to encounter issues that "should" happen only once in the life of the Earth, actually happening twice in the same month.
Although the high end of risk managers do serious maths, ultimately this scale of number crunching simply has to be done by computer. The days of lending to the right-sort-of-chap are long gone. ®