# Phorgy Phynance

## More fun with maximum likelihood estimation

with one comment

A while ago, I wrote a post

### Fun with maximum likelihood estimation

where I jotted down some notes. I ended the post with the following:

Note: The first time I worked through this exercise, I thought it was cute, but I would never compute $\mu$ and $\sigma^2$ as above so the maximum likelihood estimation, as presented, is not meaningful to me. Hence, this is just a warm up for what comes next. Stay tuned…

Well, it has been over a year and I’m trying to get a friend interested in MLE for a side project we might work on together, so thought it would be good to revisit it now.

To briefly review, the probability of observing $N$ independent samples $X\in\mathbb{R}^N$ may be approximated by

\begin{aligned} P(X|\theta) = \prod_{i = 1}^N P(x_i|\theta) = \left(\Delta x\right)^N \prod_{i=1}^N \rho(x_i|\theta),\end{aligned}

where $\rho(x|\theta)$ is a probability density and $\theta$ represents the parameters we are trying to estimate. The key observation becomes clear after a slight change in perspective.

If we take the $N$th root of the above probability (and divide by $\Delta x$), we obtain the geometric mean of the individual densities, i.e.

\begin{aligned} \langle \rho(X|\theta)\rangle_{\text{geom}} = \prod_{i=1}^N \left[\rho(x_i|\theta)\right]^{1/N}.\end{aligned}

In computing the geometric mean above, each sample is given the same weighting, i.e. $1/N$. However, we may have reason to want to weigh some samples heavier than others, e.g. if we are studying samples from a time series, we may want to weigh the more recent data heavier. This inspired me to replace $1/N$ with an arbitrary weight $w_i$ satisfying

\begin{aligned} w_i\ge 0,\quad\text{and}\quad \sum_{i=1}^N w_i = 1.\end{aligned}

With no apologies for abusing terminology, I’ll refer to this as the likelihood function

\begin{aligned} \mathcal{L}(\theta) = \prod_{i=1}^N \rho(x_i|\theta)^{w_i}.\end{aligned}

Replacing $w_i$ with $1/N$ would result in the same parameter estimation as the traditional maximum likelihood method.

It is often more convenient to work with log likelihoods, which has an even more intuitive expression

\begin{aligned}\log\mathcal{L}(\theta) = \sum_{i=1}^N w_i \log \rho(x_i|\theta),\end{aligned}

i.e. the log likelihood is simply the weighted (arithmetic) average of the log densities.

I use this approach to estimate stable density parameters for time series analysis that is more suitable for capturing risk in the tails. For instance, I used this technique when generating the charts in a post from back in 2009:

### 80 Years of Daily S&P 500 Value-at-Risk Estimates

which was subsequently picked up by Felix Salmon of Reuters in

### How has VaR changed over time?

and Tracy Alloway of Financial Times in

### On baseline VaR

If I find a spare moment, which is rare these days, I’d like to update that analysis and expand it to other markets. A lot has happened since August 2009. Other markets I’d like to look at would include other equity markets as well as fixed income. Due to the ability to cleanly model skew, stable distributions are particularly useful for analyzing fixed income returns.

Written by Eric

October 20, 2012 at 5:02 pm

## Why do scientists go into finance?

Why do mathematicians and physicists go into finance?

One reason people may sympathize with is mere survival. Job prospects for mathematicians and physicists in academics is horribly bleak. Each PhD program churns out 10s if not 100s of PhDs each year. How many PhDs do these same institutions hire each year? Less than 10 for sure. Most likely none. Scientists are a different breed. Most pursue higher education simply because they love what they do with little thought about what will happen after school. It is often not until a few months before being cut loose that many graduate students think to themselves, “Oh %\$#%! What am I going to do now?” A good picture to keep in mind is the classic absent-minded professor.

