Conversion of Meucci’s MatLab Code

You might remember a second proposal I put forward for this summer’s Google Summer of Code (GSoC). This project was ambitious, looking to convert a subset of Attillio Meucci’s MatLab code to R. Thankfully, Brian Peterson took the lead mentor position for this particular project.

Coincidently, the day before GSoC started we received a very generous contribution of ported code from Ram Ahluwalia at Wingfoot Capital. He even provided a csv file that detailed the forty-some functions and mapped them to Meucci’s original paper and script file.

In response, we re-scoped the project to focus on the code contribution and shape it into a stand-alone package that would mirror Attilio’s code and match the results he displays in his papers and publications. Manan proceeded through Ram’s code, testing and organizing the code into a package named ‘Meucci’ that is now available on r-forge.

Ram had converted several of Meucci’s interesting MATLAB scripts to R, such as robust Bayesian portfolio optimization from his script “Meucci_RobustBayesian,” and entropy pooling for blending views on scenarios with a prior scenario-probability distribution covered in his paper, “Fully Flexible Views: Theory and Practice.” Other topics included detecting outliers using the minimum volume ellipsoid from the script for “S_HighBreakdownMVE.m,” and his marginal copula algorithm.

Manan was also able to extend the code. He added code around Meucci’s “Managing Diversification” article published in June 2009 in Risk Magazine, and code from his “Review of Statistical Arbitrage, Cointegration, and Multivariate Ornstein-Uhlenbeck“.

This has all been factored into an installable package on r-forge that contains twenty-some exported functions, a number of utility functions, six demos, and some degree of documentation for most of them. There is still much to do here, but this package should provide a good foundation for future work. All of Meucci’s original MATLAB source is available on; browsing through the extensive material he makes available will give you a sense of how ambitious we are…

A very big thanks goes to Ram Ahluwalia for the significant code contribution, and congratulations to Manan Shaw on a successful GSoC 2012.

By the way, I probably haven’t said enough about Brian Peterson’s involvement in the GSoC this summer. Beyond being the lead mentor for this project and co-mentoring others, Brian was one of the representatives of the R Project overall. His work in leading and organizing the broader R Project effort this summer took a great deal of time, but resulted in a project list that was enthusiastically received by students and mentors alike. Many thanks to him as well for all his efforts this summer.


2 thoughts on “Conversion of Meucci’s MatLab Code

  1. […] thought I would break up the posts about GSOC (no, I’m not done yet – there are a few more to do) with a quick note about […]

  2. […] in Matlab. All of Meucci’s original MATLAB source is available on, but a recent Google Summer of Code project was dedicated to translating some of it to […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: