Developing Portfolio Using the Dow Jones Industrial Average as benchmark, we will implement a portfolio Optimization M。des二m steps and to construct realistic, optimal BY BOB TAYLOR Estimating Asset Return moments Portfolio optimization was first developed in the 1950s, but The mean and covariance of asset returns are a number of practical and theoretical problems have limited Estimating these moments involves three its use by investment managers. For example, it is often tasks: acquiring data, dealing with missing data, and setting up a suitable benchmark. difficult to obtain sufficient his lity historical data for Acquiring Data orough analysis. In addition, the efficient frontier where We use MATLAB and Datafeed Toolbox to obtain return data for stocks and mar- optimal portfolios lie tends to shift over time, quickly making ket indexes. In our example we acquire these portfolios suboptimal onthly total return data on 44 blue-chip stocks and the dow Jones Industrial Aver- Modern data analysis tools, such as MATLABe and age (D)JIA) from Yahoo! Finance Financial Toolbox, can overcome these challeng Dealing with Missing Data Fortunately, historical financial data is often messy and incomplete. We use the Financial Toolbox function ecmmmle to deal with data Mean-variarce Eficient Frontier and Random Portfolios sets that have missing values(represented as NaNs in MATLAB). This function uses all available data to obtain best estimates for asset return moments in the presence of NaNs-a ce alternative to the usual ad hoc approaches. We use a market index as our benchmark, 3013 since market return is the main driver of asset returns in capital asset pricing. By removing market returns from the data an focus on non-market returns and risks n our example we subtract the return of the DJIA from individual asset returns Using Classic Mean-Variance Analysis Risk (Standard Deviation) ariance analysis, expected return is ns)for rufolo. We igure 1. The efficient frontier. ate random combinations of portfolio weights produce a scatterplot of the expectedreturm igure 1)
Developing Portfolio Optimization Models Portfolio optimization was first developed in the 1950s, but a number of practical and theoretical problems have limited its use by investment managers. For example, it is often difficult to obtain sufficient high-quality historical data for thorough analysis. In addition, the efficient frontier where optimal portfolios lie tends to shift over time, quickly making these portfolios suboptimal. Modern data analysis tools, such as MATLAB® and Financial Toolbox, can overcome these challenges. Figure 1. The efficient frontier. By Bob Taylor Using the Dow Jones Industrial Average as a benchmark, we will implement a portfolio optimization methodology based on capital asset pricing and mean-variance analysis. Our goals are to use consistent, repeatable steps and to construct realistic, optimal portfolios that are stable over time. Estimating Asset Return Moments The mean and covariance of asset returns are primary inputs for portfolio optimization. Estimating these moments involves three tasks: acquiring data, dealing with missing data, and setting up a suitable benchmark. Acquiring Data We use MATLAB and Datafeed Toolbox to obtain return data for stocks and market indexes. In our example we acquire monthly total return data on 44 blue-chip stocks and the Dow Jones Industrial Average (DJIA) from Yahoo! Finance. Dealing with Missing Data Unfortunately, historical financial data is often messy and incomplete. We use the Financial Toolbox function ecmnmle to deal with data sets that have missing values (represented as NaNs in MATLAB). This function uses all available data to obtain best estimates for asset return moments in the presence of NaNs—a nice alternative to the usual ad hoc approaches. Setting up a Benchmark We use a market index as our benchmark, since market return is the main driver of asset returns in capital asset pricing. By removing market returns from the data we can focus on non-market returns and risks. In our example we subtract the return of the DJIA from individual asset returns. Using Classic Mean-Variance Analysis In mean-variance analysis, expected return is plotted against risk (the standard deviation of asset returns) for a given portfolio. We generate random combinations of portfolio weights to produce a scatter plot of the expected return and risk for each portfolio (Figure 1)
Each red dot represents the mean and return or risk and with consistently positive standard deviation of a portfolio. The blue expected returns relative to the market. line is the efficient frontier. portfolios or the efficient frontier have maximum re Backtesting turn for a given level of risk or, alterna- Now that we have identified a set of portfolios level of that are both efficient and stable, we can per eturn. Clearly, a rational investor will se- form an ex post analysis, examining turnover, lect a portfolio on the efficient frontier. drawdown, and realized average return to see The portopt function in Financial Tool how these portfolios actually performed. box lets us determine directly which Turnover portfolios of assets lie along the efficient Turnover refers to the change in portfolio frontier given the means and covariances holdings over time due to trading A port- of individual asset returns folio with annual turnover of 25% will re- Finding a Stable Region place a quarter of its assets over a one-year Figure 3. Average furnover for portolio sequences in the Because theefficient frontiershifts over time period. Since trading is costly, low turnover stable region is around 25% a once-efficient portfolio may be not be is a desirable feature of a portfolio strategy the efficient frontier in subsequent time pe- Figure 3 shows the annual turnover for the riods. In addition, it is not clear which port- portfolio sequences on our efficient fron folio to select on the efficient frontier tiers, with the blue line re. One solution is to study the time evolution of sults of the analysis after removing market efficient frontiers and identify a sequence of returns. Note that in the stable region, with portfolios that remain relatively stable from the first eight portfolio sequences, the an- I one efficient frontier to the next. We can use nual turnover remains at 259 IATLAB to visualize this stable region. Drawdown Figure 2 shows efficient frontiers plotted as a function of time. matlab has calculated Evaluating the maximum drawdown of a efficient frontiers with 40 portfolios on each por portfolio is a good way to measure ex post risk maximum drawdown refers to the amount a frontier at one-month intervals and plotted the results. Figure 2 underscores the value portfolio declines in value relative to its peak of taking the market out of the data: We can value. It represents the worst possible per mance over any time period. Figure 4. Drawdown in the stable region is the same identify sequences of portfolios-those in the deep blue region-with little variation of In Figure 4, the green line represents the maximum drawdown of the DJIa over our back-test period-roughly 20%. The flat part of the blue One of the simplest performance measure- line represents the maximum ments is to determine a portfolios average drawdown for the portfolio mean and standard deviation of returns. sequences through the stable We have already determined that the port region and closely mirrors the folio sequences in the stable region have maximum drawdown of the reasonable levels of risk compared to the DJIA. Since our goal is to as- benchmark. But do those same portfolios semble portfolios with risk and deliver superior returns? return characteristics similar We plot the average of ex post returns versus the Dow Jones Average, risk of a portfolio or index In Figure 5,the this is a good result-it shows red star represents the return and risk of the that the risk of these portfolio DJIA benchmark over our backtest period. Each blue circle corresponds to a portfolio Figure 2. Efficient frontiers at one-month intervals with marker retums removed our benchmark. quence. The circles closest to ReprintedfromTheMathworksNews¬esIOctober2006iwww.mathworks.cor
Reprinted from T heMathWorksNews&Notes | October 2006 | www.mathworks.com Each red dot represents the mean and standard deviation of a portfolio. The blue line is the efficient frontier. Portfolios on the efficient frontier have maximum return for a given level of risk or, alternatively, minimum risk for a given level of return. Clearly, a rational investor will select a portfolio on the efficient frontier. The portopt function in Financial Toolbox lets us determine directly which portfolios of assets lie along the efficient frontier given the means and covariances of individual asset returns. Finding a Stable Region Because the efficient frontier shifts over time, a once-efficient portfolio may be not be on the efficient frontier in subsequent time periods. In addition, it is not clear which portfolio to select on the efficient frontier. One solution is to study the time evolution of efficient frontiers and identify a sequence of portfolios that remain relatively stable from one efficient frontier to the next. We can use MATLAB to visualize this stable region. Figure 2 shows efficient frontiers plotted as a function of time. MATLAB has calculated efficient frontiers with 40 portfolios on each frontier at one-month intervals and plotted the results. Figure 2 underscores the value of taking the market out of the data: We can identify sequences of portfolios—those in the deep blue region—with little variation of return or risk and with consistently positive expected returns relative to the market. Backtesting Now that we have identified a set of portfolios that are both efficient and stable, we can perform an ex post analysis, examining turnover, drawdown, and realized average return to see how these portfolios actually performed. Turnover Turnover refers to the change in portfolio holdings over time due to trading. A portfolio with annual turnover of 25% will replace a quarter of its assets over a one-year period. Since trading is costly, low turnover is a desirable feature of a portfolio strategy. Figure 3 shows the annual turnover for the portfolio sequences on our efficient frontiers, with the blue line representing the results of the analysis after removing market returns. Note that in the stable region, with the first eight portfolio sequences, the annual turnover remains at 25% or less. Drawdown Evaluating the maximum drawdown of a portfolio is a good way to measure ex post risk. Maximum drawdown refers to the amount a portfolio declines in value relative to its peak value. It represents the worst possible performance over any time period. In Figure 4, the green line represents the maximum drawdown of the DJIA over our back-test period—roughly 20%. The flat part of the blue line represents the maximum drawdown for the portfolio sequences through the stable region and closely mirrors the maximum drawdown of the DJIA. Since our goal is to assemble portfolios with risk and return characteristics similar to the Dow Jones Average, this is a good result—it shows that the risk of these portfolio sequences is comparable to our benchmark. Figure 2. Efficient frontiers at one-month intervals with market returns removed. Figure 3. Average turnover for portfolio sequences in the stable region is around 25%. Figure 4. Drawdown in the stable region is the same as the DJIA. Average Return One of the simplest performance measurements is to determine a portfolio’s average mean and standard deviation of returns. We have already determined that the portfolio sequences in the stable region have reasonable levels of risk compared to the benchmark. But do those same portfolios deliver superior returns? We plot the average of ex post returns versus risk of a portfolio or index. In Figure 5, the red star represents the return and risk of the DJIA benchmark over our backtest period. Each blue circle corresponds to a portfolio sequence. The circles closest to
Next Steps ts to a P。roi。。 ptimization mate asset return moments formoptimizedGlossary portfolios, visualize concepts, and backtest sults, MATLAB provides a platform that Basis Point. A measure of return.One facilitates financial analysis basis point= 1/100%. The approach described here is a good starting Capital Asset Pricing Model (CAPM) point for a portolio optimization model An A model in which the return for any institutional investor using this model would security or portfolio of securities equa probably want to incorporate transaction costs the riskless rate plus a risk premium and trading constraints into the model Never- that is proportional to the excess mar Figure 5. Annual retums paled against risk for porto average 150 basis points with low turnover is riskless rate). an encouraging first step. 44 the star are portfolio sequences in the stable Efficient frontier. The combination of all region-those with the lowest risk and the References efficient portfolios( those that deliver highest annualized returns. In fact, some the highest possible return for a given Haugen, Robert and Nardin Baker, level of risk) portfolios outperformed the DJIA by about Dedicated Stock portfolios 150 basis points with comparable risk and Journal of portfolio Manageme Ex ante analysis. An analysis per- Summer 1990, pp 17-22. formed before any action is taken. Finally, we evaluate performance relative to the djia by plotting the net cumulative value of a dollar investment in the port The Efficient Market Inefficiency of Capitalization-Weighted Stock formed after action is taken and results folio sequences versus the DJIA. Over the have been realized. An historical ex backtest period, the portfolio sequences Portfolios, Journal of portfolio Management, Spring 1991, Pp 35-40 st analysis of investment perfor along the stable region consistently outper mance is called a backtest formed the benchmark (represented by the blue plane in Figure 6). Essentially, only the Markowitz, Harry, Portfolio Selection: Maximum drawdown. The maximum sequences in the stable region were above decline in total equity from peak the "water level" of the DJLA John wiley Sons, Inc, 1959 quent tro Mean-variance analysis. A method to mean and covariance of asset returns. Risk. The standard deviation of asset Turnover. A measure of how much the s in a portfolio change over a specific time period. RESOURCES MATLAB Central: Using MATLAB to Develop Portfolio ptimization Models www.mathwarks.com/res/mlmodels igue 6. Cumulative relative retums for each
Figure 5. Annual returns plotted against risk for portfolio sequences. Figure 6. Cumulative relative returns for each portfolio sequence. the star are portfolio sequences in the stable region—those with the lowest risk and the highest annualized returns. In fact, some portfolios outperformed the DJIA by about 150 basis points with comparable risk and less than 25% turnover per year. Finally, we evaluate performance relative to the DJIA by plotting the net cumulative value of a dollar investment in the portfolio sequences versus the DJIA. Over the backtest period, the portfolio sequences along the stable region consistently outperformed the benchmark (represented by the blue plane in Figure 6). Essentially, only the sequences in the stable region were above the “water level” of the DJIA. Next Steps By enabling analysts to acquire data, estimate asset return moments, form optimized portfolios, visualize concepts, and backtest results, MATLAB provides a platform that facilitates financial analysis. The approach described here is a good starting point for a portfolio optimization model. An institutional investor using this model would probably want to incorporate transaction costs and trading constraints into the model. Nevertheless, the potential to beat the market by an average 150 basis points with low turnover is an encouraging first step. 7 References Haugen, Robert and Nardin Baker, “Dedicated Stock Portfolios,” Journal of Portfolio Management, Summer 1990, pp. 17-22. ———, “The Efficient Market Inefficiency of Capitalization-Weighted Stock Portfolios,” Journal of Portfolio Management, Spring 1991, pp. 35-40. Markowitz, Harry, Portfolio Selection: Efficient Diversification of Investments, John Wiley & Sons, Inc., 1959. Resources 4Financial Modeling and Analysis www.mathworks.com/res/fin_modeling 4MATLAB Central: Using MATLAB to Develop Portfolio Optimization Models www.mathworks.com/res/mlcmodels Portfolio Optimization Glossary Basis Point. A measure of return. One basis point = 1/100 %. Capital Asset Pricing Model (CAPM). A model in which the return for any security or portfolio of securities equals the riskless rate plus a risk premium that is proportional to the excess market return (market return minus the riskless rate). Efficient frontier. The combination of all efficient portfolios (those that deliver the highest possible return for a given level of risk). Ex ante analysis. An analysis performed before any action is taken. Ex post analysis. An analysis performed after action is taken and results have been realized. An historical ex post analysis of investment performance is called a backtest. Maximum drawdown. The maximum decline in total equity from peak to subsequent trough. Mean-variance analysis. A method to select optimal portfolios based on the mean and covariance of asset returns. Risk. The standard deviation of asset total returns. Turnover. A measure of how much the holdings in a portfolio change over a specific time period
4 The mathWorks9mm如k8p抛am如分 91427v0010/06
©1994-2006 by The MathWorks, Inc. MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, and xPC TargetBox are registered trademarks and SimBiology, SimEvents, and SimHydraulics are trademarks of The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective holders. 91427v00 10/06