Chapter 5 Portfolio Analysis 5.1 Covariance Matrices For general random variables X = (x1 , . . . , xn )T , Y = (y1 , . . . , yn )T with means (µ1 , . . . , µn )T , (ν1 , . . . , νn )T respectively, the Covariance Matrix of X, Y is the matrix such that (cov(X, Y ))ij = E((xi − µi )(yi − νj )) and the Covariance Matrix of X is the matrix cov(X) such that (cov(X))ij = (cov(X, X))ij = E((xi − µi )(xj − µj )) Write zi = xi − µi so that (cov(X))ij = (cov(X, X))ij = E(zi zj ) = cov(zi , zj ) The Correlation Matrix of X is the covariance matrix of the vector ( z1 zn T x1 − µ1 xn − µn T ,..., ) =( ,..., ) σ1 σn σ1 σn where σi is the standard deviation of zi (and hence of xi ). The correlation matrix then has 1’s along the diagonal and elements lying between -1 and 1. Clearly, cov(X) is symmetric in that (cov(X))ij = E(zi zj ) = (cov(X))ji A symmetric matrix Ω is said to be positive semi-definite if for all n-vectors v we have v T Ωv ≥ 0 and it is said to be positive definite if for all v 6= 0 we have v T Ωv > 0 1 2 CHAPTER 5. PORTFOLIO ANALYSIS It can be shown that a symmetric matrix is positive definite (positive semi-definite) if and only if all its eigenvalues are > 0 (≥ 0). The number of non-zero eigenvalues (counting multiplicity) is the same as the rank of the matrix. It is easily seen that the covariance matrix of a vector X is positive semi-definite. For v T cov(X)v = X cov(X)ij vi vj = ij = X E( vi zi vj zj ) = X X E( vi zi vj zj ) = X E(( vi zi )2 ) ≥ 0 X E(zi zj )vi vj ij ij i j i 5.2 Portfolio Returns We consider a portfolio of n assets with total asset values S1 , S2 , . . . , Sj , . . . , Sn , and total value S = S1 + S2 + · · · + Sj + · · · + Sn (Note that in this chapter we do NOT use Si for the asset price). The value of asset j at time i is Sj (i) i = 0, 1, . . . , T In this chapter we use the notation ∆S( i) = Sj (i) − S( i − 1). The return of asset j at time i, i = 1, . . . , T , is rj (i) = ∆Sj (i) Sj (i) − Sj (i − 1) = Sj (i − 1) Sj (i − 1) The return on the portfolio at time i is r(i) = ∆S(i) S(i − 1) = = = 1 (∆S1 (i) + · · · + ∆Sn (i)) S(i − 1) S1 (i − 1) ∆S1 (i) Sn (i − 1) ∆Sn (i) + ··· + S(i − 1) S1 (i − 1) S(i − 1) Sn (i − 1) x1 (i − 1)r1 (i) + · · · + xn (i − 1)rn (i) where xj (i − 1) is the proportion by value of asset j in the portfolio at time i − 1, and is allowed to be negative indicating a short position in this asset. We have n X j=1 n xj (i) = S(i) 1 X =1 Sj (i) = S(i) j=1 S(i) 5.2. PORTFOLIO RETURNS 3 In what follows, we will drop the dependence of xj (i − 1), rj (i) and Sj (i) on i, and we will write r = x1 r1 + · · · + xn rn where rj is the return at time i and xj is the proportion of asset j in the portfolio at time i − 1. Then n X Sj xj = , xj = 1 S j=1 Taking expectations, we have E(r) = n X xj E(rj ) j=1 Writing rj = E(rj ), r = E(r) this becomes r= n X xj rj j=1 This gives an expression for the expected return of the portfolio. To calculate the variance of the returns: n n X X E((r − E(r))2 ) = E(( xj rj − xj rj )2 ) = E(( j=1 n X j=1 xj (rj − rj ))2 ) j=1 = E(( n X n X xi (ri − ri ))( xj (rj − rj ))) i=1 = = n X j=1 xi xj E((ri − ri )(rj − rj )) i,j=1 n X xi xj cov(ri , rj ) i,j=1 Write σ 2 = variance of the portfolio return r σij = covariance of asset returns ri , rj . So σij is a symmetric matrix since cov(ri , rj ) = cov(rj , ri ). Hence n X σ2 = xi xj σij i,j=1 Using vector notation, let V = (σij ), x1 x = ... , xn r1 r = ... , rn r1 R = ... rn 4 Then CHAPTER 5. PORTFOLIO ANALYSIS σ 2 = xT Vx, r = E(r) = xT R and V is symmetric and positive semidefinite since σ 2 ≥ 0 for all x. By a slight abuse of terminology, we will refer to x as a portfolio. If x, y are two portfolios of the same assets, with returns xT r and yT r, then their covariance is, by a similar calculation to the above, cov(xT r, yT r) = xT Vy = yT Vx where the last equality follows from the fact that V is symmetric. The above figure illustrates the case n = 2. Two assets A and B with expected returns and covariance matrix Covariance √ Matrix√ Asset Returns 0.0025 ρ .0025 .01 10% √ √ ρ .0025 .01 0.01 4% are combined in a portfolio. The correlation of the returns is ρ. ρ is a convenient parameter to illustrate what the combinations look like. We plot σ vs E(r) for various portfolios (x1 , x2 ), x1 + x2 = 1 5.2. PORTFOLIO RETURNS 5 and for various correlations ρ. The figure uses ρ = 1, −1, 0.28. Note that ρ = ±1 lead to two straight lines joining on the r-axis. The curve joining A and B consists of 3 parts, one finite and joining A and B, and the other two infinite. The finite portion represents portfolios with long positions in both assets. The infinite portions represent long positions in one asset and short positions in the other. We illustrate the formulae above by giving them explicitly in this case. If x1 = w, x2 = 1 − w we have σ 2 = xT V x = w2 (0.0025)2 + 2w(1 − w)(0.0025)(0.01)ρ2 + (1 − w)2 (0.01)2 E(r) = w(0.1) + (1 − w)(0.04) = 0.04 + 0.06w For ρ = ±1 this simplifies. For example, for ρ = 1, we have σ 2 = (0.0025w + 0.01(1 − w))2 σ = ±(0.01 − 0.0075w) on substituting w = 1 0.06 (E(r) − 0.04) we see that (σ, E(r)) lie on two straight lines. 5.2.1 Two-Asset Portfolios in the Spreadsheet 5.2.2 Estimating E(r), σ and Covariance from Data We have dealt with this in Chapter 3. We can use GARCH for the variances and historical sample means and covariances for the other parameters. These are what we need to draw up the table that we must use. • Place the covariance matrix with a parameter for ρ in A2:A4, and put copies in A4:B5 and A6:A8. Link the parameters to cells A9, A12, A15 respectively. • Place the expected returns in D2:D3. • In D5:D35 place values for x1 running from -2 to 4 in steps of 0.2. In E5:E35 place the values of x2 so that x1 + x2 = 1. • In F5 calculate σ for the portfolio in that row using covariance matrix A2:B3, and in G5 calculate the return. Propagate downwards. • Make a copy of D5:G35 starting with D36, and make another copy starting with D67, using the other two covariance matrices that you have set up. • Chart the three sets of (σ, r) pairs. • Vary the 3 values of ρ, and watch the changes on the chart. • Set up spin boxes for the three values of ρ and watch the changes. • In particular, try the values 1,-1,0.28 for the three values of ρ. • Add headings and improve the appearance. 6 5.3 CHAPTER 5. PORTFOLIO ANALYSIS Optimizing Returns • We assume that the sdv σ of a portfolio is a measure of its risk. • We assume that each investor has an expected rate of return in mind, say r0 . • We assume that an investor will choose a portfolio of smallest risk which has expected return r0 . These assumptions and others implicit in the mathematical formulation are discussed in detail in books on portfolio theory, and are the subject of much controversy. We will not go into this aspect here. It is useful to plot (expected return) r on the vertical axis vs σ (sdv or volatility) on the horizontal axis. Then the optimization problem for our investor can be written as follows: Problem 1: 5.3. OPTIMIZING RETURNS 7 For fixed return r0 , minimize σ over all portfolios x, or equivalently, minimize σ 2 . σ 2 = xT Vx = min! x xT R = r0 xT 1 = 1 Pn where 1 is an n-vector all of whose entries are 1, so that xT 1 = j=1 xj . Note: There are many variations of this problem associated with different constraints on the variable x. For example, if short sales for asset j are not allowed, the constraint xj ≥ 0 should be added to the above formulation. Problem 2: We fix r0 on the r axis giving the point (0, r) . For fixed σ, we look at the points P (r) = (σ, r) and we consider the slope of the line joining (0, r0 ) on the r-axis to P (r). We then look for an r which maximizes the slope of the line. In this way we find the maximum return r for a fixed level of risk σ. r − r0 σ xT 1 xT (R − r0 1) √ = max! x xT Vx = 1 = Analytic Solution It can be shown if z is the vector z = V−1 (R − r1 1) then x= 1 zT 1 z is an absolute maximum or minimum of the ratio. We will show below that if V is invertible, then the latter is the unique critical point (zero of the gradient or first derivative) satisfying xT 1 = 1. That all critical points are maxima or minima follows from the convexity of the functions, but we will not go into this point. Let xT (R − r0 1) f (x) = √ , x 6= 0 xT V x We look for critical points of ln f , which will also be critical points of f , since 5 ln f = 5f , where 5f is the gradient of f : f ∂f 5f = ∂x1 .. . ∂f ∂xn 8 CHAPTER 5. PORTFOLIO ANALYSIS Also, note that 5aT x = 5xT a = a, 5xT Ax =2x where a is a constant column vector and A is a constant matrix. Then ln f (x) = ln(xT (R − r0 1)) − Hence 5 ln f (x) = 1 ln xT Vx 2 Vx (R − r0 1) − T − r0 1) x Vx xT (R Let λ(x) = xT (R − r0 1) xT Vx Then 5 ln f (x) = 0 ⇔ λ(x)Vx = R − r0 1 Using the assumption that V is invertible, let z = V−1 (R − r0 1) so that Vz = R − r0 1 Then by directly substituting for x, and using the fact that V and (hence) V−1 are symmetric, we see that for α 6= 0 we have λ(z) = 1, λ(αz) = 1 α Hence for α 6= 0 λ(αz)Vαz = λ(z)Vz = R − r0 1 which implies that for all α 6= 0, αz is a critical point (and in particular, z is a critical point). If z 6= 0 define the vector x by x= z zT 1 so that xT 1 = 1 We have for α > 0, f (αy) = f (y) Hence if z is an absolute maximum of f then x = zTz 1 is also an absolute maximum (if the denominator is positive) of f , satisfying the constraint. If the denominator is negative then it is a minimum. A similar analysis holds for the case of an absolute minimum. Thus to find the critical points (which will be either maxima or minima by convexity) we must find z = V −1 (R − r0 1 5.4. PROPERTIES OF THE SOLUTION SET OF PROBLEM 1 OR 2 and then divide it by zT 1. Example For two stocks: µ V = σ12 ρσ1 σ2 ρσ1 σ2 σ22 9 ¶ ¶ σ1−2 −ρσ1−1 σ2−1 −ρσ1−1 σ2−1 σ2−2 µ ¶ E(r1 ) − rf −1 z=V E(r2 ) − rf µ ¶ z 1 A1 σ22 − A2 ρσ1 σ2 x= T = A2 σ12 − A1 ρσ1 σ2 z 1 A1 σ22 + A2 σ12 − (A1 + A2 )ρσ1 σ2 V −1 = 1 1 − ρ2 µ A1 = E(r1 ) − rf , A2 = E(r2 ) − rf . 5.4 Properties of the Solution Set of Problem 1 or 2 The set of points (σ, r) corresponding to solutions x of Problem 1 and Problem 2 for all real values of r0 is called the Envelope. A portfolio x with values (σ, r) lying on the envelope is called an Envelope Portfolio. Envelope portfolios do not contain the risk-free asset. • We may find points on the envelope by finding z by the above formula and dividing it by zT 1, for various values of r0 . • For values of r0 whose tangent to the envelope intersects the envelope close to the vertex of the hyperbola, we expect the calculation to become more unstable, as the tangent is nearly vertical and has large slope. There are also problems with this method when r0 is close to the value of r at the vertex. • A set M is convex if for all 0 ≤ λ ≤ 1 and all x, y ∈ M we have λx + (1 − λ)y ∈ M , that is, the line segment joining any two points of the set also lies in the set. The set of all portfolios is a convex set. • If there is no risk-free asset in the portfolio (that is, one with σ(x) = 0), then the envelope is a hyperbola, with axis horizontal, lying in the half-plane σ ≥ 0. If there is a risk-free asset with return r0 then the envelope is a cone consisting of two straight lines with vertex (0, r0 ) and lying in the right half-plane. We will analyze this further below. • If σ0 is the point on the hyperbola with minimum σ (that is, the vertex), then the half of the hyperbola lying above the vertex is called the Efficient Frontier. • The set of all envelope portfolios and the set of all frontier portfolios are convex sets. The set of all (σ, r) corresponding to these portfolios is not convex (the points are parts of a hyperbola or two straight lines). 10 CHAPTER 5. PORTFOLIO ANALYSIS • Given two distinct portfolios on the envelpe, the set of all convex combinations of the two portfolios is the set of all portfolios on the envelope. (A convex combination of x, y is a point of the form λx + (1 − λ)y for some real λ.) The portfolios on the envelope form a straight line in portfolio space. • If we settle on a maximum value of risk we are willing to bear, σ1 say, then the portfolio corresponding to the point (σ1 , r1 ) on the efficient frontier is the one that an investor would select under the above assumptions. • ALL portfolios correspond to values of (σ, r) which lie on or to the right of the envelope - this is called the feasible set. This is a consequence of the fact that σ is a minimum over all possible portfolios with the same return, and hence all possible portfolios have (σ, r) lying to the right of the envelope point. 5.5 Portfolios with One Risk-Free Asset We assume that there is a risk-free asset amongst the assets in the portfolio, with return rf . Since the sdv is 0, the point (0, rf ) corresponds to an optimal portfolio. The remaining assets generate an hyperbola corresponding to the envelope of these 5.5. PORTFOLIOS WITH ONE RISK-FREE ASSET 11 assets. By convexity, the tangent lines from (0, rf ) to the hyperbola must correspond to portfolios, and must lie on the envelope, since if there were points on the envelope corresponding to portfolios above or below the tangents, then there would have to be portfolio points of the remaining assets outside the hyperbola. Hence • The envelope is a cone whose boundary is two straight lines emanating from (0, rf ) and tangent to the hyperbola forming the envelope of the non-risk-free portfolios. The upper tangent intersects the hyperbola at a point M = (σM , rM ) corresponding to a portfolio xM called the Market Portfolio. • The line through M and (0, rf ) has the equation µ ¶ E(rM ) − rf E(r) = rf + σ σM as can be checked by substitution. It is called the Capital Market Line, CML. We can write this, for each portfolio x, as E(rx ) − rf βx = βx (E(rM ) − rf ) = cov(xT r, xT M r) 2 σM Assume that this model is applied to the whole market. The market portfolio is then 12 CHAPTER 5. PORTFOLIO ANALYSIS that of the whole market. The above equation states that (i) There exist constants α, γ independent of the portfolio x such that E(rx ) = α + γβx and hence (βx , E(rx )) lie on a straight line in (β, r) space. (ii) α = rf and γ = E(rM ) − rf for some frontier portfolio xM . Given a set of points βx , E(rx ), we can estimate α, γ by least squares regression. We can write the capital market line equation as: µ ¶µ ¶ E(rM ) − rf cov(xT r, xT M r) C = E(rx ) − rf = = AB σM σM where C is the excess return over the risk-free asset, A is the excess return of the market portfolio per unit of risk, and B is the risk measure of x relative to the market portfolio xM . • Once we know α, γ, βx , we can use the CML to determine E(rx ) and thus value the asset. We have remarked on the determination of α, γ. βx can be determined from historical data. (See the chapter on Statistical Analysis of Financial Asset Data). 5.5.1 CAPM - The Capital Asset Pricing Model This model supposes that in market equilibrium, all investors follow the conclusion that they are best advised to invest in the market portfolio and will do this - see the assumption below. Under this assumption, we can determine the Market Portfolio of the whole market. • Composition of the Market Portfolio xM We show that the jth component of xM is xM j = Sj S where S is the total market value of all assets and Sj is the total value of the jth asset in the market. (The market portfolio holds each asset in proportion of its total value to the total value of the market.) Assumption We assume that in equilibrium, every investor holds the Market Portfolio and the risk-free asset in some proportion. If this is not the case at any time, the situation will move towards equilibrium. (We have shown that this should be optimal in the model we are studying.) We can then deduce the composition of the Market portfolio. Let S q be the total holdings of person q and Sjq the holdings of asset j by person q. Then X X Sq = Sj S = q Sj = Sjq = X j Sjq q xM j S q 5.5. PORTFOLIOS WITH ONE RISK-FREE ASSET 13 The last equality follows from the fact that the only holding of person q of asset j is from the market portfolio, as indicated above, and must be in the proportion of the market portfolio. So X q X Sj = Sj = xM j S q = xM j S q q Hence xM j = Sj S as required. Actual Portfolios Approximating the Market Portfolios In the US, S&P500 is usually taken as a surrogate for the market portfolio, since it contains 500 stocks in proportion to their market values. It is, however seldom a frontier portfolio. Testing CAPM • Test 1: Calculate xM in a market with risk-free rate rf and also r = xT M R and σ(xM ). Check whether the tangent frontier portfolio (see below for method of calculation) with endpoint (0, rf ) has the correct proportional allocation of assets. • Test 2: For a large collection of values of (βx , E(rx )) perform a regression to see if there exist constants α, γ such that E(rx ) = α + γβx such that βx is significantly different from 0. • Tests for CAPM are not usually positive. To Find the CML The CML passes through (0, rf ). We need only find the slope. We use the formulation of Problem 2. Solve, using Solver, xT r − rf √ = xT Vx xT 1 = max! x 1 Alternatively, find z such that z̃ = z = V−1 (r − rf 1) 1 z̃ z̃T 1 Alternative Method - Finding the Envelope by Using Convexity 14 CHAPTER 5. PORTFOLIO ANALYSIS The set of portfolios forming the envelope is convex in the space of portfolios. (The envelope is NOT convex in (σ, r) space.) In fact, it is a straight line in portfolio space, as we have already remarked. Hence to find the envelope, we can proceed as follows: • Find any two envelope portfolios x1 , x2 . • The envelope is the set {λx1 + (1 − λ)x2 | λ ∈ R} 5.5.2 The Security Market Line Black has shown that the type of linear relation that holds between the E(r), E(rM ), rf where r is the return on a frontier portfolio also holds when r is the return on a single asset. Hence if rj is the return on asset j, we have E(rj ) − rf = βj (E(rM ) − rf ) or E(rj ) = α + γβj where α, γ are constants independent of j. In order to find these two constants we must use the values of a large number of E(rj ), βj pairs and then estimate the constants by, for example, least squares estimation. The line is called the Security Market Line (SML). 5.6 Finding the Efficient Frontier in the Spreadsheet The following is the covariance matrix of four stocks, and the expected return of each. We construct in the spreadsheet the Envelope and efficient frontier. Covariance Matrix 0.1 0.01 0.03 0.05 0.01 0.3 0.06 -0.04 0.03 0.06 0.4 0.02 0.05 -0.04 0.02 0.5 5.6.1 Exp Return 0.06 0.08 0.1 0.15 Using Method 1 - Solving Problem 1 • In what follows, columns should be given appropriate headings. • Place the covariance matrix in A4:D7. Call this matrix V . Place the returns in F4:F7. Call this vector r. • In G4:G35 place values of r0 starting from 0 and going up in steps of 0.005 ( 12 %). For each of these values of r0 we will calculate the value of σ which puts (r0 , σ) on the envelope. • H4:K4 will hold values of the portfolio weights x = (x1 , x2 , x3 , x4 ). Initially, set the values to 0.25 each, and propagate this to row 35. 5.6. FINDING THE EFFICIENT FRONTIER IN THE SPREADSHEET 15 • In L4 place xV xT (x is a row vector here). (Use an array formula). Propagate this to row 35. Call this column σ 2 . • In M4 place σ, and propagate to row 35. • In N4 place the expected return on the portfolio x, that is xr (x is a row vector, r is a column vector. Propagate. • In O4 place the sum of the xi in that row. Propagate. • Let 1 denote the 4-vector each component of which is 1. In P4 place xT (R − r0 1), where r0 is the value of r0 for this row. Propagate. P4 • Now use solver to minimize σ 2 (L4) subject to constraints i=1 xi (O4), xT (R − r0 1) = 0 (P4) by changing the value of x (H4,I4,J4.K4). Do this for each row from 4 to 35. In the spreadsheet, we cannot propagate the use of Solver. We will be able to automate the process using VBA. • Chart σ (X-axis) vs E(r) (Y-axis). This charts the envelope and the efficient frontier is the top half of the envelope. 16 CHAPTER 5. PORTFOLIO ANALYSIS 5.6.2 Automating the Use of Solver Using VBA Inserting the array formula in column L row i and calculating the optimal value in column L row i via Solver can be handled in two ways. We give an example of both, one for the insertion and one for using Solver. Note that & is the string concatenation operator. • Write a Sub to do this. a = CStr(i) b = "H" & a & ":K" & a frmla = "=MMult(" & b & ",MMult($A$4:$D$7,Transpose(" & b & ")))" Range("L" & a).FormulaArray = frmla SolverReset SolverAdd CellRef:=Range("O1").Cells(i, 1), Relation:=2, FormulaText:=0 SolverAdd CellRef:=Range("P1").Cells(i, 1), Relation:=2, FormulaText:=0 SolverSolve UserFinish:=True Note that Cstr(i) changes the values contained in variable i, assumed to be an integer, into a string. The code will in fact work with i in place of a since VBA does an automatic conversion, but it is not clear when it does this, and it is better not to rely on it. No Short Sales If no short sales are allowed for asset i then the constraint xi ≥ 0 must be included. • Write a VBA routine to do the above example for the case where no asset can be sold short. Compare the efficient frontier for the two cases. 5.6.3 Using Method 2 - Solving Problem 2 We describe the use of Method 2 in the spreadsheet. We add the calculations below those of Method 1. • Below the Method 1 rows, repeat the headings of Method 1. • Insert a range of values in the r0 column (you could use the same ones as for Method 1). • Add a column for β to the right. • Add 4 columns for R − r0 1 further to the right. • Add 4 columns further to the right to hold A−1 (R − r0 1). 5.6. FINDING THE EFFICIENT FRONTIER IN THE SPREADSHEET 17 • insert formulae to calculate R − r0 1 and A−1 (R − r0 1) • The formula for β is the ratio of two cell values xT (R − r0 1) σ • The formulae for σ 2 and σ are the same as for Method 1, as is the formula for E(r). • The formulae for the portfolio weights are the 4 elements of A−1 (R − r0 1) divided by their sum. • Chart σ vs E(r). Note that the values around the vertex of the hyperbola are problematic. • In order to calculate various values of β for different r0 add a separate row which is a copy of one of the Method 2 rows. • On the same chart, plot the straight line with slope β and r-intercept r1 for some chosen r1 . The line is r = r0 + βσ Note that it is tangent to the hyperbola. Try changing r1 . Plot the intersection point of the tangent and the hyperbola. • Write VBA routines to automate as much of Method 2 as you can.