CONTENTS

Portfolio Optimization

Why Portfolio Optimization?

Portfolio optimization is the process of selecting asset weights to maximize expected return for a given level of risk, or minimize risk for a given expected return. This mathematical framework, pioneered by Harry Markowitz in 1952, revolutionized investment management by formalizing the risk-return tradeoff and the benefits of diversification.

Modern portfolio theory provides the foundation for asset allocation, risk budgeting, and performance evaluation across all areas of finance — from individual retirement planning to institutional asset management and hedge fund strategies.

Mean-Variance Optimization

Markowitz Framework

Objective: Minimize portfolio variance subject to expected return constraint.
Setup:
  • Asset returns: rir_i with expected return μi\mu_i and covariance matrix Σ\Sigma
  • Portfolio weights: w=(w1,,wn)Tw = (w_1, \ldots, w_n)^T with i=1nwi=1\sum_{i=1}^n w_i = 1
  • Portfolio return: rp=wTrr_p = w^T r
  • Portfolio expected return: μp=wTμ\mu_p = w^T \mu
  • Portfolio variance: σp2=wTΣw\sigma_p^2 = w^T \Sigma w

Optimization Problem

Minimum Variance Portfolio:
minwwTΣwsubject to1Tw=1\min_{w} w^T \Sigma w \quad \text{subject to} \quad \mathbf{1}^T w = 1
Solution:
wMV=Σ111TΣ11w^{MV} = \frac{\Sigma^{-1} \mathbf{1}}{\mathbf{1}^T \Sigma^{-1} \mathbf{1}}
Target Return Portfolio:
minwwTΣwsubject to1Tw=1,μTw=μp\min_{w} w^T \Sigma w \quad \text{subject to} \quad \mathbf{1}^T w = 1, \quad \mu^T w = \mu_p
Solution:
w=g+hμpw = g + h\mu_p

where:

g=Σ1(1μC)1TΣ11,h=Σ1(μB1A)1TΣ11g = \frac{\Sigma^{-1}(\mathbf{1} - \mu C)}{\mathbf{1}^T \Sigma^{-1} \mathbf{1}}, \quad h = \frac{\Sigma^{-1}(\mu B - \mathbf{1} A)}{\mathbf{1}^T \Sigma^{-1} \mathbf{1}}

with:

A=1TΣ11,B=μTΣ11,C=μTΣ1μA = \mathbf{1}^T \Sigma^{-1} \mathbf{1}, \quad B = \mu^T \Sigma^{-1} \mathbf{1}, \quad C = \mu^T \Sigma^{-1} \mu

Efficient Frontier

The efficient frontier is the locus of all mean-variance efficient portfolios:
σp2(μp)=C2Bμp+Aμp2ACB2\sigma_p^2(\mu_p) = \frac{C - 2B\mu_p + A\mu_p^2}{AC - B^2}
Key Properties:
  1. Hyperbolic shape in mean-variance space
  2. Two-fund separation: Any efficient portfolio is a combination of any two efficient portfolios
  3. Minimum variance portfolio lies at the vertex

Capital Asset Pricing Model (CAPM)

When a risk-free asset with return rfr_f is available:

Capital Allocation Line:
μp=rf+μTrfσTσp\mu_p = r_f + \frac{\mu_T - r_f}{\sigma_T} \sigma_p
where the tangent portfolio has weights:
wT=Σ1(μrf1)1TΣ1(μrf1)w^T = \frac{\Sigma^{-1}(\mu - r_f \mathbf{1})}{\mathbf{1}^T \Sigma^{-1}(\mu - r_f \mathbf{1})}

Black-Litterman Model

Motivation

Traditional mean-variance optimization suffers from:

  1. Estimation error: Small changes in inputs cause large weight changes
  2. Extreme positions: Optimizers concentrate in few assets
  3. Counterintuitive results: Negative weights in "good" assets

Framework

Prior: Market capitalization weights wmw_m with equilibrium returns:
Π=δΣwm\Pi = \delta \Sigma w_m

where δ\delta is the risk aversion coefficient.

Views: Investor's views on specific returns:
Pμ=Q+εP\mu = Q + \varepsilon

where:

  • PP: Picking matrix (which assets the views concern)
  • QQ: Vector of view returns
  • εN(0,Ω)\varepsilon \sim \mathcal{N}(0, \Omega): View uncertainty
Bayesian Update:
μˉ=[(τΣ)1+PTΩ1P]1[(τΣ)1Π+PTΩ1Q]\bar{\mu} = [(\tau\Sigma)^{-1} + P^T\Omega^{-1}P]^{-1}[(\tau\Sigma)^{-1}\Pi + P^T\Omega^{-1}Q] Σˉ=[(τΣ)1+PTΩ1P]1\bar{\Sigma} = [(\tau\Sigma)^{-1} + P^T\Omega^{-1}P]^{-1}
Optimal Weights:
w=Σˉ1μˉ1TΣˉ1μˉw = \frac{\bar{\Sigma}^{-1}\bar{\mu}}{\mathbf{1}^T\bar{\Sigma}^{-1}\bar{\mu}}

