Financial Engineering: Portfolio Optimization Daniel P. Palomar Hong Kong University of Science and Technology (HKUST) ELEC5470 - Convex Optimization Fall 2015-16, HKUST, Hong Kong Outline of Lecture • Data model • Return, risk measures, and Sharpe ratio • Basic mean-variance portfolio formulation • Max Sharpe ratio portfolio formulation • CVaR portfolio formulation • Robust portfolio design • Index replication with `1-norm minimization Daniel P. Palomar 1 Data Model • Consider M financial assets, e.g., stocks of a major index such as S&P 500 and Hang Seng Index. • Denote the absolute prices at time t by pm,t, m = 1, . . . , M . • The simple (linear) and continuously-compounded (logarithmic) returns are rm,t = (pm,t − pm,t−1) /pm,t−1 ym,t = log (pm,t) − log (pm,t−1) . • Observe that, for small values of the return, we have ym,t ≈ rm,t. • We will mainly use linear returns, stacked as rt ∈ RM , and assume that they are i.i.d. random variables with mean µ ∈ RM and covariance matrix Σ ∈ RM ×M . Daniel P. Palomar 2 Return • Suppose we invest 1$ in the mth asset at time t − 1, then at time t we will have an amount of 1$× (pm,t/pm,t−1). • The relative benefit or return will be (pm,t/pm,t−1 − 1) which is precisely equal to rm,t. • If now we invest 1$ distributed over the M assets according to the portfolio weights w (with 1T w = 1), then the overall return will be w T rt . • The key quantity is then the random return wT rt. • The expected or mean return is wT µ and the variance is wT Σw. Daniel P. Palomar 3 Risk Control • In finance, the mean return is very relevant as it quantifies the average benefit. • However, in practice, the average performance is not good enough and one needs to control the probability of going bankrupt. • Risk measures control how risky an investment strategy is. • The most basic measure of risk is given by the variance: a higher variance means that there are large peaks in the distribution which may cause a big loss. • There are more sophisticated risk measures such as Value-at-Risk (VaR) and Conditional VaR (CVaR). Daniel P. Palomar 4 Mean-Variance Tradeoff • The mean return wT µ and the variance (risk) wT Σw constitute two important performance measures. • Usually, the higher the mean return the higher the variance and vice-versa. • Thus, we are faced with two objectives to be optimized. This is a multi-objective optimization problem. • They define a fundamental mean-variance tradeoff curve (Pareto curve). The choice of a specific point in this tradeoff curve depends on how agressive or risk-averse the investor is. Daniel P. Palomar 5 Daniel P. Palomar 6 Sharpe Ratio • The Sharpe ratio is akin to the SINR in communication systems. • It is defined as the ratio of the mean return (excess w.r.t. the return of the risk-free asset rf ) to the risk measured as the square root of the variance (standard deviation): wT µ − rf S = √ . T w Σw • The Sharpe ratio can be understood as the expected return per unit of risk. • The portfolio w that maximizes the Sharpe ratio lies on the Pareto curve. Daniel P. Palomar 7 Mean-Variance Optimization (Markowitz, 1956) • There are two obvious formulations for the portfolio optimization. • Maximization of mean return: maximize wT µ subject to wT Σw ≤ α 1T w = 1. w • Minimization of risk: minimize wT Σw subject to wT µ ≥ β 1T w = 1. w Daniel P. Palomar 8 • Another obvious formulation is the scalarization of the multiobjective optimization problem: maximize wT µ − γwT Σw subject to 1T w = 1. w • These three formulations give different points on the Pareto optimal curve. • They all require knowledge of one parameter (α, β, and γ). • If we consider the Sharpe ratio as a good measure of performance, we could consider instead maximizing it directly. • Additional constraints can be included such as w ≥ 0 to allow for long-only transactions (no short-selling). Daniel P. Palomar 9 Max Sharpe Ratio Portfolio Formulation • Let’s start by formulating the maximization of the Sharpe ratio as follows: √ T T minimize w Σw/ w µ − rf w 1T w = 1 w≥0 subject to • This is a quasi-convex problem as can be seen in the epigraph form: minimize w,t subject to t T t w µ − rf 1T w = 1 w≥0 1/2 ≥ Σ w which can be solve by bisection over t. Daniel P. Palomar 10 Sharpe Ratio Formulation in Convex Form • Theorem: The maximization of the Sharpe ratio can be rewritten in convex form as the QP minimize w̃T Σw̃ subject to (µ − rf 1) w̃ = 1 1T w̃ ≥ 0 w̃ ≥ 0. w̃ T Proof: T • Defining √ w̃ = tw with t = 1/ w µ − rf > 0, the objective becomes w̃T Σw̃, the sum constraint becomes 1T w̃ = t, and the problem becomes Daniel P. Palomar 11 minimize w,w̃,t subject to √ w̃T Σw̃ T t = 1/ w µ − rf > 0 w̃ = tw 1T w̃ = t > 0 w̃ ≥ 0. • Observe that the first constraint 1/t = wT µ − rf can be rewritten T in terms of w̃ as 1 = (µ − rf 1) w̃. So the problem becomes √ minimize w̃T Σw̃ w,w̃,t subject to Daniel P. Palomar T (µ − rf 1) w̃ = 1 w̃ = tw 1T w̃ = t > 0 w̃ ≥ 0. 12 • Note that the strict inequality t > 0 is equivalent to t ≥ 0 because t = 0 can never happen as w̃ would be zero and the first constraint would not be satisfied. • We can now get rid of w and t in the formulation as they can be directly obtained as w = w̃/t and t = 1T w̃: minimize w̃T Σw̃ subject to (µ − rf 1) w̃ = 1 1T w̃ ≥ 0 w̃ ≥ 0. w̃ T • QED! Daniel P. Palomar 13 Value-at-Risk (VaR & CVaR) Models • Mean-variance model penalizes up-side and down-side risk equally, whereas most investors don’t mind up-side risk. • Solution: use alternative risk measures (not variance). • VaR denotes the maximum loss with a specified confidence level (e.g., confidence level = 95%, period = 1 day). • Let ξ be a random variable representing the loss from a portfolio over some period of time: VaRα = min {ξ0 : Pr (ξ ≤ ξ0) ≥ α} . • Undesirable properties of VaR: does not take into account risks exceeding VaR, is nonconvex, is not sub-additive. Daniel P. Palomar 14 • The Conditional VaR (CVaR) takes into account the shape of the losses exceeding the VaR through the average: CVaRα = E [ξ | ξ ≥ VaRα] . Daniel P. Palomar 15 CVaR Portfolio Formulation • Dealing directly with VaR and CVaR quantities is not tractable. • Let f (w, r) be an arbitrary cost function, where w is the optimization variable (portfolio) and r denotes the random parameters (asset returns). Example: f (w, r) = −wT r. • Consider, for example, the maximization of the mean return subject to a CVaR risk constraint on the loss: maximize wT µ subject to CVaRα (f (w, r)) ≤ c 1T w = 1 w where CVaRα (f (w, r)) = E [f (w, r) | f (w, r) ≥ VaRα (f (w, r))] . Daniel P. Palomar 16 CVaR in Convex Form • Theorem: Define the auxiliary function Z 1 + Fα (w, ζ) = ζ + [f (w, r) − ζ] p (r) dr. 1−α Then, we have the following two results: (a) VaRα is a minimizer of Fα (w, ζ) with respect to ζ: VaRα (f (w, r)) = arg min Fα (w, ζ) ζ (b) CVaRα equals minimal value (w.r.t. ζ) of Fα (w, ζ): CVaRα (f (w, r)) = min Fα (w, ζ) ζ Daniel P. Palomar 17 Proof CVaR in Convex Form (a) The minimizer ζ ? of Fα (w, ζ) satisfies: 0 ∈ ∂ζ Fα (w, ζ ?). For example we choose the following subgradient: Z 1 ? sζ Fα (w, ζ ) = 1 − I (f (w, r) ≥ ζ ?) p (r) dr 1−α 1 = 1− Pr (f (w, r) ≥ ζ ?) = 0 1−α where I (·) is the indicator function. Consequently, Pr (f (w, r) ≥ ζ ?) = 1 − α =⇒ ζ ? = VaRα (f (w, r)) . Daniel P. Palomar 18 Proof CVaR in Convex Form (cont’d) (b) 1 min Fα (w, ζ) = Fα (w, ζ ) = ζ + ζ 1−α ? ? Z + [f (w, r) − ζ ?] p (r) dr. Recall that CVaRα (f (w, r)) = E [f (w, r) | f (w, r) ≥ VaRα (f (w, r))] Z 1 f (w, r) p (r) dr = 1 − α r:f (w,r)≥VaRα Z 1 + = [f (w, r) − VaRα] p (r) dr + VaRα 1−α Daniel P. Palomar 19 CVaR in Convex Form (cont’d) • Corollary: min CVaRα (f (w, r)) = min Fα (w, ζ) w w,ζ • In words, minimizing Fα (w, ζ) simultaneously calculates the optimal CVaR and VaR. • Corollary: If f (w, r) is convex in w for each r, then Fα (w, ζ) is convex! Proof: 1 Fα (w, ζ) = ζ + 1−α Daniel P. Palomar Z + [f (w, r) − ζ] p (r) dr. 20 Reduction of CVaR Optimization to LP • We start by considering discrete distributions or approximating the continuous one by a discrete one so that: N + 1 X k Fα (w, ζ) = ζ + pk f w, r − ζ . 1−α k=1 • Then include dummy variables zk : + k k zk ≥ f w, r − ζ =⇒ zk ≥ f w, r − ζ, zk ≥ 0 Daniel P. Palomar 21 • The problem of minimizing the CVaR reduces to the following LP: minimize w,ζ,z subject to ζ+ 1 1−α k PN k=1 pk zk f w, r − ζ ≤ zk ≥ 0 1T w = 1 where the cost function is assumed linear in w: f (w, r) = −wT r. • The maximization of the mean return subject to a CVaR constraint becomes: maximize wT µ w,ζ,z PN 1 subject to ζ + 1−α k=1 pk zk ≤ c k f w, r − ζ ≤ zk ≥ 0 1T w = 1. Daniel P. Palomar 22 Robust Porfolio Design • In practice, as usual, the parameters defining the optimization problem are not always perfectly known. Hence, the concept of robust design. We will consider worst-case robust design. • There are many ways to formulate a worst-case design for the portfolio design. For example, we could consider a robust meanvariance formulation: minimize max wT Σw w subject to Σ∈SΣ min wT µ ≥ β µ∈Sµ T 1 w = 1. • Now, depending how we define the uncertainty sets for the mean return vector Sµ and for the covariance matrix SΣ, the problem may be convex or not. Daniel P. Palomar 23 • We will consider one particular example based on modeling the returns via a factor model: r = µ + VT f + where f denotes the random factors distributed according to f ∼ N (0, F) and denotes the a random residual error with uncorrelated elements distributed according to ∼ N (0, D) with D = diag (d). • The returns are then distributed according to r ∼ N µ, VT FV + D and the obtained return using portfolio w has mean µT w and variance wT VT FV + D w. • We will consider uncertainty in the knowledge of µ, V, and D, while F is assumed know; in fact, we consider F = I. Daniel P. Palomar 24 • We can then formulate the robust mean-variance problem as T T minimize max w V V+D w w subject to V∈SV ,D∈SD min wT µ µ∈Sµ T ≥β 1 w = 1. • We will define the uncertainty as follows: Sµ = {µ | µ = µ0 + δ, |δi| ≤ γi, i − 1, . . . , M } SV = {V | V = V0 + ∆, k∆kF ≤ ρ} SD = D | D = diag (d) , di ∈ di, di , i − 1, . . . , M . • Let’s now elaborate on each of the inner optimizations... Daniel P. Palomar 25 • First, consider the worst case mean return: min µT w = µT0 w + min δ T w = µT0 w − γ T |w| µ∈Sµ |δi|≤γi which is a concave function. • Second, let’s turn to the second term of the worst-case variance: T max w Dw = D∈SD max di∈[di,di] PM 2 d w i i i=1 = PM 2 = wT Dw d w i=1 i i • Finally, let’s focus on the first term of the worst-case variance: max wT VT Vw ≡ max V∈SV Daniel P. Palomar k∆kF ≤ρ kV0w + ∆wk = kV0wk + ρ kwk 26 • Proof: From the triangle inequality we have kV0w + ∆wk ≤ kV0wk + k∆wk √ ≤ kV0wk + wT ∆T ∆w ≤ kV0wk + kwk k∆kF ≤ kV0wk + kwk ρ but this upper bound is achievable by the worst-case variable wT ∆=u ρ kwk where ( u= Daniel P. Palomar V0 w kV0wk any unitary vector if V0w 6= 0 otherwise. 27 • Finally, the robust portfolio formulation is 2 minimize (kV0wk + ρ kwk) + wT Dw subject to µT0 w − γ T |w| ≥ β 1T w = 1. w or, better, as the SOCP minimize t2 + wT Dw subject to t ≥ kV0wk + ρ kwk µT0 w ≥ β + γ T |w| 1T w = 1. w,t Daniel P. Palomar 28 Index Replication • Index tracking or benchmark replication is an strategy investment aimed at mimicking the risk/return profile of a financial instrument. • For practical reasons, the strategy focuses on a reduced basket of representative securities. • This problem is also regarded as portfolio compression and it is intimately related to compressed sensing and `1-norm minimization techniques. • One example is the replication of an index, e.g., Hang Seng index, based on a reduced set of assets. Daniel P. Palomar 29 Tracking Error • Let c ∈ RM represent the actual benchmark weight vector and let w ∈ RM denote the replicating portfolio. • Investment managers seek to minimize the following tracking error performance measure: q T T E1 (w) = (c − w) Σ (c − w). • In practice, however, the benchmark weight vector c is unknown and the error measure is defined in terms of market observations. Daniel P. Palomar 30 Empirical Tracking Error • Let rc ∈ RN contain N temporal observations of the returns of the benchmark or index and let matrix R = r1 · · · rN ∈ RM ×N contain column-wise the returns of the individual assets over time. • The empirical tracking error can be defined as T T E2 (w) = rc − R w2 . • We can then formulate the sparse index replication problem as minimize T E2 (w) + γcard (w) subject to w≥0 1T w = 1. w Daniel P. Palomar 31 Index Replication with `1-Norm Minimization • The cardinality operator is nonconvex and can be approximated in a number of ways. • The simplest approximation is based on the `1-norm: T rc − R w + γ kwk minimize 1 2 w subject to w≥0 1T w = 1. • Of course, there are more sophisticated methods such as the reweighted `1-norm approximation based on a successive convex approximation (see lecture on `1-norm minimization for details). Daniel P. Palomar 32 Simulations of Sparse Index Replication Daniel P. Palomar 33 Summary • We have introduced basic concepts and data model for portfolio optimization. • Then, we have considered different formulations for the portfolio optimization problem: – – – – basic mean-variance formulations Sharpe ratio maximization in convex form CVaR optimization in convex form worst-case robust designs in convex form • Finally, we have studied related problem such as the index replication based on the `1-norm. Daniel P. Palomar 34 References • D. Luenberger, Investment Science, Oxford Univ. Press, 1997. • David Ruppert, Statistics and Data Analysis for Financial Engineering, Springer Texts in Statistics, 2010. • G. Cornuejols and R. Tutuncu, Optimization Methods in Finance, Cambridge Univ. Press, 2007. • F. Fabozzi, P. Kolm, D. Pachamanova, S. Focardi, Robust Portfolio Optimization and Management, Wiley Finance, 2007. Daniel P. Palomar 35