From SAA to Distributionally Robust Portfolio Optimization in R: Markowitz and CVaR in Practice
摘要
This paper shows how classic (Markowitz) and modern (CVaR) portfolio optimization models can be implemented efficiently in R. We compare two paradigms: the standard Sample Average Approximation (SAA) and distributionally robust optimization (DRO) using Wasserstein ambiguity sets. We first show that these advanced DRO models admit tractable reformulations as Second-Order Cone Programs (SOCPs). Then, we present the core contribution: a complete R pipeline that implements these exact SOCPs using the CVXR modeling package and the MOSEK solver. We provide code listings and discuss practical integration details. A numerical study on S&P 500 data illustrates SAA’s fragility, showing its consistent failure to meet out-of-sample return constraints. In contrast, the WDRO models successfully achieve this target, demonstrating a superior trade-off between performance and reliability. The result is a practical, reproducible toolkit for R users to build and solve advanced robust optimization problems.