Although Wall Street rolled out the red carpet to scientists in the 70’s and 80’s, I would suspect that the idea was not high on most graduate student’s minds at the time. When quantitative risk management systems began being deployed on a large scale in the 90’s coincident with significant improvements in computational power, that marked a turning point. By the mid 90’s, Wall Street was becoming a clear beacon for mathematicians and physicists about to hit the job market. Leading up to Basel II setting capital requirements based on value-at-risk measurements in 2004, banks literally went on a hiring spree of PhDs. I know that when I first tested the waters on Wall Street in 2002, each advertised quant opening was receiving no less than 30 PhD resumes. Most of these had prior work experience in finance. Today, many physics and mathematics PhD programs offer minors in finance. Clearly, Wall Street is a destination for many graduating scientists these days.

Is survival the only reason scientists go to Wall Street? Clearly not. The real and only important reason physicists and mathematicians go into finance is that they can potentially make lots of money doing very interesting and rewarding work. Who wouldn’t want to work in finance? I know I absolutely fell in love with finance at first sight. The first time I stepped foot on a trading floor, I knew I had found my calling in life. It was a truly transformative experience.

There are about as many different kinds of quants as their are scientists. I have been fortunate enough to have seen the quant world from many perspectives. I started finance life as a “risk quant” working at a large bank with a group of 12 other PhDs building risk models that spanned trading desks across the globe. These guys have been getting a bad rap lately and I’ll have more to say about that another time. Make no mistakes though. The risk quants know quite well the strengths and limitations of their models and given more authority, they could have and would have kept the credit bubble from getting out of hand. Unfortunately, the reality is that risk quants have been relegated to secondary roles whose purpose is often to massage numbers to tell the risk managers what they want to hear. For example, at one point, a friend told me that their risk manager did not like the numbers produced for a particular trading desk. This trader had significant influence. So the risk manager came back and told them to recompute the correlation matrix until it output what the trader wanted to see. Did the quant have a choice? Not if he wanted to keep his job. At another point, another friend was told that they needed to modify the risk numbers coming out of the models because they were too high which forced the bank to retain too much capital. He was warned that people higher up were becoming unhappy and that the entire group could be eliminated if they didn’t do something about it. Since the job market was so competitive and since the pay was quite good, there really was no incentive to rock the boat. This has absolutely nothing to do with poor models or “black swans”. It has everything to do with greed. Period.

There are some really good aspects of being a risk quant. Usually, it is a good entry point to other things since you get a general introduction to a large variety of securities. The typical entry requirements are often lower as well. The downside is that you are effectively a NARC with absolutely no authority. You may think your job is to reign in excessive risk takers, but the reality is that you are most likely a puppet for upper management.

As a byproduct of proliferation of risk management systems, clients and investors are becoming increasing demanding in terms of risk reporting. This has trickled down from investment banks on the “sell side” to money managers on the “buyside”. Traditional asset managers who previously had no interest in quants or their models are now being forced to hire quants simply due to client demands. This can be a very good place for scientists to end up. You will often come across as a super star rocket scientist regardless of what you actually contribute. The downside is that many traditional investors may view you as a necessary evil and don’t really want you there. It is a challenge in such an environment to demonstrate the value of the work you do. Yes, I am speaking from experience 🙂 There are definitely good things to be learned from investors who are firmly “anti-quant” though. I value the experience obtained from attempting to understand the way traditional investors think and invest. It has had a definite positive impact on the way I look at things. My advice to any quants moving into traditional asset management is to try to find a way to “quantify” your contributions. Make it clear that you are doing things that few others could do. My biggest mistake was assuming that my hard work and the contributions I was making would be obvious and rightfully recognized. Make sure you have champions and make sure these champions speak up for you. Working on the buyside can be quite rewarding both scientifically and financially. I know it is where I belong.

Another type of quant is the “front-office quant” whose job it is to build derivatives models to assist traders directly. From my experience, this is where most quants would like to end up. It is often fast-paced and quite demanding. You have to be willing to be brutalized and cannot be sensitive to fowl language 🙂 A part of me would love to work on a fast-paced desk. I almost look at these guys as the rock stars of quants. These guys can enjoy quite ridiculous compensation since they participate more directly in the profit sharing. Plus, the closer to the money you are, the better. This role can also lead to opportunities to become a trader. I think secretly (or not so secretly) most quants dream of becoming traders.

When I grow up, I hope to become a quantitative portfolio manager. I envision this as somewhat of a hybrid between the traditional asset manager and the traditional quant. People need some place to put their retirement investments. Traditional asset managers have let many retirees down in a bad way. They often charge high fees for unremarkable performance. Many asset managers saw the current crisis coming and positioned themselves appropriately. Others had their heads in the sand for far too long and ended up destroying a lot of hard-earned wealth.

I love finance. I do not feel like I’ve given anything up by leaving physics. The modeling is quite enjoyable and regardless of what some talking heads in the media would have you believe, can be quite valuable to investors. Any decent credit model was screaming that fixed-income securities were grossly overpriced leading up to the crash. I know that I literally begged my research directors to let me work with the high yield analysts when I saw the risk premium go negative in 2006. Every other quant I talked to knew it too. As long as the music plays, you need to keep dancing, right?

What do I think about markets now? I hope to say more in a separate post, but I started this blog on July 10, 2007 with a post entitled:

“The End is Near”

At the time, I claimed to be an optimist and I am. I was scared because very few others were scared. Now, everyone is scared as they should be, but I see that as the first step to recovery. You have to recognize how serious the situation is before it can get better. Spreads in fixed income have priced in some very gruesome scenarios. I think many of these gruesome scenarios will come to pass. Corporate defaults will obviously increase and this will put a strain on the CDS market. I was more scared about this before, but recent efforts to move CDS to clearinghouses has dramatically reduced my fears. There will be more blood before things hit a bottom, but investors are slowly beginning to see beyond it. We’re not out of the woods by any means and risks remain extremely elevated, but I am optimistic that in 2-3 years, the equity markets will be much higher than they are today regardless of how low they go in the interim.

Written by Eric

February 28, 2009 at 12:24 pm

## The risks of risk management revisited

with one comment

Risk management is a topic I’ve discussed here a bit. In particular, on March 16, 2006, I wondered aloud

When I look out at the world, one of the major risks to the markets that I see is, ironically, risk management. I suspect that one of the primary employers of junior quants in the last 5 years has been in risk analytics (HHs, please correct me if I’m wrong). If there is any truth to that, it means there is literally an army of quants who have not lived through a business cycle building risk systems on markets that no one really understands, e.g. CDS/CDOs.

[snip]

If things are at all like what I have seen, then we’ve got a bunch of fairly clueless risk managers out there with an army of fairly green quants developing sophisticated risk models that are probably pretty useless in a crisis. Nonetheless, there seems to be this completely ludicrous false sense of security.

Across the boards, vols seem to be historically low which would mean that most VaR engines are saying “smooth sailing”. What happens if vol increases? Everyone’s VaR model is going to start sending out little red flags. Assets are going to start getting reallocated. Since everyone has almost identical VaR models, the signals will be pretty much identical at all firms. I know it is not an original argument, but this could easily lead to a negative feedback. A small red flag due to increased VaR could signal everyone to make very similar reallocations. If everyone does it at the same time, the market will obviously be affected. In essence, the impact of risk management could actually increase systemic risk in the markets and amplify vol movements.

With that in mind, you can probably imagine how much I enjoyed this article by Avinash Persaud at VoxEU:

### Why bank risk models failed

Avinash Persaud
4 April 2008

I also enjoyed his 2000 article referenced in the above paper

### Sending the herd off the cliff edge: The disturbing interaction between herding and market-sensitive risk management practices.

Avinash Persaud
December 2000

Written by Eric

April 5, 2008 at 5:09 pm

Posted in Risk Management

## Another word for hedged… leveraged

Market turmoil is still quite fascinating to me and I still believe the current environment will be one for the history books and I’m still trying to take as much as I can from this learning experience.