Risk Parity

Equal Risk Contribution

Objective: Each asset contributes equally to portfolio risk.
Risk Contribution:
RCi=wiσpwi=wi(Σw)iσpRC_i = w_i \frac{\partial \sigma_p}{\partial w_i} = w_i \frac{(\Sigma w)_i}{\sigma_p}
Equal Risk Constraint:
RCi=σp2niRC_i = \frac{\sigma_p^2}{n} \quad \forall i

Maximum Diversification

Objective: Maximize the ratio of weighted average volatility to portfolio volatility:
MD=wTσwTΣwMD = \frac{w^T \sigma}{\sqrt{w^T \Sigma w}}

where σ=(σ1,,σn)T\sigma = (\sigma_1, \ldots, \sigma_n)^T are individual asset volatilities.

Minimum Variance

Risk parity often approximates the minimum variance portfolio when correlations are moderate.

Factor Models in Optimization

Single-Factor Model

ri=αi+βif+εir_i = \alpha_i + \beta_i f + \varepsilon_i
Covariance Matrix:
Σ=ββTσf2+D\Sigma = \beta\beta^T \sigma_f^2 + D

where D=diag(σε12,,σεn2)D = \text{diag}(\sigma_{\varepsilon_1}^2, \ldots, \sigma_{\varepsilon_n}^2).

Multi-Factor Model

ri=αi+k=1Kβi,kfk+εir_i = \alpha_i + \sum_{k=1}^K \beta_{i,k} f_k + \varepsilon_i
Benefits:
  1. Dimension reduction: KnK \ll n
  2. Structural interpretation: Economic factors
  3. Estimation efficiency: Fewer parameters

Fama-French Factors

Three-Factor Model:
ri,trf,t=αi+βi,M(rM,trf,t)+βi,SMBSMBt+βi,HMLHMLt+εi,tr_{i,t} - r_{f,t} = \alpha_i + \beta_{i,M}(r_{M,t} - r_{f,t}) + \beta_{i,SMB}SMB_t + \beta_{i,HML}HML_t + \varepsilon_{i,t}
Factors:
  • Market: Excess market return
  • SMB: Small minus big (size factor)
  • HML: High minus low (value factor)

Robust Optimization

Uncertainty Sets

Box Uncertainty:
U={μ:μiLμiμiU}\mathcal{U} = \{\mu : \mu_i^L \leq \mu_i \leq \mu_i^U\}
Ellipsoidal Uncertainty:
U={μ:(μμ^)TΣμ1(μμ^)κ2}\mathcal{U} = \{\mu : (\mu - \hat{\mu})^T \Sigma_\mu^{-1} (\mu - \hat{\mu}) \leq \kappa^2\}

Robust Formulation

Max-Min Problem:
maxwminμUμTwγ2wTΣw\max_{w} \min_{\mu \in \mathcal{U}} \mu^T w - \frac{\gamma}{2} w^T \Sigma w
Solution (ellipsoidal uncertainty):
w=1γΣ1(μ^κwTΣ1ΣμΣ1wwTΣ1wΣ1w)w^* = \frac{1}{\gamma} \Sigma^{-1}(\hat{\mu} - \kappa\sqrt{\frac{w^T \Sigma^{-1} \Sigma_\mu \Sigma^{-1} w}{w^T \Sigma^{-1} w}}\Sigma^{-1} w)

Dynamic Portfolio Optimization

Merton's Problem

Continuous-time setup:
maxct,wtE[0TU(ct)dt+B(XT)]\max_{c_t, w_t} \mathbb{E}\left[\int_0^T U(c_t) dt + B(X_T)\right]

subject to:

dXt=(r+wtT(μr1)ct)Xtdt+wtTσXtdWtdX_t = (r + w_t^T(\mu - r\mathbf{1}) - c_t)X_t dt + w_t^T \sigma X_t dW_t
Solution (power utility):
wt=1γΣ1(μr1)w_t = \frac{1}{\gamma} \Sigma^{-1}(\mu - r\mathbf{1})

Multi-Period Discrete Model

Dynamic Programming:
Vt(x)=maxwtE[Vt+1(xt+1)xt=x]V_t(x) = \max_{w_t} \mathbb{E}[V_{t+1}(x_{t+1}) | x_t = x]
Challenges:
  1. Curse of dimensionality: State space grows exponentially
  2. Parameter uncertainty: Must update beliefs
  3. Transaction costs: Rebalancing costs

