Fall 2020-21 - MAFS5310 - Portfolio Optimization with R (MSc in Financial Mathematics - MAFM)

The Hong Kong University of Science and Technology (HKUST), Fall 2020-21
Prof. Daniel P. Palomar


Modern portfolio theory started with Harry Markowitz’s 1952 seminal paper “Portfolio Selection,” for which he would later receive the Nobel prize in 1990. He put forth the idea that risk-adverse investors should optimize their portfolio based on a combination of two objectives: expected return and risk. Until today, that idea has remained central in portfolio optimization. However, the vanilla Markowitz portfolio formulation does not seem to behave as expected in practice and most practitioners tend to avoid it.

During the past half century, researchers and practitioners have reconsidered the Markowitz portfolio formulation and have proposed countless of improvements and variations, namely, robust optimization methods, alternative measures of risk (e.g., CVaR or ES), regularization via sparsity, improved estimators of the covariance matrix via random matrix theory, robust estimators for heavy tails, factor models, mean models, volatility clustering models, risk-parity formulations, etc.

This course will explore the Markowitz portfolio optimization in its many variations and extensions, with special emphasis on R programming. Each week will be devoted to a specific topic, during which the theory will be first presented, followed by an exposition of a practical implementation based on R programming.


  • ​Yiyong Feng and Daniel P. Palomar,  A Signal Processing Perspective on Financial Engineering, Foundations and Trends® in Signal Processing, Now Publishers, 2016. [pdf]
  • S. Boyd and L. Vandenberghe, Convex Optimization, Cambridge University Press, 2004.​
  • G. Cornuejols and R. Tutuncu, Optimization Methods in Finance. Cambridge Univ. Press, 2007.
  • F. J. Fabozzi, P. N. Kolm, D. A. Pachamanova, and S. M. Focardi, Robust Portfolio Optimization and Management. Wiley, 2007.


Course syllabus.

Week 1 (8-Sep-2020):
    Theory: Introduction to convex optimization
    Practice: R for finance primer
Week 2 (15-Sep-2020):
    Theory: Convex optimization problems
    Practice: Solvers in R
Week 3 (22-Sep-2020):
    Slides: portfolio optimization
    Portfolio game Round 1: portfolio game with backtest based on the R package portfolioBacktest
Week 4 (29-Sep-2020):
    Backtesting: slides
    Data cleaning: slides
    Portfolio game - Round 2
Week 5 (6-Oct-2020):
    Theory: Prior information: Shrinkage and Black-Litterman
    Practice: Prior information: Shrinkage and Black-Litterman with R
    Additional material on factor models: slidesR session.
    Portfolio game - Round 3
Typhoon week (13-Oct-2020):
    Portfolio game - Round 4
Week 6 (20-Oct-2020):
    Theory: Regularized robust estimators under heavy tails and outliers
    Practice: Heavy-tailed estimators with R
    Software: R package ​fitHeavyTail
    Portfolio game - Round 5
Week 7 (27-Oct-2020):
    Slides: Robust portfolio optimization
    Portfolio game - Round 6
Week 8 (3-Nov-2020):
    Slides: Portfolio design with alternative risk measures
    Portfolio game - Round 7
Week 9 (10-Nov-2020):
    Slides: Risk parity portfolio
    Software: R package ​riskParityPortfolio
    Portfolio game - Round 8
Week 10 (17-Nov-2020):
    Slides: Index tracking
    Software: R package ​sparseIndexTracking
Week 11 (24-Nov-2020):
    Theory: Time series modeling of financial data
    Practice: Time series modeling of financial data with R
Week 12 (1-Dec-2020):
    Theory: Pairs trading
    Practice: Pairs trading with R
    Presentations of final projects by students