Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 Portfolio Optimization # 1 A. Charpentier (Université de Rennes 1) Université de Rennes 1, 2017/2018 1 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 Markowitz (1952) & Theoretical Approach Following Markowitz (1952) , consider n assets, infinitely divisible. Their returns are random variables, denoted X , (jointly) normaly distributed, N ( µ , Σ ), i.e. E [ X ] = µ and var( X ) = Σ . Let ω denotes weights of a given portfolio. Portfolio risk is measured by its variance var( α T X ) = σ 2 α = α T Σ α For minimal variance portfolios, with a given portfolio return, ¯ r , the optimization problem can be stated as E ( α T X ) = α T µ = ¯ � � r α ⋆ = argmin α T Σ α s.t. α T 1 = 1 Allocation α is said to be efficient if it is not possible to find another one, with the same expected return, and a strictly lower variance, or dually, to find another one with the same variance, and a strictly higher expected return. 2 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 Markowitz (1952) & Theoretical Approach Recall that to solve a program � � α ∗ = argmin f ( α ) s.t. g 1 ( α ) , · · · , g p ( α ) ≥ 0 , where g 1 , · · · , g p are p continuously differentiable functions, a necessary and sufficient condition for α ∗ to be a solution is that ( α ∗ , λ ) is solution of the n + p first order conditions ∂ ( f ( α ) + λ 1 g 1 ( α ) + · · · + λ p g p ( α )) = 0 for i = 1 , 2 , ..., n, ∂α i ∂ ( f ( α ) + λ 1 g 1 ( α ) + · · · + λ p g p ( α )) = 0 for j = 1 , 2 , ..., p. ∂λ j Constants λ = ( λ 1 , · · · , λ p ) are Lagrange multipliers, and function α �→ f ( α ) + λ 1 g 1 ( α ) + · · · + λ p g p ( α ) is the Lagrangien associated with the optimization program. 3 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 Markowitz (1952) & Theoretical Approach Here we want to minimize var( αX ), i.e. α T Σ α (a quadratic function) with two (linear) constraints. We want to solve � � ∂ α ′ Σ α + λ 1 ( α T I − 1) + λ 2 ( α T µ − ¯ = 0 for i = 1 , 2 , · · · , n, r ) ∂α i � � ∂ α ′ Σ α + λ 1 ( α T I − 1) + λ 2 ( α T µ − ¯ r ) = 0 for j = 1 , 2 . ∂λ j Observe that ∂ ∂ ∂ αα T Σ α = 2Σ α and ∂ αµ T α = µ , so that α ∗ has to be α ∗ = λ 1 Σ − 1 I + λ 2 Σ − 1 µ , where Lagrange multipliers are given by λ 1 I T Σ − 1 µ + λ 2 I T Σ − 1 I = 1 , λ 1 µ T Σ − 1 µ + λ 2 µ T Σ − 1 I = ¯ r 4 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 Markowitz (1952) & Theoretical Approach Set a = I T Σ − 1 µ , b = µ T Σ − 1 µ and c = I T Σ − 1 I , we can write the last system λ 1 a + λ 2 c = 1 , λ 1 c + λ 2 a = ε Set d = bc − a 2 , so that λ 1 = cε − a and λ 2 = b − aε . d d From that expression of Lagrange multipliers, use the first order conditions to express Σ α = λ 1 R + λ 2 I and the optimal variance of the portfolio is σ 2 ∗ = α T Σ α = λ 1 ε + λ 2 , 5 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 Markowitz (1952) & Theoretical Approach Hence, without any risk-free asset, the efficient frontier in the mean-variance problem is a parabolic function ∗ = cε 2 − 2 aε + b σ 2 d where ε is the expected return of the portfolio. Further, we have optimal weights α ∗ = Σ − 1 ( λ 1 X + λ 2 I ) , which is a linear expression. 6 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 Computational Aspects Consider the following three assets, as in Zivot (2013) 1 > asset.names <- c("MSFT", "NORD", "SBUX") 2 > mu.vec = c(0.0427 , 0.0015 , 0.0285) 3 > names(mu.vec) = asset.names 4 > sigma.mat = matrix(c(0.0100 , 0.0018 , 0.0011 ,0.0018 , 0.0109 , 0.0026 ,0.0011 , 0.0026 , 0.0199) ,nrow=3, ncol =3) 5 > dimnames (sigma.mat) = list(asset.names , asset.names) 6 > mu.vec MSFT NORD SBUX 7 8 0.0427 0.0015 0.0285 9 > sigma.mat MSFT NORD SBUX 10 11 MSFT 0.0100 0.0018 0.0011 12 NORD 0.0018 0.0109 0.0026 13 SBUX 0.0011 0.0026 0.0199 7 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 Computational Aspects Here are the three assets in the ( σ, µ )-plane (with possibly much more) 8 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 Computational Aspects Return and variance of a given portfolio are given by 1 > x.vec = rep (1 ,3)/3 2 > names(x.vec) = asset.names 3 > mu.p.x = crossprod (x.vec ,mu.vec) 4 > sig2.p.x = t(x.vec)%*%sigma.mat%*%x.vec 5 > sig.p.x = sqrt(sig2.p.x) 6 > mu.p.x [,1] 7 8 [1,] 0.02423 9 > sig.p.x [,1] 10 11 [1,] 0.07587 Global minimum variance portfolio is given by solving min { α T Σ α } s.t. α T 1 = 1 9 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 First order conditions on the Lagrangian yield α ⋆ 2 Σ 1 0 = 1 T 0 λ 1 � �� � � �� � A b 10 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 Computational Aspects Here we have 1 > top.mat = cbind (2*sigma.mat , rep(1, 3)) 2 > bot.vec = c(rep(1, 3), 0) 3 > Am.mat = rbind(top.mat , bot.vec) 4 > b.vec = c(rep(0, 3), 1) 5 > z.m.mat = solve(Am.mat)%*%b.vec 6 > m.vec = z.m.mat [1:3 ,1] 7 > m.vec MSFT NORD SBUX 8 9 0.4411 0.3656 0.1933 the portfolio return and standard deviation are 1 > mu.gmin = as.numeric(crossprod (m.vec , mu.vec)) 2 > mu.gmin 3 [1] 0.02489 4 > sig2.gmin = as.numeric(t(m.vec)%*%sigma.mat%*%m.vec) 5 > sig.gmin = sqrt(sig2.gmin) 11 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 6 > sig.gmin 7 [1] 0.07268 Another way to compute it is to go further on the analytical expression, and to derive Σ − 1 1 α ⋆ = 1 T Σ − 1 1 1 > one.vec = rep(1, 3) 2 > sigma.inv.mat = solve(sigma.mat) 3 > top.mat = sigma.inv.mat%*%one.vec 4 > bot.val = as.numeric ((t(one.vec)%*%sigma.inv.mat%*%one.vec)) 5 > m.mat = top.mat/bot.val 6 > m.mat [,1] MSFT NORD SBUX 7 8 0.4411 0.3656 0.1933 12 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 13 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 Efficient portfolios are obtained by solving min { α T Σ α } s.t. α T µ = r 0 and α T 1 = 1 First order conditions on the Lagrangian yield α ⋆ 2 Σ 1 0 µ µ T = 0 0 λ 1 r 0 1 T 0 0 λ 2 1 � �� � � �� � A b If our target is to get the same return as Microsoft, say ( MSFT ), 1 > top.mat = cbind (2*sigma.mat , mu.vec , rep(1, 3)) 2 > mid.vec = c(mu.vec , 0, 0) 3 > bot.vec = c(rep(1, 3), 0, 0) 4 > A.mat = rbind(top.mat , mid.vec , bot.vec) 5 > bmsft.vec = c(rep(0, 3), mu.vec["MSFT"], 1) 14 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 6 > z.mat = solve(A.mat)%*%bmsft.vec 7 > x.vec = z.mat [1:3 ,] 8 > x.vec MSFT NORD SBUX 9 10 0.82745 -0.09075 0.26329 the portfolio return and standard deviation are 1 > mu.px = as.numeric(crossprod (x.vec , mu.vec)) 2 > mu.px 3 [1] 0.0427 4 > sig2.px = as.numeric(t(x.vec)%*%sigma.mat%*%x.vec) 5 > sig.px = sqrt(sig2.px) 6 > sig.px 7 [1] 0.09166 If our target is to get the same return as Starbucks ( SBUX ), 1 > bsbux.vec = c(rep(0, 3), mu.vec["SBUX"], 1) 2 > z.mat = solve(Ax.mat)%*%bsbux.vec 15 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Arthur Charpentier, Université de Rennes 1, Portfolio Optimization - 2017 3 > y.vec = z.mat [1:3 ,] 4 > y.vec MSFT NORD SBUX 5 6 0.5194 0.2732 0.2075 with expected return and standard deviation 1 > mu.py = as.numeric(crossprod (y.vec , mu.vec)) 2 > sig2.py = as.numeric(t(y.vec)%*%sigma.mat%*%y.vec) 3 > sig.py = sqrt(sig2.py) 4 > mu.py 5 [1] 0.0285 6 > sig.py 7 [1] 0.07355 Observe that actually, those two portfolios are extremely correled 1 > sigma.xy = as.numeric(t(x.vec)%*%sigma.mat%*%y.vec) 2 > rho.xy = sigma.xy/(sig.px*sig.py) 3 > rho.xy 16 @freakonometrics freakonometrics freakonometrics.hypotheses.org
Recommend
More recommend