10 views

Uploaded by Anonymous S8AoGXOSI

PortfolioOptimization

save

- 18e -- Chapter008
- Alternative Investments
- Financial Engineering
- Lect03 - Risk
- 01-january-2008
- Report 179
- B320_BF10_You_reap_what_you_sow_6th_Presentation_30Nov2010
- Portfolio Management Data Origina ANGEL by PAVANI &RAM
- Diversifying Your Portfolio
- ValuEngine Market Neutral Newsletter Beats Benchmark
- fPortfolio
- Performance and Attribution Analysis
- 1312.0506
- Risk+Revisited.unlocked
- Risk and Rates of Return
- Econ 132 Midterm 2 Book Stuff
- Rb Vye Ch7 Sw q&Answers
- My Final Project
- DiversificationPremium.pdf
- US Treasury: teacherNewsletterV3N3
- 149146_StrongPCMP5e-ch01
- Risk and Return Chapter 5
- Spin
- CF.21.RR.pptx
- di
- Finance Articles ANALYSIS
- AAII_InvestingBasicsEBook
- Powershell Cheat Sheet
- SoloPapelyBoli.com Introducción a La Macroeconomía
- XenDesktop and XenApp - Best Practices
- Algebra 2 Fi Sicas
- Windows Cheat Sheet
- Economia Española
- SysAdminCheatSheet PDF
- Bowiq.dan.Stefanica.a.primer.for.the.mathematics.of.Financial.engineering.second.edition
- Calculo de Probabilidades Con Excel

You are on page 1of 12

:

Markowitz Portfolio Optimization with Matrix Algebra

Alex Moehring

Spring 2013

Economics 423 Financial Markets. The variance of returns can be calculated as follows: ??? ? = ? ? − ? ! Where ? is all the possible returns of the asset. NC. ?! = ????? ?! . I have constructed an excel file which constructs the optimal portfolio for a given asset universe. ?! = ? ? − ? ? − ? Where x and y are all the possible values of the returns on assets x and y. we can see that ????? ?! . Lecture. This assumption naturally leads to investor utility (which the investor attempts to maximize) depending solely on these two criteria in the following standard two-moment utility function. From this definition. NC. however. In this paper I will describe the process of Markowitz Style Portfolio Optimization and utilize linear algebra to greatly simplify the process. ?! . Lecture. Chapel Hill. Finally. Aguilar. Also. the covariance of two asset’s returns is defined as: ????? ?! .3 ? = ? ?! − ??!! Where ? ?! is the expected return of security ? and ?!! is the variance of the returns of security ?. Michael. which can be calculated as follows: ! ?= ℎ! ?! !!! Where ℎ! is the probability that the return of the asset will be ?! . Mean-Variance Criteria Throughout this paper. There is a lot of debate as to the validity of this assumption because empirical evidence suggests returns may not be normally distributed. This paper is intended as a useful guide for using matrices in portfolio optimization and I am in no way claiming this is the first guide of its nature. we will assume that returns are normally distributed meaning that the distribution of returns can be fully described by the mean and variance of the returns. Quick Review of Statistics1 We will need to calculate the average (mean) return for assets. Economics 423 Financial Markets. Chapel Hill.Introduction The tools of linear algebra are used throughout finance to simplify notation and calculations. 3 Ibid 1Aguilar. The ? in this equation is a measure of risk aversion. Michael.2 The expected return is defined as the mean return. I will carry this assumption throughout this paper. 2 2 . for ease of exposition.

