Portfolio Optimization via Efficient Frontier ith the IMSL Numerical Libraries A White Paper by Rogue Wave Softare. March 28 Rogue Wave Softare 55 Flatiron Parkay, Suite 2 Boulder, CO 83, USA.rougeave.com
Portfolio Optimization via Efficient Frontier ith the IMSL Numerical Libraries by Rogue Wave Softare 22 by Rogue Wave Softare. All Rights Reserved Printed in the United States of America Publishing History: May - 22 March 28 Trademark Information The Rogue Wave Softare name and logo, SourcePro, Stingray, HostAccess, IMSL and PV-WAVE are registered trademarks of Rogue Wave Softare, Inc. or its subsidiaries in the US and other countries. JMSL, JWAVE, TS-WAVE, PyIMSL and Knoledge in Motion are trademarks of Rogue Wave Softare, Inc. or its subsidiaries. All other company, product or brand names are the property of their respective oners. IMPORTANT NOTICE: The information contained in this document is subject to change ithout notice. Rogue Wave Softare, Inc. makes no arranty of any kind ith regards to this material, including, but not limited to, the implied arranties of merchantability and fitness for a particular purpose. Rogue Wave Softare, Inc. shall not be liable for errors contained herein or for incidental, consequential, or other indirect damages in connection ith the furnishing, performance, or use of this material.
TABLE OF CONTENTS Introduction... 4 Inputs to the Problem... 4 Constraints on the Solution... 5 Computing the Efficient Frontier... 7 Analysis of the Efficient Frontier Curve... 8 Finding the Optimal Portfolio... 9 For More Information... 2
Introduction The ultimate goal of portfolio optimization is to build a portfolio ith the proper proportion of its components that ill balance minimum risk and maximum return. One textbook method to that end involves the computation of the efficient frontier curve, hich enumerates a set of portfolios that ill generate some given rate of return hile minimizing risk to the investor. Once that curve is computed, an optimal portfolio can be selected from the set through a graphical method that involves the risk-free rate of return. This document ill travel through the discovery of that ideal portfolio by revieing the necessary inputs, constraints on the solution, the computation and analysis of the efficient frontier, and ho to select the optimal solution from the set of possible solutions. Several IMSL functions are referred to in the text. The function is named generically in the text, and the actual function names are provided parenthetically for the IMSL Fortran, CNL, and JMSL libraries respectively. Some details of the use of some of the functions may be included in the text; for complete usage information, please consult the appropriate IMSL documentation. The term security ill be used in reference to the items that make up the portfolio throughout this document; hoever, the contents of the portfolio may ell be a combination of stocks, bonds, indices or any investment. Further, the example in this paper is built on just five securities. The analysis technique and algorithms scale to problems of much larger scale ith hundreds or thousands of securities. Inputs to the Problem The required data for input to the main optimization routine is the variance-covariance matrix for the securities involved, the individual expected fractional returns, and the risk-free interest rate. The first to items may not be explicitly knon. Hoever, they can be computed from a time history of each security. The variance-covariance matrix contains the variance for each security as ell as the covariance beteen each pair of securities. This information is important because the variance,, is a measure of the risk associated ith a given security. Further, it is important to kno ho ell the securities are correlated ith each other. This matrix is symmetric ( 2 = 2 ) so only the upper triangular part needs to be stored and looks like: 2 3 4 5 22 23 24 25 33 34 35 44 45 55 Occasionally, one ill have this information already, but the IMSL Covariance function (CORVC, covariances, com.imsl.stat.covariances) can compute the matrix from the input time series. 4.rogueave.com
Next, the expected returns must be provided. These values are often based on knoledge of the security or its market, but if such knoledge is lacking then they can be computed using any of several methods such as a linear regression or a geometric mean of the historical returns. The final required input is the risk-free interest rate. This is the rate of return an investor could realize assuming zero risk, like the Fed Funds rate or the Treasury Bill rate. The computed efficient frontier is a set of optimized portfolios, each of hich minimizes risk (volatility) for a given rate of return. The risk-free rate of return is used to select a single optimal portfolio from this set of optimized portfolios that has the greatest return for a lo amount of risk. Constraints on the Solution The above inputs are the ra data necessary to compute a solution. To solve the optimization problem, a set of constraints is also required. The default constraints on the contents of the portfolio ould be that each security can make up from to % of the portfolio and that the sum of all the security contributions must be %. An investor may have other ideas that constrain the eights of some or all of the securities in the portfolio. For example, in the interest of diversification, one may require that no security make up more than 25% of the portfolio. Alternatively, there may be a favorite security among the group that deserves a minimum eight of 2%. There may also be a security that is not in favor that should be limited to a maximum eight of 8%. And there remains the transparent constraint on the solution that the total of the eights must be % to build a complete portfolio. For an example case of five securities ith the above constraints, the bounds on the eights may look like the folloing matrix:..2.....25.25.25.8.25. The left side holds the loer bounds; the right, the upper. The second security is the favorite, and the fourth is the one to limit. The final ro is for the constraint that the total of all the eights must be %. The coefficient matrix for the constraints goes along ith the bounds discussed above. For the general example ith five securities, this coefficient matrix looks like: 5.rogueave.com
6.rogueave.com As before, each of the first five ros is for each security in the portfolio and the final ro is for the additional constraint that all the eights must sum to %. One can make this more complex if there are constraints like the sum of the first three securities must be less than 5% here there ould be an additional ro in the coefficient matrix (,,,,) and an additional ro in the constraints on the eights of (,.5). It may be easier to understand these constraints if they are ritten out algebraically. For the above example for five securities, the eights are through 5 in the folloing set of equations:....5.8.5..5..2..5 5 4 3 2 5 4 3 2 + + + +
Computing the Efficient Frontier With the above required inputs and the bounds on the solution set, the efficient frontier can no be computed. This step is made up of several smaller steps. First, minimum and maximum possible returns must be computed. Then for all the returns beteen the extremes, the portfolio that minimizes the risk is computed. The efficient frontier is this set of portfolios for given values of risk and return. The minimum and maximum possible returns are computed using the IMSL Linear Programming function (DLPRS, lin_prog, com.imsl.math.linearprogramming). The inputs into this function are the constraints discussed above and the expected returns for each investment. Note that the constraints here are both upper and loer bounds. As such, they must be input into the function as separate one-dimensional arrays, ith the loer bound as a parameter and the upper as an optional argument. The optimal value returned from the linear programming function is the minimum possible return that can be realized given this set of securities and the bounds on their eights in the portfolio. To find the maximum possible return, the same function and input matrices are used except that the negative of the expected returns is used. Literally, the negative return ill be minimized no, yielding the maximum possible return. With the minimum and maximum possible returns knon, the extents of possible values on the risk-return plot have been limited vertically. The next step is to find the portfolio that minimizes risk for each one of a hundred or so return values evenly distributed beteen the minimum and maximum possible returns. Each portfolio is computed using the IMSL Quadratic Programming function (QPROG, quadratic_prg, com.imsl.math.quadraticprogramming). The solution to this function is a vector of eights for the securities that build the portfolio ith the minimum amount of risk for the given expected return. Also of interest is the overall value of risk for the portfolio, hich is related to the optimal object function found. Note that this is an output keyord for the CNL function, but not for the IMSL Fortran or JMSL routines. It can be computed easily, hoever, since it is just: x T Qx. Here x is the solution (the vector of eights), Q is the variance-covariance matrix. At this point, for each possible return, the combination of securities that minimizes risk is knon. Graphically, one plots the risk and return values ith risk on the x axis and return on the y axis. For graphical purists, this ill appear to be the reverse of hat ould normally be plotted since the resulting curve appears a double-valued function. That is, for some value of risk (on the x axis), to values of return (on the y axis) may be observed. Figure shos a typical efficient frontier graph. 7.rogueave.com
Figure. An efficient frontier. Analysis of the Efficient Frontier Curve This curve forms the basis of portfolio optimization and should be ell understood. Minimum and maximum possible returns ere the first to points solved for. Determined by the linear programming function calls, these points indicate the extents of realizable return for the portfolio contents and eight constraints. It is impossible to achieve a higher or loer return rate than this; that is, there is no portfolio that can give returns outside these bounds. See Figure 2. On the other axis, the quadratic programming function has found the minimum risk for values of return beteen the extremes. There are many portfolios that can result in a larger amount of risk for a given return, and these portfolios ould be points to the right of the efficient frontier curve. Hoever, it is impossible to find a portfolio that exposes less risk for any given value of return than those portfolios that lie on this line. Thus the achievable risk-return space is the area of the graph beteen the vertical extents of the curve and to the right. It is not possible, again given the content selection and constraints on the proportions, to build a portfolio that returns risk and return values outside of this region. 8.rogueave.com
Finding the Optimal Portfolio Figure 2. The achievable risk-return space. Examination of the portfolios that make up the efficient frontier curve ill help in understanding the concept of an optimal portfolio out of this set of portfolios that minimize risk. This examination starts ith the bottommost point on the curve, here the portfolio represents the minimum return achievable, and it has some value of risk associated ith it. As one moves along the curve, the rate of return increases and the rate of risk decreases, indicating better portfolio combinations ith regards to higher return for less risk. Eventually, the point of minimum risk is reached for some given return. If one ere interested in only minimizing risk, then this is the ideal portfolio combination. Hoever, notice that there are points on the curve indicating portfolios that yield a higher return. Moving along the curve further upard, the level of risk increases along ith the rate of return. At some point, the portfolios, hile achieving higher rates of return, are entering into a region of unacceptably high amounts of risk for those returns. The question becomes here along this portion of the curve is the ideal spot? The capital market line is a line defined such that the intercept is the risk-free rate of return and the slope is the Sharpe ratio. In terms of the Capital Asset Pricing Model, the slope is the beta of the portfolio, β. The optimal portfolio balancing the 9.rogueave.com
maximum return for the loest amount of risk can be found by maximizing the slope of the line. To find this optimal portfolio, the risk-free rate of return is plotted on the same graph as the efficient frontier. Since this point is risk-free by definition, it ill appear here risk equals zero, or somehere on the y axis. The maximum slope occurs here the line is tangent to the efficient frontier. Continuing the march along the curve moving from the point of minimum risk, the amount of risk sloly increases as the rate of return increases. After the optimal portfolio is reached, notice that the curvature of the efficient frontier is such that assuming additional risk does not achieve a proportional return. Figure 3 shos the efficient frontier (solid line) along ith the risk-free rate of return (square) and the capital market line (dashed line). The intersection of the efficient frontier curve ith the tangent line is the location in risk-return space of the optimal portfolio. One ould then return to the solution provided by the quadratic programming function to find hat the associated eights are for this value of return. This eight vector is the anser to the overall optimization problem: the ratio of each security in the portfolio. The last extreme point on the curve is the portfolio that gives the maximum return. If the interest as just in maximizing the possible return, this is the portfolio of choice. Hoever, an investor ould assume a larger amount of risk to achieve this return. The combination of maximizing return and minimizing risk yields the optimal portfolio at the tangent point found above..rogueave.com
Figure 3. The optimal portfolio..rogueave.com
For More Information The ultimate goal of portfolio optimization is to build a portfolio ith the proper proportion of its components that ill balance minimum risk and maximum return. The efficient frontier curve, hich enumerates a set of portfolios, ill generate some given rate of return hile minimizing risk to the investor. This hite paper outlined the necessary inputs, constraints on the solution, the computation and analysis of the efficient frontier, and ho to select the optimal solution from the set of possible solutions. Several IMSL Library functions ere referred to in the text. The IMSL Numerical Libraries have been the cornerstone of predictive analytics and high-performance computing applications in science, technical and business environments for more than three decades. Regarded as the most sophisticated and reliable technology available, the IMSL Libraries provide users ith the softare and technical expertise needed to develop and execute scalable numerical analysis applications. To vie a brief demonstration of the JMSL Numerical Library being used to solve a portfolio optimization problem similar to the one described in this hite paper, donload an evaluation version of JMSL and vie the Demo Gallery provided. For general information on the IMSL Numerical Libraries for Fortran, C/C++,.NET or Java, visit http://.rogueave.com/products/imsl-numerical-libraries.aspx. About Rogue Wave Softare Rogue Wave Softare, Inc. is the largest independent provider of cross-platform softare development tools and embedded components for the next generation of HPC applications. Rogue Wave marries High Performance Computing ith High Productivity Computing to enable developers to harness the poer of parallel applications and multicore computing. Rogue Wave products reduce the complexity of prototyping, developing, debugging, and optimizing multiprocessor and data-intensive applications. Rogue Wave customers are industry leaders in the Global 2, ISVs, OEMs, government laboratories and research institutions that leverage computationally-complex and data-intensive applications to enable innovation and outperform competitors. For more information, visit http://.rogueave.com/. 2.rogueave.com