Skip to content

Add Conical Optimizer to PortfolioAnalytics

Peter Carl edited this page Mar 24, 2022 · 3 revisions

Background

PortfolioAnalytics provides an R package for optimization of complex multi-objective portfolios. PortfolioAnalytics supports multiple solvers so that a user can select the best solver for their portfolio optimization problem.

This project would use CVXR to add an a conical optimizer to PortfolioAnalytics to allow users to solve portfolio optimization problems not currently supported by PortfolioAnalytics.

The benefits of a conical optimizer in portfolio management and the motivation to use CVXR as the object-oriented modeling language include the following:

  • CVXR supports a common modeling paradigm for a very wide range of optimizers, including two conic solvers (ECOS and SCS)
    • A conic solver provides a way to construct portfolios that minimize expected quadratic shortfall (EQS), called SMCR second order special case of higher order coherent risk measures in Krokhmal (2007)
  • It allows efficient solutions for large (1000+ constituent) portfolios
  • It allows for solving portfolio optimization problems with quadratic constraints
  • It allows robust portfolio optimization as proposed by Ceria et al. 2006 to implemented
  • It allows for multi-period optimization solutions encompassing a planning horizon that includes more than one-step-ahead rebalancing

PortfolioAnalytics uses xts and R base plotting to construct many charts of the analytical output.

Related Work

PortfolioAnalytics is considered a 'core' project for financial analysis in R. This project seeks to extend the functionality and make it more useful to more people and for more solver targets (portfolio objectives). That said, the following complementary packages may be useful as dependencies or referenced in the ongoing development of PortfolioAnalytics:

  1. The R package FactorAnalytics contains fitting and analysis methods for the three main types of factor models used in conjunction with portfolio construction, optimization and risk management, namely fundamental factor models, time series factor models and statistical factor models. It also provides the covariance matrix for use by PerformanceAnalytics mean-variance optimization.
  2. Another R package, PerformanceAnalytics, provides an extensive set of functions for evaluating performance and risk characteristics of funds, assets, or portfolios.
  3. fPortfolio provides a traditional optimization framework and excellent graphics. It supports an asset allocation workflow well, however the original author - a significant contributor to the R and finance community - passed away and new functionality seems unlikely.

Details

Add the conical optimizer from the package cvxr ((see Fu, Narasimhan, and Boyd (2020)) in a way that is implemented consistently with other optimizers in PortfolioAnalytics.

Add constraints and objectives to the PortfolioAnalytics package that can be solved with a conical optimizer. See Tables 1-3 in Perrin and Roncalli (2020) for ideas. Also see Markowitz et al. (2020) for semivariance objectives.

Use the CVXR based implementation of conic optimization in PortfolioAnalytics to implement the following: (1) Mean-variance optimization with an inequality portfolio variance constraint, and (2) Expected Quadratic Shortfall (EQS) with standard portfolio weights constraints. If time permits, also implement Robust Portfolio optimization as described by Ceria et al. (2006).

Write vignettes showing how the package and/or functions might be applied in practice or with example data. Demonstrate how the new optimizer allows a user to produce multi-period optimizations Boyd et al. (2017) and/or take drawdown into account Nystrup et al. (2019).

Mentors

Students, please contact mentors below after completing at least one of the tests below.

Tests

Students, please do one or more of the following tests before contacting the mentors:

  • Demonstrate how to use PortfolioAnalytics to construct a mean-variance optimized (MVO) portfolio.
  • Compare the results of the MVO optimization to an Equal-Weighted (EW) portfolio with the same assets.
  • Demonstrate use of the cvxr package for portfolio optimization.
  • Complete the exercises found at this link.

In addition to the test above, applicants should demonstrate that they have:

  • A very good working knowledge of programming in R
  • Familiarity with the construction of R packages
  • Good coding standards (Google’s R style guide)
  • Experience with multivariate statistics
  • Experience with GitHub

Students, please email the results of your tests to the mentors and add a link to your profile or website below.

Doug Martin: martinrd3d@gmail.com Brian Peterson: brian@braverock.com
Peter Carl: pcarl@gsb.uchicago.edu

Note on Proposals

Students should propose a realistic project plan. Quality is more important than quantity, so your proposal may not contain all sections or targeted functionality.

References

  • Boyd, Stephen, Enzo Busseti, Steven Diamond, Ronald N Kahn, Kwangmoo Koh, Peter Nystrup, and Jan Speth. 2017. “Multi-Period Trading via Convex Optimization.” arXiv Preprint arXiv:1705.00109.
  • Fu, Anqi, Balasubramanian Narasimhan, and Stephen Boyd. 2020. “CVXR: An R Package for Disciplined Convex Optimization.” Journal of Statistical Software 94 (14): 1–34. https://doi.org/10.18637/jss.v094.i14.
  • Markowitz, Harry M., David Starer, Harvey Fram, and Sander Gerber. 2020. “Avoiding the Downside: A Practical Review of the Critical Line Algorithm for Meansemivariance Portfolio Optimization.” In Handbook of Applied Investment Research, 369–415. WORLD SCIENTIFIC. https://ideas.repec.org/h/wsi/wschap/9789811222634_0017.html.
  • Nystrup, Peter, Stephen Boyd, Erik Lindström, and Henrik Madsen. 2019. “Multi-Period Portfolio Selection with Drawdown Control.” Annals of Operations Research 282 (1): 245–71.
  • Perrin, Sarah, and Thierry Roncalli. 2020. “Machine Learning Optimization Algorithms & Portfolio Allocation.” Machine Learning for Asset Management: New Developments and Financial Applications, 261–328.
  • Ceria, Sebastián & Stubbs, Robert. (2006). Incorporating estimation errors into portfolio selection: Robust portfolio construction. Journal of Asset Management. 7. 10.1057/palgrave.jam.2240207.
  • PAVLO A. Krokhmal (2007) Higher moment coherent risk measures, Quantitative Finance, 7:4, 373-387, DOI: 10.1080/14697680701458307
  • Sivaramakrishnan, Kartik & Jeet, Vishv & Vandenbussche, Dieter. (2015). Multi-period portfolio optimization with alpha decay.