# Conversion of Meucci’s MatLab Code

**tradeblotter » R**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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 www.symmys.com; 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.

**leave a comment**for the author, please follow the link and comment on their blog:

**tradeblotter » R**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.