## Archive for the 'Copulas' Category

Nov 08, 2008 in Book, CFA, Columbia, Copulas, Hedge Funds, Interview Prep, Interview Questions, Investment Banking, Markets, Mathematics, Tech Tricks, Time Series Links

### Copula for Market Risk using Matlab and Mathematica

Jan 30, 2008 in Copulas

Attached are someÂ slides from some work I did last year to compute required Economic Capital for Market Risk using Copula ApproachÂ .Â A combination of Matlab and Mathematica were used to create the copula.Â Â  The market risk factors included OAS, debt spread andÂ interest rate risk (using principal components).Â  Empirical distributions were fit to the data using matlab’s statistical toolbox.Â  Mathematica was used for its symbolics.Â  Matlab also has some really nice graphics packages.Â

### Calculation of MLE for use in Copula using Mathematica

Jan 30, 2008 in Copulas, Mathematica

Â I wanted to construct a trivariate meta-t distribution from empirical marginal distributions.Â  I wrote a Mathematica notebook that would solve for the optimal degrees of freedom in the distribution given the input empirical distributions and correlation matrix.Â  The PDF version of the code to generate the optimal t value is shown in the attached PDFÂ Multivariate Distributions. What is really great about Mathematica is that I could have it symbolically derive the log likelihood function, by giving some definition such as

loglik[n_]:=n Log[Gamma[(n+d)/2]/Gamma[n/2]]-n d/2 Log[Pi n] – n/2 Log[Det[tau]]-(n+d)/2 (Sum[Log[1+ {x[[i]],y[[j]]}.invSigma .{x[[i]],y[[j]]}/n],{i,1,d},{j,1,d}])

and then asking it to take the derivative with respect to n.

### Copulas for the Unwilling

Jan 30, 2008 in Copulas

I admit to liking the name “S for the Unwilling” so much that I have adapted it for the title of this post.

So many people have asked about how to get started on copulas and what to read that I thought I’d post some of the most useful information here.

If you are actually going to build a copula, you might want to consider matlab.Â  I used their copula functions, but also used Mathematica for it’s superior symbolics.Â  I will add some detail on this later but only have time to post some links right now.

Matlab has a webinar on copula functions that is really great.Â  You’ll need the statistical toolbox (see online reference here) and might want to get the econometrics (GARCH) and optimization toolboxes too.Â  I didn’t use their optimization routines because I have Mathematica but as a student these toolboxes are reasonably priced so there is no reason not to get them.Â

This Credit Lyonnaise site has a wealth of links on copulas. Andrew Patton’s site has lots of good examples, but I ended up building my own code. Good for reference though.

When I started working with copulas, I had to learn about the Maximum Likelihood Estimator.Â  There are a number of good books on this, including Statistical Foundations of Econometric Modeling by Aris Spanos.Â

There is also a great introductory paper Symbolic MLE with MathematicaÂ Â which explores this concept using Mathematica by Colin Rose and Murray D. Smith.

There are many giants in the field including David Li; Paul Embrechts, Alexander McNeil and Rudiger Frey; Joshua V. Rosenberg and Til Schuermann of the Federal Reserve Bank of New York and many others.

Let’s start with some introductions to copulas.Â  A copula is a method of imposing a dependence structure (through correlations) to independent marginal distributions.Â  If we knew the underlying joint distribution, it would not be necessary to use a copula, but in practice, the underlying joint distribution is unobservable.Â  Copulas can be used to combine various elements of market risk (for example, interest rate risk, volatility, OAS, debt spreads …) so a value at risk can be computed for the market risk in aggregate.Â  Copulas are often applied to credit risk.

The Wall Street Journal printed a profile of David Li, How A Formula Ignited Market that Burned Some Big Investors, which gives a colorful qualitative introduction.Â Â

I’ll add some commentary to these links later.
Modeling Copulas: An Overview by Martyn Dorey and Phil Jorion

A General Approach to Integrated Risk Mangement with Skewed, Fat-Tailed Risks, Joshua Rosenberg and Til Schuerman

McNeil, Embrechts and Frey have a book entitled Quantitative Risk Management, and you can download chapters 1, 6 and 10 as well as a lot of other great references from their site.

Coherent Measures of RiskCoping with Copulas by Thorsten Schmidt

Correlation and Dependency in Risk Management: Properties and Pitfalls, Embrechts, McNeil and Straumann.

Correlation Pitfalls and Alternatives, Embrechts, McNeil and Straumann again. This paper is in postscript format. This is the paper with one of the best lines ever, at leaset to me: “These traps are known to statisticians, but not, we suggest, to the general correlation-using public. We will help you avoid these pitfalls …” I don’t know why the phrase general correlation-using public cracks me up, but it does. Don’t read it just for the great writing, it’s an excellent paper.