Chapter 12 Portfolio Theory with Matrix Algebra

Updated: May 13, 2021

Copyright © Eric Zivot 2015, 2016, 2021

In this chapter, we extend the mean-variance portfolio theory introduced in chapter 11 to handle more than two risky assets. This extension allows the theory to be applied to the analysis of real world portfolios that consist of many risky assets as well as a risk-free asset. When working with large portfolios, the algebra of representing portfolio expected returns and variances becomes extremely cumbersome. As shown in chapter 3, the use of matrix algebra can greatly simplify many of these computations. Matrix algebra formulations are also very useful when it comes to do actual computations on the computer. The matrix algebra formulas are easy to translate into matrix programming languages like R. Popular spreadsheet programs like Microsoft Excel, which are the workhorse programs of many financial houses, can also handle basic matrix calculations. All of this makes it worthwhile to become familiar with matrix techniques for portfolio calculations.

This chapter is laid out as follows. Section 1 describes portfolios with \(N\) risky assets using matrix algebra. The concept of portfolio risk diversification is elaborated using calculations for large portfolios. Sections 2 through 5 cover the matrix algebra calculations required for determining mean-variance efficient portfolios. Explicit formulas are given for the global minimum variance portfolio, a minimum variance portfolio that achieves a specified target expected return, and the tangency portfolio. A simple algorithm to easily trace out the risky asset only efficient frontier is also presented. Section 6 discusses some practical problems associated with very large portfolios, and section 7 introduces the IntroCompFinR functions for portfolio analysis. Section 9 gives a real-world application of the theory to asset allocation among Vanguard mutual funds.

The examples in this chapter use the corrplot, IntroCompFinR and PerformanceAnalytics packages. Make sure these packages are installed and loaded in R before replicating the chapter examples.

suppressPackageStartupMessages(library(corrplot))
suppressPackageStartupMessages(library(IntroCompFinR))
suppressPackageStartupMessages(library(PerformanceAnalytics))
options(digits=3)