Alternative Risk Measures

Value at Risk (VaR) Optimization

Objective: Minimize portfolio VaR:
minwVaRα(wTr)subject toμTwμmin\min_{w} \text{VaR}_\alpha(w^T r) \quad \text{subject to} \quad \mu^T w \geq \mu_{\min}
Linear approximation (normal returns):
VaRαμTwΦ1(α)wTΣw\text{VaR}_\alpha \approx \mu^T w - \Phi^{-1}(\alpha) \sqrt{w^T \Sigma w}

Conditional Value at Risk (CVaR)

CVaRα=E[LLVaRα]\text{CVaR}_\alpha = \mathbb{E}[L | L \geq \text{VaR}_\alpha]
Advantages:
  1. Coherent risk measure: Satisfies desirable properties
  2. Convex optimization: Easier to solve
  3. Tail risk focus: Captures extreme scenarios

Optimization with CVaR

minw,ζζ+11αE[max(0,wTrζ)]\min_{w,\zeta} \zeta + \frac{1}{1-\alpha} \mathbb{E}[\max(0, -w^T r - \zeta)]

Constraints and Practical Considerations

Common Constraints

Long-only:
wi0iw_i \geq 0 \quad \forall i
Sector limits:
isector swius\sum_{i \in \text{sector } s} w_i \leq u_s
Turnover constraints:
i=1nwiwi,prevT\sum_{i=1}^n |w_i - w_{i,\text{prev}}| \leq T
Tracking error:
(wwb)TΣ(wwb)TE\sqrt{(w - w_b)^T \Sigma (w - w_b)} \leq TE

Transaction Costs

Linear costs:
Cost=i=1nciwiwi,prev\text{Cost} = \sum_{i=1}^n c_i |w_i - w_{i,\text{prev}}|
Market impact:
Cost=i=1nαi(wiwi,prev)2\text{Cost} = \sum_{i=1}^n \alpha_i (w_i - w_{i,\text{prev}})^2

Machine Learning in Portfolio Optimization

Feature Engineering

Technical indicators: Moving averages, momentum, volatility Fundamental ratios: P/E, P/B, ROE, debt-to-equity Macroeconomic variables: GDP growth, inflation, term structure Alternative data: Sentiment, satellite data, credit card spending

Regularization

Ridge regression: minwyXβ2+λβ2\min_w ||y - X\beta||^2 + \lambda ||\beta||^2 Lasso regression: minwyXβ2+λβ1\min_w ||y - X\beta||^2 + \lambda ||\beta||_1 Elastic net: Combines ridge and lasso penalties

Neural Networks

Deep learning for:
  1. Return prediction: Non-linear factor models
  2. Risk modeling: Time-varying covariance
  3. Regime detection: Hidden market states

Performance Evaluation

Risk-Adjusted Returns

Sharpe Ratio:
SR=μprfσpSR = \frac{\mu_p - r_f}{\sigma_p}
Information Ratio:
IR=μpμbTEIR = \frac{\mu_p - \mu_b}{TE}
Sortino Ratio:
Sortino=μprfDownside deviation\text{Sortino} = \frac{\mu_p - r_f}{\text{Downside deviation}}

Alpha Decomposition

Jensen's Alpha:
α=μprfβ(μmrf)\alpha = \mu_p - r_f - \beta(\mu_m - r_f)
Multi-factor alpha:
α=μprfk=1Kβk(μfkrf)\alpha = \mu_p - r_f - \sum_{k=1}^K \beta_k (\mu_{f_k} - r_f)

ESG and Sustainable Investing

ESG Integration

ESG scores as additional constraints or tilts:
minwwTΣwsubject towTsESGsmin\min_{w} w^T \Sigma w \quad \text{subject to} \quad w^T s_{ESG} \geq s_{\min}
Exclusionary screening: Remove assets below ESG threshold Best-in-class: Select top ESG performers within sectors

Impact Measurement

Carbon footprint: Portfolio-weighted carbon intensity UN SDGs: Alignment with Sustainable Development Goals Engagement metrics: Proxy voting, shareholder resolutions

Algorithmic Implementation

Quadratic Programming

Standard mean-variance problems reduce to:

minw12wTQw+cTws.t.Aw=b,Gwh\min_w \frac{1}{2} w^T Q w + c^T w \quad \text{s.t.} \quad Aw = b, \quad Gw \leq h

Interior Point Methods

Efficient for large-scale problems with many constraints.

Heuristic Approaches

Genetic algorithms: Global optimization for complex objectives Simulated annealing: Escape local minima Particle swarm: Population-based optimization

Connection to Other Topics

Portfolio optimization integrates many quantitative concepts:

Portfolio Optimization | q4quant.studio