Applications: Portfolio Optimization and Regularization
Convex optimization at work: minimum-variance portfolios and ridge/lasso estimators.
Leads to: Phase 11 (stat learning) and 14 (math finance) build on these formulations.
Learning Objectives
Click a status chip to cycle: Not started → In progress → Studied → Practiced → Needs review → Mastered.
- Formulate the minimum-variance portfolio as a convex quadratic program and solve it via KKT.
- Derive the two-asset closed-form minimum-variance weights.
- Formulate mean-variance (Markowitz) optimization and interpret the risk-aversion trade-off.
- Express ridge and lasso regression as convex problems and explain their effect.
- Implement and verify the closed-form two-asset minimum-variance solution.
Key Vocabulary
- Covariance matrix \(\Sigma\)
- PSD matrix of asset return covariances; \(w^\top\Sigma w\) is portfolio variance.
- Minimum-variance portfolio
- Weights minimizing \(w^\top\Sigma w\) subject to \(\mathbf1^\top w=1\) (fully invested).
- Mean-variance / Markowitz
- Trade off return against variance: \(\max\ \mu^\top w-\tfrac{\gamma}{2}w^\top\Sigma w\).
- Risk aversion \(\gamma\)
- The weight on variance; larger \(\gamma\) gives more conservative portfolios.
- Ridge regression
- Least squares with an \(\ell_2\) penalty \(\lambda\|\beta\|_2^2\); shrinks coefficients, convex, closed form.
- Lasso
- Least squares with an \(\ell_1\) penalty \(\lambda\|\beta\|_1\); convex, induces sparsity (variable selection).
Intuition & Motivation
The minimum-variance portfolio
Let \(\Sigma\succ0\) be the return covariance of \(n\) assets and \(w\) the portfolio weights. Fully invested means \(\mathbf1^\top w=1\). Portfolio variance is \(w^\top\Sigma w\). The problem
is a convex QP with one equality constraint - exactly the KKT worked example of 10.3 with \(Q=\Sigma,\ a=\mathbf1\). Its solution is
Mean–variance (Markowitz)
Investors want return too. Maximize expected return penalized by risk:
a concave (hence convex-minimization) problem. Its KKT solution \(w^\star=\tfrac1\gamma\Sigma^{-1}(\mu-\nu\mathbf1)\) traces the efficient frontier as \(\gamma\) varies: large \(\gamma\) (very risk-averse) approaches the minimum-variance portfolio (10.10); small \(\gamma\) chases return.
Regularization as convex optimization
The same machinery tames regression. Ordinary least squares \(\min_\beta\|y-X\beta\|_2^2\) overfits when features are many or collinear. Add a convex penalty:
- Ridge: \(\min_\beta\|y-X\beta\|_2^2+\lambda\|\beta\|_2^2\). Strictly convex; closed form \(\hat\beta=(X^\top X+\lambda I)^{-1}X^\top y\). Shrinks all coefficients, fixes ill-conditioning (note the \(+\lambda I\) improves the condition number - see 10.4).
- Lasso: \(\min_\beta\|y-X\beta\|_2^2+\lambda\|\beta\|_1\). Convex but non-smooth; drives some coefficients exactly to zero, performing variable selection. Solved by KKT/subgradient or coordinate descent.
Both penalties are convex, so the estimators are global optima - statistically stable and reproducible. This connects convex optimization directly to statistical learning (Phase 11).
Interactive: solve a two-asset portfolio
- Forgetting the budget constraint \(\mathbf1^\top w=1\); the unconstrained variance minimizer is \(w=0\) (invest nothing).
- Assuming minimum-variance weights are nonnegative. Without a no-short constraint, \(w_i\) can be negative (a short position).
- Inverting a near-singular \(\Sigma\) from noisy data; regularize/shrink \(\Sigma\) (echoing ridge) for stable weights.
- Treating lasso like ridge - lasso is non-smooth, so plain gradient descent needs subgradients/proximal steps.
- Estimation error in \(\Sigma\) and \(\mu\) dominates real portfolio risk; shrinkage (a convex regularizer on \(\Sigma\)) often beats the raw optimum.
- Ridge = \(\ell_2\) shrinkage (keeps all vars, improves conditioning); lasso = \(\ell_1\) (sparse, selects vars). The choice is a modeling decision.
- Adding a no-short constraint \(w\ge0\) turns the QP into one needing KKT with inequality multipliers - still convex, solvable by projection/QP solvers.
Knowledge Check
Practical Exercise
Two assets: \(\sigma_1=0.10,\ \sigma_2=0.20,\ \rho=0.25\). (a) Compute the minimum-variance weights. (b) Compute the resulting portfolio variance. (c) Is either weight a short position?
(a) \(\text{cov}=\rho\sigma_1\sigma_2=0.25\cdot0.10\cdot0.20=0.005\). \(w_1=\dfrac{\sigma_2^2-\text{cov}}{\sigma_1^2+\sigma_2^2-2\text{cov}}=\dfrac{0.04-0.005}{0.01+0.04-0.01}=\dfrac{0.035}{0.04}=0.875\), \(w_2=0.125\).
(b) \(\sigma^2=w_1^2\sigma_1^2+w_2^2\sigma_2^2+2w_1w_2\text{cov}=0.875^2(0.01)+0.125^2(0.04)+2(0.875)(0.125)(0.005)\) \(=0.007656+0.000625+0.001094\approx0.009375\), so \(\sigma\approx0.0968\) (below asset 1's 0.10).
(c) Both weights are positive (0.875 and 0.125), so no shorting. Diversification lowered risk below the least-risky asset alone.
Lesson Summary
Retrieval Practice
Close the lesson and answer from memory before checking. This is deliberate, effortful recall - the single highest-yield study action.
A: \(w^\star=\Sigma^{-1}\mathbf1/(\mathbf1^\top\Sigma^{-1}\mathbf1)\); two-asset \(w_1=(\sigma_2^2-\rho\sigma_1\sigma_2)/(\sigma_1^2+\sigma_2^2-2\rho\sigma_1\sigma_2)\).
A: Ridge adds \(\lambda\|\beta\|_2^2\) (smooth, shrinks all, closed form); lasso adds \(\lambda\|\beta\|_1\) (non-smooth, induces sparsity). Both add a convex penalty to a convex loss, so the problems are convex.
Completion Checklist
- I can explain the core ideas in my own words
- I worked the derivations/examples by hand
- I completed the interactive workbench(es)
- I passed the knowledge check