and ? are defined as above and ? ! is the risk free rate. Asset Allocation Traditional security selection involves picking a few of your “favorite” securities and investing heavily in those few securities. NC. we find the optimal allocation between the risky portfolio and the risk free rate that maximizes the investor’s utility. Economics 423 Financial Markets. 5 Markowitz. however. No. 353-363. 2) We then find the “best” of these risky portfolios by looking for the portfolio that maximizes the Sharpe Ratio: ?= ? ? − ?! ? ? Where ? ? . suggested that the full benefits of diversification required a portfolio of around 30-40 stocks rather than the previously thought of 10 or so stocks. (1952). 3) Finally. The risky portfolio that maximizes this ratio is then combined with the risk free rate. I will only derive mathematically the first step since this is where linear algebra is most useful. respectively. Meir Statman.77-91. Maximizing the Sharpe Ratio gives us the highest risk reward tradeoff.5 To find optimal portfolios.To form optimal portfolios. No. “How many stocks make a diversified portfolio. 4 Statman. where we maximize expected return given some maximum allowed variance or equivalently (and more intuitively). I will show graphically how to complete steps 2) and 3). Meir.” Journal of Financial and Quantitative Analysis. 3 (1987): pp. we use three steps:6 1) We find the efficient sets of risky portfolios (portfolio of risky assets) by solving a constrained optimization problem where we find the portfolio weights that give us the minimal portfolio variance subject to the expected return being equal to some target rate of return. With the rise of modern portfolio theory. Harry.” The Journal of Finance Volume 7. minimizing variance subject to some minimum expected return. the risk free rate is the 90-day Treasury bill. Volume 22. Because this paper is intended to show the benefits of using linear algebra in portfolio optimization. in 1987. Harry Markowitz first developed the idea of portfolio optimization. and also the covariance of the returns for all of the assets in the universe. In practice. 3 . Chapel Hill. the variance of each of those returns. we have to have forecasts for the expected returns of each asset.4 Markowitz Portfolio Optimization In 1952. 6 Aguilar. Michael. the idea of diversification became more apparent in that by increasing a portfolio by only a few assets (assuming asset returns have low or negative correlation) one can significantly reduce the portfolio variance. I will use ?! and ?! to represent the return on the risky portfolio and the complete portfolio (risky portfolio mixed with risk free rate). 1. pp. Throughout this paper. Lecture. “Portfolio Selection.

? = ?! ?[?! ] ! ? ?! 7 Where ?! is the portfolio weights for security ? and ? ?! is the expected return for security ?. ?! and ?! represent the standard deviation of the risky and complete portfolios. ?!! ?= ⋮ ?!! ⋯ ⋱ ⋯ ?!! ⋮ ?!! Recall: ?!" = ?!" because ????? ?! . thus ? is a symmetric matrix. 8 4 . ! ? ?! = ?! ?[?! ] !!! Or written using matrices: ?! ?[?! ] ⋮ ⋮ = ? ? where ? = . Chapel Hill. ?! = ????? ?! ." Washington University. ?! We can make use of a variance-covariance matrix to simplify the calculations. 9 Zivot. The variance of the risky portfolio can be derived as follows: ??? ? ?! = ??? ! !!! ℎ! ? ?! ! !!! = 8 ! !!! ?! ?! ?!" Note: ?!! = ??? ?! & ?!" = ????? ?! . respectively." Washington University. ?! . "Portfolio Theory with Matrix Algebra. NC. Michael. Aguilar. Expected Return and Variance of Risky Portfolio The risky portfolio expected return is simply the weighted average of expected returns on the securities within the portfolio.Similarly. Eric. Eric. "Portfolio Theory with Matrix Algebra. Economics 423 Financial Markets. Step One-Construct Efficient Risky Portfolios The first step in the process of minimizing variance for some target return is constructing the expected return and variance for the risky portfolio from expected returns and variances for the ? assets comprising the portfolio. The variance of the portfolio using matrices can be written as follows:9 ! ??? ? ?! ! ?! ?! ?!" = ?! = !!! !!! ⋯ ?! ?!! ⋮ ?!! ⋯ ⋱ ⋯ ?!! ⋮ ?!! ?! ⋮ = ? ! ?? ?! 7 Zivot. Lecture.