My professional work experience is in fixed income. For two years, I was very “plugged in” to the markets and was meeting regularly with some of the greatest thinkers out there, but now I’m more of a pure “quant” and most of my news comes from blogs, web news, etc. Unfortunately, I’m not yet spending as much time with the traders as I’d like (but that should change soon I hope). Most of the major news sources, e.g. Bloomberg, seem to concentrate more on equity markets than credit and fixed income. I pay more attention to the Dow now than ever before. That is why I am so perplexed by the stock market. I thought stocks were supposed to be easier than bonds, i.e all the smart guys are in fixed income, right?

So while the credit markets seem to be imploding, stocks are doing just dandy. Maybe people are taking cues from the market cheat sheet?

Anyway, I’ve blabbered quite a bit on this blog (and at my former employer) expressing my opinion of CDOs. I even managed to upset quite a few people while expressing my opinions as well. No regrets though. I’m happy to have this hugely public diary, both here and on NP, to later look back and see how I did in regards to thinking events through. Occasionally, I still like to poke my nose in over at NP and I see kr is still giving out the occasional nugget. Here is one of his latest:

A few thoughts:
– If you took all the writedowns at a single med-to-large bank rather than seeing them across the street, you could have reduced that entity’s equity to ZERO. For instance, MER has only something like USD54bn of mkt cap and USD39bn of book equity.
– If the view is that there will be another round of writedowns in the same amount as Q3 then you will have banks desperate to raise equity (i.e. it is not just the monolines). Who would buy that equity right now? Prince Alwaleed for example has floated his own holdings so I see him more as seller than buyer for example. I don’t see guys like JC Flowers or Cerberus well positioned for this job – in retrospect, even Barclays/RBS have not been with respect to ABN, as can be seen by the action in their share price and cost of jr capital.
– Another possibility would be the downgrade to BBB like the Japanese banks, with all the implications that brings with it. I.e. serious change in business model. That has contagion and macro effects. One example is that flow trading of financials has cost people a lot.
– I think investors will call foul on the FAS157 Level-3 assets, and it will hit guys like GS seriously as their L3 reporteds are a big multiple of their mkt cap.
– There was a funny comment in this month’s BBG mag about “nobody really knows how desks are hedging the CDO assets.” That is bull – the answer is that most people were NOT HEDGING AT ALL, BECAUSE THEY COULDN’T. Stuff was originated to sell, and the exit has vanished, or, it was originated to live forever on a trading book even though people tried to avoid saying that, and there is no decent MTM approach so instead banks are showing huge volatility, mostly to the downside.
– Implications of SIV / CDO / CP demise are pretty vast. There seem to be an increasing amount of trade receivables on the market, b/c there are no conduits to fund them… means corp cost of cap is going up in unexpected areas.

My hunch is that the fed cuts on the 11th b/c liquidity is dropping again, especially with year-end. It is out of control – specifically Ben’s control. It looks like political support for the various subprime fixes has stalled. What I think is that liquidity of all things financial (i.e. non-corporate) is going to get weaker and cause a full-on crisis for a market-traded institution. The talk about Citi cutting their div is one tremor, trading activity in Barclays is another, and the fact that even AFTER all the reported loss numbers, people still don’t feel comfortable, is yet another.

I think vols are still cheap, maybe looking to buy some.

All the while I was complaining about CDOs, I was coming at it from the angle of a “quant”, i.e. thinking about how to model CDOs and how those models are used in risk management, asset allocation, etc. Too bad I didn’t understand more about the legal/accounting aspects of CDOs. The term everyone has now heard of is SIV. I was blabbering about off balance sheet leverage and fair value accounting, but didn’t realize that the entire CDO market was (to a jaded eye) a big play on accounting in addition to the obvious play on ratings agencies. If I had known about SIVs, I might have been able to do more to help some who may have now lost a lot of money. Maybe not. That’s all in hindsight. But what am I missing now? Where is the next weakest link? How are corporations hiding off balance sheet debt? Has anyone looked at “Level 3” assets in corporate, i.e. non-financial, balance sheets? Are they as scary as the big banks?

I’ll say it again… this is not a subprime issue. Subprime contagion does not explain the current environment. Subprime was just the first to blow. We are experiencing the blowup of a global fixed income bubble. In fact, some would say we’re experiencing a general global asset bubble.

Who’s going to get hurt? Financial institutions for sure. Anyone who depends directly on the value of paper assets.

Who’s going to win? People whose wealth depends on physical assets.

I’ve already lost all hope in Bernanke. He is not going to let his monicker “Helicopter Ben” go by the wayside in a “time of need”. Bernanke is going to lower rates and weaken the USD until oil exporters are forced to break the peg to the USD and inflation skyrockets. I predict that all these gloom mongers about home prices dropping by 30% will turn out to be wrong in nominal terms even if they are correct in real terms. In other words, home owners are going to be saved by the dropping value of the USD. All those on Wall Street who were so gleeful every time rates dropped are suddenly going to feel the pain when the value of their paper securities go up in smoke.

Watch out for the “happy stage of inflation”, i.e. wage increases. It will be interesting to see what the world will look like when oil is priced in EUR and the USD is no longer the world currency. Fortunately, I still have faith that we’ll come out of the current mess stronger as a country, but there will certainly be pain felt at the higher end of the wealth spectrum.

I’m actually ironically optimistic about the outlook for suburban and rural economic development. A weaker dollar will make outsourcing less attractive. That will bring manufacturing jobs back home. I can imagine a boon in suburban and rural development. Just imagine if communities developed decent broadband via fiber-to-the-home/business. Suddenly, there will be attractive jobs and living standards in affordable places.

Maybe a weak dollar is what this country needs, i.e. a good kick in the pants. Pain is the best teacher, right?

[Edit: PS, the title of the post was inspired by a great article on Financial Armageddon, but I never got around to explaining why, but have a look and it might be obvious.]

Written by Eric

November 11, 2007 at 9:44 pm

## True lies and risk management

Quantitative risk management is actually one of the topics that I can speak about with some authority because I have worked in the area professionally. Seeing the smoke and mirrors that goes on behind the scenes, I managed to convince myself that one of the greatest dangers to the markets is, ironically, risk management. I’ve referred to this as the “Risks of Risk Management“.

But since I am such a small potato, who would listen to me? Anyway, I got a real kick out of reading this latest article by Satyajit Das.

Fear and Loathing in Derivatives – “Perfect Storms” – Beautiful & True Lies In Risk Management

I stumbled on Das’ article by following a few links deeper from the reference pointed out by another of my favorite blogs: Financial Armageddon.

One of the “funny” things is that most hedge funds and investment banks are now FINALLY caught up in sophistication to where LTCM was in 1998.

Written by Eric

September 23, 2007 at 10:37 pm

Posted in Risk Management

## WSJ: Seeking Hidden Losses, Regulators Comb Books Of Wall Street Titans

with one comment

This is bound to end up badly.

From the Wall Street Journal:

Seeking Hidden Losses, Regulators Comb Books Of Wall Street Titans

Here are some excerpts (my emphasis in bold):

The SEC is looking into whether Wall Street brokers are using consistent methods to calculate the value of subprime-mortgage assets in their own inventory, as well as assets held for customers such as hedge funds, the same people said. The concern: that the firms may not be marking down their inventory as aggressively as assets held by clients.

[snip]

… few big Wall Street firms have reported big subprime losses despite the turmoil roiling the markets.

[snip]

No one really knows how to price asset-backed securities and CDOs and that’s a real problem in the market now,” says Ann Rutledge, principal of R&R Consulting, a structured finance consultancy in New York.

[snip]

The pricing issue is crucial for brokers and banks, some of which hold significant amounts of mortgage or CDO securities on their books. Analysts said it was common in past years for Wall Street underwriters to keep portions of the securities of CDOs or mortgage bond deals they arranged.

The SEC’s market-regulation division has been in touch with all big brokerage firms to ensure their risk-management systems are up to speed in light of the quick deterioration in the subprime market. The asset-pricing inquiry is being conducted by the agency’s office of compliance, inspections and examinations.