" Washington University.14 10 Aguilar. variance. This constraint can be illustrated as:10 ! ! ?! ? ?! = ? ∗ ⇒ !!! ?! ?[?! ] − ? ∗ = 0 !!! Or written using matrices:11 ? ∙ ? − ?∗ = 0 The second constraint we need is that the portfolio weights sum to one. We need to forecast ? expected returns. one for each asset. 11 5 . calculating efficient portfolios requires a significant number of forecasts of asset expected return. Michael. Zivot. Some popular asset pricing models are the Capital Asset Pricing Model (CAPM) and Arbitrage Pricing Theory (APT). NC. Chapel Hill. however. There are a countless number of ways to construct these forecasts. therefore I will make the simplifying assumption that historical returns reflect future returns and thus use historical values as proxies for their forecasted counterparts. For my examples. Note we would never want to hold cash in the risky portfolio. we must add two constraints to the problem. 12 Aguilar.12 This constraint is required because the optimal risky portfolio must be fully invested. "Portfolio Theory with Matrix Algebra. 13 Zivot. ! ! ?! = 1 ⇒ !!! ?! − 1 = 0 !!! Or written using matrices:13 ? ∙ 1 = 1 where 1 = 1 ⋮ ∈ ℝ! 1 Constrained Optimization We now have the problem set up where we need to minimize ?!! with respect to the two constraints. First we must ensure that our expected return is equal to some target expected return. Economics 423 Financial Markets. how we come up with the forecasts is not important. we will use a Lagrangian that will yield a system of equations that we will solve using the tools of linear algebra.Clearly." Washington University. "Portfolio Theory with Matrix Algebra. Lecture. Constraints When minimizing the variance of our risky portfolio. Lecture. and ?! forecasts are required in the variance covariance matrix. Eric. ? ∗ . because we could just invest it at the risk free rate. Michael. Eric. In order to solve this. This is called the “fully invested” constraint. Later in step 2 we can combine the risky portfolio with the risk free asset. Economics 423 Financial Markets. NC. Chapel Hill. and covariance.

Chapel Hill. ?! . ?! ." Washington University. Zivot. Eric. ?! + ?! !!! !!! ! !!! ?! − 1 !!! This equation can be simplified using matrix notation as follows:15 ℒ ?. Lecture. ?! . "Portfolio Theory with Matrix Algebra. ?! = ? ! ?? + ?! ? ∙ ? − ? ∗ + ?! (? ∙ 1 − 1) We now need to take the first order conditions (FOCs) of this Lagrangian. we take the partial of the scalar with respect to each component as follows: ?ℒ = ?? ℒ = ?! ⋯ ?! ?!! ⋮ ?!! + ?! ℒ = ?! ⋯ ?! ?ℒ ??! ⋮ ?ℒ ??! ⋯ ?!! ?! ⋱ ⋮ ⋮ + ?! ⋯ ?!! ?! ?! 1 ⋮ ∙ ⋮ −1 ?! 1 ?! ? ?! ⋮ ∙ ⋮ ?! ? ?! − ?∗ ?! ?!! + ⋯ + ?! ?!! ⋮ + ?! ?! ? ?! + ⋯ + ?! ? ?! − ? ∗ ?! ?!! + ⋯ + ?! ?!! + ?! ?! + ⋯ + ?! − 1 ℒ = ?!! ?!! + ⋯ + ?! ?! ?!! + ⋯ + ?! ?! ?!! + ⋯ + ?!! ?!! + ?! ?! ? ?! + ⋯ + ?! ? ?! + ?! ?! + ⋯ + ?! − 1 Because ? is symmetric: ! ! ℒ= ?! ?! ?!" + ?! ?! ? ?! + ⋯ + ?! ? ?! + ?! ?! + ⋯ + ?! − 1 !!! !!! 2?! ?!! + ⋯ + 2?! ?!! ? ?! ?ℒ ⋮ ⋮ = + ?! ?? 2?! ?!! + ⋯ + 2?! ?!! ? ?! + ?! 1 ⋮ 1 14 15 Aguilar. To take a partial derivative of a scalar with respect to a vector.! ! ℒ ?! . Michael. Economics 423 Financial Markets. 6 . ?! = ! ?! ? ?! − ? ∗ + ?! ??? ?! . … . NC.

? = ?! & ? = ? ∗ ?! 0 1 The solution to this system of equations is ? = ?!! ? as long as ker ? = 0 and thus ? is invertible. The assets expected return and variances were calculated using historical data from the year 2012 and the results are as follows (note as I mentioned earlier. ⋯ . ?. 0= ?ℒ = 2 ∙ ?? + ?! ? + ?! ∙ 1 ?? 0= ?ℒ = ? ∙ ? − ?∗ ??! 0= ?ℒ = ? ∙ 1 − 1 ??! The FOCs give us ? + 2 linear equations and ? + 2 unknowns. Asset R IYM IDU 4. are the portfolio weights.66% 7 . I will assume there are three assets in the universe: IYM (Basic Materials Sector ETF). this assumption is for tractability and is not meant to be reflective of reality).Or ?? = ? Where: 2? ? = ?! 1! ? 0 0 ? 1 0 0 . and TLT (Long term Treasury Bond ETF).?ℒ = 2 ∙ ?? + ?! ? + ?! ∙ 1 ?? The other two FOCs are trivial thus we have the following three FOCs. ?! to be placed on the assets in order to construct and efficient risky portfolio given some target return.20% -‐0. The first ? elements of the solution. This system of equations can be depicted using matrices as follows: 2? ?! 1! ? 0 0 1 0 0 ? 0 ?! = ? ∗ ?! 1 . ?! . IDU (Utilities Sector ETF). In this example. Example of Forming an Efficient Risky Portfolio I will now give an example of forming an efficient risky portfolio using Markowitz portfolio optimization.

The benefits of diversification increase as the assets become less correlated with each other.600511587 0.88111E-‐05 -‐1.0080% I also have plotted several efficient portfolios and connected them to form the efficient frontier (line containing efficient portfolios).88111E-‐05 IDU 3.05394E-‐05 -‐5.770864049 Asset E[R] 4. assume there is a required ? ?! of 5%. and the curvature of the efficient frontier increases.0036% 0. Combining the three assets into a portfolio can give you a higher expected return with a lower variance than any of the three individual assets can by themselves.45% Variance-Covariance Matrix: IYM IDU TLT IYM 0.05394E-‐05 3.96458E-‐05 For this example.66% 1.829647538 -‐0. The benefits of diversification are obvious when looking at the efficient frontier.0150% 5.20% -‐0.TLT 1.62022E-‐05 -‐1.53612E-‐05 TLT -‐5.53612E-‐05 7.00% 0.00723% 0. Step 2-Mix Risky Portfolio with Risk Free Rate to Form Capital Markets Line 8 . Plugging these values into the formula for ? above and multiplying ?!! by ? I got the portfolio weights equal to: Asset IYM IDU TLT Portfolio Weights 0.45% Asset Portfolio Variance of Variance E[r} Optimal Portfolio 0.000150146 3.

NC. and the portfolio weight of the risk free rate. Chapel Hill. the optimal risky portfolio with which to construct our CML is the one in which the CML is tangent to the efficient frontier because this is the steepest possible CML (highest Sharpe ratio). Ibid 18 Ibid 19 Aguilar. Michael. Lecture. 2013. 1 − ? . 29 Mar. 08 Apr.19 20 16 Aguilar. Therefore. 20 "Efficient Frontier. The complete portfolio will depend on the portfolio weight of the risky portfolio. as illustrated below. Michael. Economics 423 Financial Markets. but. We will derive this line now. The next step in portfolio optimization is mixing these efficient portfolios with the risk free rate to form a complete portfolio. we form a line between the two called the Capital Markets Line (CML). Wikimedia Foundation. Web. Economics 423 Financial Markets. Chapel Hill.We now have a set of efficient portfolios called the efficient frontier." Wikipedia. 2013. ?. given our utility function earlier. the steepest CML would yield the highest utility. As we mix the risky portfolio with the risk free rate. NC. 17 9 . Lecture. The expected return of the complete portfolio is derived as follows:16 ?! = ??! + 1 − ? ? ! ? ?! = ? ??! + 1 − ? ? ! = ? ! + ? ? ?! − ? ! The variance of the complete portfolio can be found by:17 ??? ?! = ???[? ! + ? ? ?! − ? ! = ? ! ??? ? = ? ! ?!! Solving for and eliminating ? yields the equation of the CML:18 ?!! = ? ! ?!! → ? = ? ?! = ? ! + ?! ?! ?! ? ?! − ? ! ?! This Capital Markets Line can be formed from any risky portfolio.

Lecture. 22 The indifference curves’ utility increase as we move to higher return and lower risk (up and to the left in graph). The indifference curves are illustrated in the image below. NC. 2013. 8 Apr. Harry Markowitz. Now all that remains is to find the point on the CML that maximizes utility for a given individual’s risk preferences." Wikipedia. Web. Wikipedia Foundation.We have now constructed a line consisting of optimal portfolios. We can rearrange this formula to form indifference curves for a given utility level as follows:21 ? = ? ? − ?? ! ? ? = ? ∗ + ?? ! The indifference curves are clearly upward sloping because as the standard deviation of the portfolio increases. we assume each investor has a two-moment utility function described earlier. 2013. Step 3-Allocate Between Risky Portfolio and Risk Free Rate to Maximize Utility As mentioned earlier. 10 . I have intentionally described this qualitatively rather than quantitatively because my focus for this paper is the first step of Markowitz Portfolio Optimization. Economics 423 Financial Markets. As I have state 21 22 Aguilar. Michael. the investor must be compensated in the form of a higher ? ? . It is clear that the portfolio that would give the investor the highest utility is the portfolio on the CML that is tangent to the utility curves above. Excel Program I have also created an excel file which automates the process of minimizing portfolio variance given some target expected return (Step 1). This file uses the assumption that past performance of an asset’s return is a good indicator of future returns. Chapel Hill. 20 Mar.

this assumption is solely for ease of exposition and is not meant to be indicative of reality. but both the difficulty and quantity of calculations are greatly reduced as well. Conclusion To summarize.many times. Not only is the exposition of the problems simplified. The instructions on how to use the file are located on its cover page. 11 . the tools of linear algebra are incredibly useful in portfolio theory.

Web. "Portfolio Theory with Matrix Algebra. 2013. “How many stocks make a diversified portfolio. 8 Apr.77-91. 29 Mar. No. Statman. <http://faculty. 2013.pdf>. Wikipedia Foundation. 1. Meir. (1952). Zivot.edu/ezivot/econ424/portfolioTheoryMatrix.d. 08 Apr. 2013." Yahoo!. Volume 22. 12 . 20 Mar. “Portfolio Selection. Web." Washington University.d. Eric.” The Journal of Finance Volume 7. n. No. Markowitz.” Journal of Financial and Quantitative Analysis.washington. Web. 2013. 3 (1987): pp.Linear Term Project Bibliography "Efficient Frontier." Wikipedia. Harry. 2013. 08 Apr. 353-363. pp. Web. n. Wikimedia Foundation. "Harry Markowitz." Wikipedia. "Yahoo! Finance.

- 18e -- Chapter008Uploaded bymnopp
- Alternative InvestmentsUploaded byViolet Trang
- Financial EngineeringUploaded byDipesh Jain
- Lect03 - RiskUploaded byUsman Faruque
- 01-january-2008Uploaded byJon Frangipane
- Report 179Uploaded bymuhammadalimalik122
- B320_BF10_You_reap_what_you_sow_6th_Presentation_30Nov2010Uploaded byCandyce Chew
- Portfolio Management Data Origina ANGEL by PAVANI &RAMUploaded byPochender Vajroj
- Diversifying Your PortfolioUploaded byAmos Onyango
- ValuEngine Market Neutral Newsletter Beats BenchmarkUploaded byValuEngine.com
- fPortfolioUploaded byMartin Schmitz
- Performance and Attribution AnalysisUploaded bySakib Ahmed Chowdhury
- 1312.0506Uploaded byAlpha
- Risk+Revisited.unlockedUploaded byValueWalk
- Risk and Rates of ReturnUploaded bydiyaalkhazraji129
- Econ 132 Midterm 2 Book StuffUploaded byThomas Ngo
- Rb Vye Ch7 Sw q&AnswersUploaded byAira Estalane
- My Final ProjectUploaded bymoss4u
- DiversificationPremium.pdfUploaded byCorey Page
- US Treasury: teacherNewsletterV3N3Uploaded byTreasury
- 149146_StrongPCMP5e-ch01Uploaded byQamarulArifin
- Risk and Return Chapter 5Uploaded bysundas younas
- SpinUploaded byiamumpidi
- CF.21.RR.pptxUploaded bySoumya Khatua
- diUploaded bydk6666
- Finance Articles ANALYSISUploaded byGwenneth Bachus
- AAII_InvestingBasicsEBookUploaded byjunkyjunkston

- Powershell Cheat SheetUploaded byAnonymous S8AoGXOSI
- SoloPapelyBoli.com Introducción a La MacroeconomíaUploaded byAnonymous S8AoGXOSI
- XenDesktop and XenApp - Best PracticesUploaded byAnonymous S8AoGXOSI
- Algebra 2 Fi SicasUploaded byAnonymous S8AoGXOSI
- Windows Cheat SheetUploaded byAnonymous S8AoGXOSI
- Economia EspañolaUploaded byAnonymous S8AoGXOSI
- SysAdminCheatSheet PDFUploaded byAnonymous S8AoGXOSI
- Bowiq.dan.Stefanica.a.primer.for.the.mathematics.of.Financial.engineering.second.editionUploaded byAnonymous S8AoGXOSI
- Calculo de Probabilidades Con ExcelUploaded byAnonymous S8AoGXOSI