This is all part of a bigger picture we are discussing here

Some of the best quants in the world are hotly debating appropriate methods for pricing CDOs. When I hear their arguments, the only conclusion I can come to is that NOBODY KNOWS how to price these things. If you can’t price them to determine the value of fund shares and if you can’t value them for GAAP accounting and if you can’t price them for the purposes of allocating capital for risk management purposes, then what does that mean? It means people have been flying blindfolded for years. Who knows where we will end up, but my suspicion is that the place will not be pretty.

Oh yeah, don’t forget I’m an optimist 😉

Written by Eric

August 10, 2007 at 10:20 am

## Risks of risk management

A theme I’ve been thinking about for at least the last 2 years is the concept I call the “risks of risk management”. Is it possible that the recent introduction of highly quantitative risk management systems has actually increased market risk?

Here is something I posted to NP on March 16, 2006:

Risks of Risk Management

Hi everyone,

Since I suspect we have a ton of NPers who work in risk and, in particular, Aaron has finally obtained the critical 4 posts, I thought I’d ask a question, which is probably old news and has been discussed to death in a million places, but is on my mind.

When I look out at the world, one of the major risks to the markets that I see is, ironically, risk management. I suspect that one of the primary employers of junior quants in the last 5 years has been in risk analytics (HHs, please correct me if I’m wrong). If there is any truth to that, it means there is literally an army of quants who have not lived through a business cycle building risk systems on markets that no one really understands, e.g. CDS/CDOs.

From what I’ve seen, the actual “risk managers” are typically high level management who actually have very little clue about what is going on (except Nonius and Aaron of course ). For example, at my previous employer, one of the risk managers got his break because he would perform magic tricks at the company parties

If things are at all like what I have seen, then we’ve got a bunch of fairly clueless risk managers out there with an army of fairly green quants developing sophisticated risk models that are probably pretty useless in a crisis. Nonetheless, there seems to be this completely ludicrous false sense of security.

Across the boards, vols seem to be historically low which would mean that most VaR engines are saying “smooth sailing”. What happens if vol increases? Everyone’s VaR model is going to start sending out little red flags. Assets are going to start getting reallocated. Since everyone has almost identical VaR models, the signals will be pretty much identical at all firms. I know it is not an original argument, but this could easily lead to a negative feedback. A small red flag due to increased VaR could signal everyone to make very similar reallocations. If everyone does it at the same time, the market will obviously be affected. In essence, the impact of risk management could actually increase systemic risk in the markets and amplify vol movements.

I’m very curious to hear what others think. Is this a totally bogus line of thinking?

Any pointers to literature discussing this kind of thing would obviously be appreciated. Here is an article I found interesting on the subject

The impact of risk regulation on price dynamics
Jon Danielsson, Department of Accounting and Finance, London School of Economics, July 2002

Cheers
Eric

Subsequent discussions were enlightening. If you’re at all interested in the subject of risk management, I encourage you to have a look.

If I combine this concept, i.e. risks of risk management, with the arrogant attitude toward risk at GS that I outlined on July 27 here

Voodoo analysis: Goldman Sachs in trouble

and in comments here and here on Tuesday, I can’t help but wonder (aloud) if the recent selling at GS HFs are related to their risk management practices?

I have a pretty loose definition of “friend”. Anyone I’ve had a beer with is definitely a “friend” in my book and if that is the criteria, then Aaron Brown [the master of risk management] is a GOOD friend 🙂 Aaron wrote a fantastic article on VaR back in 1997 that I reference in that “Risks of Risk Management” thread on NP. It was such a good article, I’ll point to it again here:

Value-At-Risk: The Next 10 VAR Disasters

I have absolutely no doubt in my mind that hedge funds, investment banks, and asset managers around the globe are succumbing to many, if not all these “VaR disasters”.

Actually, Aaron’s article is so good I decided to reproduce it here after the jump. It required more formatting than I’d like to admit, so any editing errors are likely my own.

Written by Eric

August 9, 2007 at 9:40 pm