Skip to content

πŸ‘¨β€πŸ« Notes

Markowitz Portfolio Optimization

The bulk of this lecture is based on Markowitz Portfolio optimization, which is an process for finding optimal allocations in a portfolio. It was derived from classical tools of probability.

It has three steps:

  1. Find the optimal risky portfolio.
  2. Build the CAL. The CAL is like a menu of different complete portfolios that an investor may choose, based on their risk aversion.
  3. Choose the complete portfolio off of the CAL that matches the investor’s risk preferences.

This entire process is illustrated in the following Excel spreadsheet:

Microsoft Excel File
Modern Portfolio Theory

Find the optimal risky portfolio

The following slide show a pair of assets. As you can see from the diagram, Asset 1 has a lower Οƒ and Er. Specifically, it looks like Οƒ1=12%Οƒ_1=12\% and Er1=8%E_{r1}=8\%, whereas Οƒ2=20%Οƒ_2=20\% and Er2=13%E_{r2}=13\%. Therefore, we can think of asset 1 as bonds and asset 2 as stocks.

The purple line shows all combinations of assets 1 and 2 that the investor can own. For example, the highest black dot represents a portfolio invested 100% in stock and the lowest black dot represents a portfolio invested 100% in bonds. The other points on the purple line represent all of the other possible weightings of the portfolio.

The middle black point represents a portfolio that is 50% invested in stocks and 50% invested in bonds. This investor puts half of their money in each asset. Note the following label for this portfolio:

The second half of the label indicates that the expected return of the β€œ50/50 portfolio” is a 50/50 weighted average of the expected returns of stocks and bonds:

E(rp)=50%Γ—E(r1)+50%Γ—E(r2)E(r_p) = 50\% Γ— E(r_1) + 50\% Γ— E(r_2)

Likewise, the label also indicates that the standard deviation of the 50/50 portfolio is lower than the 50/50 weighted average of the standard deviation:

ΟƒP<.5Οƒ1+.5Οƒ2Οƒ_P < .5Οƒ_1 + .5Οƒ_2

This is due to the benefits of diversification when the correlation between the assets is less than 1 (which it almost always is).

The followings slide indicates that you can get the β€œbest” (=highest return) CAL from the point on the curved line:

  1. where the CAL is tangent to the curved line
  2. the Sharpe ratio is highest

To find this risky portfolio, we plot out all points on the curved line and choose the one with the highest Sharpe ratio. To plot each point, we’ll need formulas for E(r)E(r) and σσ. We’ll show these in the following section.

The full process of finding the optimal risky portfolio is illustrated below in Excel:

Microsoft Excel File
Modern Portfolio Theory

πŸ™‹How do you determine which specific various weighted combinations to include when calculating the optimal risky portfolio?(β€œStep 1”) Would these be the points that make up the minimum variance frontier?

See answer You want to include enough points that you can get very close to the truly optimal portfolio. However, there is no scientifically best approach. At the bottom of the spreadsheet, I use a computer optimization program for this to find an optimal risky portfolio that is 29.1429% bonds and 70.8571% stocks. Here is a far better tool to use than Excel:
https://qontigo.com/products/axioma-portfolio-optimizer/

The key equations for ErPEr_P and σPσ_P

In the previous lecture, we talked about how investing is a tradeoff between risk (Οƒ)(Οƒ) and return (Er)(Er). We investigated this tradeoff as an investor allocated their assets between a risky (rP)(r_P) and a risk-free (rF)(r_F) asset. In this lecture, we extend the analysis. We consider how an investor can find the optimal risky portfolio to mix with the risk-free asset.

This involves another risk-return tradeoff, as we allocate between two (or more) risky assets. As before, we look at ErE_r and σσ. Our new formulas for them are:

E(rp)=w1E(r1)+w2E(r2)+β‹―E(r_p) = w_1E(r_1) + w_2E(r_2) + \cdots
Οƒp=Var(rp)\sigma_p = \sqrt{Var(r_p)}

where

Var(rp)=w12Οƒ12+w22Οƒ22+2w1w2Οƒ1Οƒ2ρ1,2Var(r_p) = w_1^2 \sigma_1^2 + w_2^2 \sigma_2^2 + 2w_1w_2 \sigma_1 \sigma_2 \rho_{1,2}

Note, ρ1,2 refers to the correlation between asset 1 and asset 2. Also, if you’reg not given ρ1,2 then you can use ρ1,2 = Οƒ_1Οƒ_2Cov(r_1, r_2).

✏️Image you are making a portfolio out of three mutual funds:

E(r)sd
T-Bill fund = rf2.4%0
Bond fund4% 9%
Stock Fund10% 15% ρ1,2=-0.221

Imagine a risky portfolio consisting of 60% stocks and 40% bonds. What are the expected return, variance, and standard deviation of this portfolio?

βœ”Let’s just decide that bonds are asset 1 and stocks are asset 2.

E(rp)=w1E(r1)+w2E(r2)+β‹―=40%Γ—4%+60%Γ—10%=7.6%\begin{aligned} E(r_p) &= w_1E(r_1) + w_2E(r_2) +β‹― \\ &= 40\% Γ— 4\% + 60\% Γ— 10\% \\ &= 7.6\% \end{aligned} Var(rp)=w12Οƒ12+w22Οƒ22+2w1w2Οƒ1Οƒ2ρ1,2=40%2Γ—9%2+60%2Γ—15%2+2Γ—40%Γ—60%Γ—9%Γ—15%Γ—(βˆ’0.221)=0.00796Var(r_p) = \textcolor{green}{{w_1}^2{\sigma_1}^2} + \textcolor{red}{{w_2^2 \sigma_2^2}} + \textcolor{royalblue}{{2w_1w_2 \sigma_1 \sigma_2 \rho_{1,2}}} \\ = \textcolor{green}{40\%^2 Γ— 9\%^2} + \textcolor{red}{60\%^2 Γ— 15\%^2} + \textcolor{royalblue}{2 Γ— 40\% Γ— 60\% Γ— 9\% Γ— 15\% Γ— (-0.221)} \\ = 0.00796
Οƒp=Var(rp)=0.0079612(enterΒ thisΒ asΒ 0.00796^.5)=0.08922=8.92%\begin{aligned} \sigma_p &= \sqrt{Var(r_p)} \\ &= 0.00796^{\frac{1}{2}} \\ &\text{(enter this as 0.00796\textasciicircum .5)} \\ &= 0.08922 \\ &= 8.92\% \end{aligned}

🧭 Key insight:
It turns out that these new formulas are derived from the same classical formulas from probability that last week’s key formulas are derived from:

2 Pairs of Statistics & 4 Helper Formulas


Expected Value of Return:
CAL:
E(rC)=rF+y(E(rP)βˆ’rF)E(r_C) = r_F + y(E(r_P) - r_F)
Two risky assets:
E(rp)=w1E(r1)+w2E (r2)E(r_p) = w_1E(r1) + w_2E\,(r_2)
Classic equation:
E(aX+bY)=a E(X)+b E(Y)E(aX + bY) = a\,E(X) + b\,E(Y)

Standard Deviation of Return (Risk):
CAL:
ΟƒC=yβ€…β€ŠΟƒPΟƒ_C = y \;Οƒ_P
Two risky assets:
ΟƒP=SQRT(Οƒ12 w12+Οƒ22 w22+2 w1 w2 Cov1,2)Οƒ_P = SQRT({Οƒ_1}^2\,{w_1}^2 + {Οƒ_2}^2\,{w_2}^2 + 2\,w_1\,w_2\,Cov_{1,2})
ΟƒP=SQRT(Οƒ12 w12+Οƒ22 w22+2 w1 w2 σ1 σ2 Corr1,2)Οƒ_P = SQRT({Οƒ_1}^2\,{w_1}^2 + {Οƒ_2}^2\,{w_2}^2 + 2\,w_1\,w_2\,Οƒ_1\,Οƒ_2\,Corr_{1,2})
Classic equation:
Var(aX+bY)=a2 Var(X)+b2 Var(Y)+2 a b Cov(X,Y)Var(aX + bY) = a^2\,Var(X) + b^2\,Var(Y) + 2\,a\,b\,Cov(X,Y)
* I wouldn't worry about using the two classic equations - but it's good to know the formulas Bruce used to come up with our equations.

Probability Helper Formulas:
Variance and Standard Deviation:
Οƒ=VarΒ andΒ Var=Οƒ2Οƒ = \sqrt{Var}\quad\text{ and }\quad Var = Οƒ^2
Covariance and Correlation:
ρ12=Cov(r1,r2)Οƒ1Οƒ2Β and ρ_{12}=\frac{Cov(r_1,r_2)}{Οƒ_1Οƒ_2}\quad\text{ and }
Cov(r1,r2)=ρ12Οƒ1Οƒ2\quad Cov(r_1,r_2)=ρ_{12}Οƒ_1Οƒ_2

I prefer the risk equations that use standard deviation rather than variance and that use correlation rather than covariance:

  • Standard deviation is measured in percentage points like returns are, so it’s easy to interpret.
  • Correlation is always between -1 and 1, so it’s also easy to interpret.

✏️ Redo the last question, but imagine that instead of being told the standard deviation of the risky assets, you were told the variances. In particular the variance of the bond fund is .0081 and the variance of the stock fund is .0225.

Click/tap for Lecture 1 Formulas
Name
Equation
Example
Expected Return, E(rC)E(r_C)
E(rC)=rF+y(E(rP)βˆ’rF)E(r_C) = r_F + y (E(r_P)-r_F)
or
E(rC)=yE(rP)+(1βˆ’y)rFE(r_C) = y E(r_P) + (1-y) r_F
= .04 + .50*(.12-.04) = .08 or 8%
or
= (.12 * .50) + (.04 * .50) = 8%
Standard Deviation of Complete Port, σcσ_c
σc=yσpσ_c = y σ_p
= .20 * .50 = .10 or 10%
Variance, VarVar
Var=Οƒ2Var = Οƒ^2 = Οƒ^2
Var = 12%^2 = .0144
Standard Deviation, σσ
Οƒ=Var=Var12Οƒ = \sqrt{Var} = Var^{\frac{1}{2}}
Οƒ = .0144^.5 = 12%
Risk Premium
Risk Premium =E(rC)βˆ’rF= E(r_C)-r_F
= 12% - 2% = 10%
Sharpe Ratio, SS
S=E(r)βˆ’rFΟƒS = \frac{E(r)-r_F}{Οƒ}
= (.12-.04)/.20 = (8/20) = .40
Equation for CAL
E(rC)=rF+E(rP)βˆ’rFΟƒPΟƒCE(r_C) = r_F + \frac{E(r_P) - r_F}{Οƒ_P}Οƒ_C
Sharpe ratio = .8
E(r_C) = r_F + Sσ_C = 2% + .8 * 15% = 14%
Notation

rFr_F = Return of Risk Free Assets

rPr_P = Return of Portfolio of Risky Assets

rCr_C = Return of Complete Portfolio

E(rP)/E(rC)E(r_P) / E(r_C) = Expected Return of Risky/Complete Portfolio

Occasionally I use ErP/ErCEr_P/Er_C as shorthand for E(rP)/E(rC)E(r_P)/E(r_C)

yy = % of Portfolio in Risky Assets

1βˆ’y1-y = % in Risk-Free Assets

σ/σP/σCσ/σ_P/σ_C = Standard Deviation

SS = Sharpe Ratio

Variance = Standard Deviation^2

Standard Deviation = SQRT of Variance

βœ”Here, we just convert the variance to standard deviation and then just redo the problem as before. To convert between Οƒ and Var, we use the following formulas:

Var=σ2, soσ=Var\begin{aligned} Var &= \sigma^2 \text{, so} \\ σ &=\sqrt{Var} \end{aligned}

Therefore,

Οƒ1=.0081.5=0.09=9%Οƒ2=.0225.5=15%\begin{aligned} Οƒ_1 &= .0081^.5 = 0.09 = 9\% \\ Οƒ_2 &= .0225^.5 = 15\% \end{aligned}

Because these two standard deviations are identical to the standard deviations in the previous problem, we just do the exact same calculations and get the exact same answers.

E(rp)=w1E(r1)+w2E(r2)+β‹―=40%Γ—4%+60%Γ—10%=7.6%\begin{aligned} E(r_p) &= w_1E\left(r_1 ) + w_2E(r_2 \right) +β‹― \\ &= 40\% Γ— 4\% + 60\% Γ— 10\% \\ &= 7.6\% \end{aligned}
Var(rp)=w12Οƒ12+w22Οƒ22+2w1w2Οƒ1Οƒ2ρ1,2=40%2Γ—9%2+60%2Γ—15%2+2Γ—40%Γ—60%Γ—9%Γ—15%(βˆ’0.221)=0.00796Var(r_p) = \textcolor{green}{{w_1}^2 {Οƒ_1}^2} + \textcolor{red}{{w_2}^2{Οƒ_2}^2} + \textcolor{royalblue}{2w_1 w_2Οƒ_1 Οƒ_2 \rho_{1,2}} \\ \qquad= \textcolor{green}{40\%^2 Γ— 9\%^2} + \textcolor{red}{60\%^2 Γ— 15\%^2} + \textcolor{royalblue}{2 Γ— 40\% Γ— 60\% Γ— 9\% Γ— 15\%(-0.221)} \\ \qquad= 0.00796
Οƒp=Var(rP)=0.0079612=0.00796^.5Β (inΒ Excel)=0.08922=8.92%\begin{aligned} Οƒ_p &= \sqrt{Var(r_P)} \\ &= 0.00796^{\frac12} \\ &= \text{0.00796\textasciicircum.5 \quad (in Excel)} \\ &= 0.08922 \\ &= 8.92\% \end{aligned}

Clearly, these formulas are helpful and β€œnot incredibly hard to use” once you get used to them. But you should be asking where they come from.

✏️ Consider the following data. What is the covariance between stocks and bonds?

E(r)sd
T-Bill fund = rf2.4%0
Bond fund4%9%
Stock Fund10%15%ρ1,2=-0.221

βœ”The helper formulas we want are on this slide:

Cov(r_1, r_2) = ρ1,2Οƒ_1Οƒ_2 = ρ1,2 * Οƒ1 * Οƒ_2 = -0.221 * 9% * 15% = -0.002984

✏️ In the above example, if the Covariance was .01, what would the correlation be?
βœ” ρ1,2 = (Cov r_1,r_2)/(Οƒ_1*Οƒ_2) = .01/(9% * 15% ) = .74

What if there are more than two assets?

The two formulas above can be used, as we saw, to build the optimal portfolio of risky assets when there are only two assets. But what if there are more than two assets?

In this case, there are more complicated formulas based on linear algebra (vectors and matrices). YOU ARE NOT RESPONSIBLE FOR THESE MORE COMPLICATED FORMULAS. But it’s nice to know that the material we’ve learned can be extended to optimize larger portfolios.

When you have six or more assets, you can use the extended formulas to calculate a β€œminimum variance frontier:β€œ

If you look at all of the portfolios you can construct with six assets and then plot their E(rP) and ΟƒP, then you will get a cloud-like shape as above. If you isolate all portfolios that have the lowest possible variance for a specific expected return, you get the β€œminimum variance frontier.”

The portfolio with the lowest variance/sd of all portfolios made from those six assets is the β€œGlobal Minimum Variance” portfolio. If we throw away the portfolios that are beneath a better portfolio, we get the β€œEfficient Frontier,” which are the relatively β€œelite” portfolios that are left over.

The following graphic shows many example risky portfolios constructed as mixtures of the available securities. Note that the red dot portfolios cluster around the minimum variance frontier:

By choosing the portfolio in the efficient frontier with the highest Sharpe ratio, we get the optimal risky portfolio:

Using this, we can construct our CAL.

Build the CAL

Our end-goal is to find an optimal risky portfolio that we can use to build a Capital Allocation line. Then we can choose a complete portfolio from the CAL that matches our risk preferences.

To plot, just make a table with various values of y. For each value of y, you just apply our two main formulas for the CAL.

Formula
E(rC) =
rF + y[E(rP) - rF]
ΟƒC = y ΟƒP

A far more complex example is illustrated here:

Risk preferences

✏️ An investor has the following utility function. Their coefficient of risk aversion, A, is 2.5 and their utility function is

U=E(r)βˆ’12AΟƒ2U = E(r)- \frac{1}{2} A \sigma^2

Consider the following three portfolios. Which portfolio is best for this investor?

123
y10%50%110%
Erc3.45%5.27%8%
Οƒc1.11%5.55%12.22%

βœ”

U=E(r)βˆ’.5Γ—2.5Γ—Οƒ2U = E(r) - .5 Γ— 2.5 Γ— Οƒ^2 U1=3.45%βˆ’.5Γ—2.5Γ—1.11%2=0.0343Β πŸ₯‰U_1 = 3.45\% - .5 Γ— 2.5 Γ— 1.11\%^2 = 0.0343 \text{ πŸ₯‰} U2=5.27%βˆ’.5Γ—2.5Γ—5.55%2=0.0488Β πŸ₯ˆU_2 = 5.27\% - .5 Γ— 2.5 Γ— 5.55\%^2 = 0.0488 \text{ πŸ₯ˆ} U3=8%βˆ’.5Γ—2.5Γ—12.22%2=0.0613Β πŸ₯‡U_3 = 8\% - .5 Γ— 2.5 Γ— 12.22\%^2 = 0.0613 \text{ πŸ₯‡}

Suppose that there are three portfolios, L, M, and H:

Also, imagine there are three investors. Each investor has a different A.

In the following table each investor is represented by a row and each portfolio is represented by a column. In each cell, he’s put the utility of the portfolio for that specific investor. For example in the upper right, we have the utility of portfolio L for an investor with A=2.

UL=E(r)βˆ’12AΟƒ2=E(r)βˆ’.5Γ—AΓ—Οƒ2=.07βˆ’.5Γ—2.0Γ—.052=0.0675U_L = E(r) - \frac{1}{2}A\sigma^2 = E(r) - .5 Γ— A Γ— Οƒ^2 = .07 - .5 Γ— 2.0 Γ— .05^2 = 0.0675

We can see from the table above that the first investor (A=2.0) will choose portfolio H. The second investor will choose portfolio M, and the third will choose portfolio M as well.

In the above example, the choice of optimal complete portfolio depends on the level of risk aversion. However, there are some portfolios that should never be chosen (regardless of risk aversion) because they are dominated by another portfolio.


Portfolio A dominates portfolio B if:

E(rA)β‰₯E(rB)E(r_A) β‰₯ E(r_B)

and

ΟƒA≀σBΟƒ_A ≀ Οƒ_B

If a portfolio dominates the other, it is β€œbetter on both dimensions.” A dominated portfolio will never be chosen if the investor could, instead, choose the dominating portfolio.

✏️ Of the following four portfolios, which portfolio would never be chosen by any investor? (Hint: look for two portfolios where one portfolio dominates the other. Ie look for a pair of portfolios where one portfolio has a lower Er and a higher Οƒ.)

  1. E(rA)=9%ΟƒA=10%E(r_A)=9\% \quad Οƒ_A= 10\%
  2. E(rB)=11%ΟƒB=12%E(r_B)= 11\% \quad Οƒ_B= 12\%
  3. E(rC)=7%ΟƒC=9.9%E(r_C)= 7\% \quad Οƒ_C= 9.9\%
  4. E(rD)=8%ΟƒD=11%E(r_D)= 8\% \quad Οƒ_D= 11\%

βœ”D is dominated by A because

  • D has a lower expected return: ☹️E(rD)= 8% < E(rA)=9%πŸ™‚
  • D has a higher risk: β˜ΉοΈΟƒD= 11% > ΟƒA= 10%πŸ™‚

✏️ The following table shows Er, Οƒ and U for 11 portfolios on the same CAL. The bonus exercise below shows how we can determine that rF = .07, E(rP)=.150, and ΟƒP=.220, just by looking at the table. With some algebra, we can also find A=4.
Fill in the blank in the table. In other words, what is the utility when y=50%.

βœ” When y=50%, U=E(r)βˆ’12AΟƒ2=.110βˆ’.5Γ—4Γ—.1102=0.0858U = E(r) - \frac{1}{2}AΟƒ^2 = .110-.5Γ— 4 Γ— .110^2 = 0.0858

🧠 This number is of a similar magnitude to the other utility numbers, so we can be confident in it!

Bonus exercise:

✏️ From what you know about the CAL, in the example above, what are rF, E(rP) and ΟƒP?

Hint: how does E(rC) compare to E(rP) when y=1?

βœ” When y=100%, E(rC)=E(rP). The tables shows us that E(rC) is .150 when y=1.0. Therefore, E(rP)=.150.
Similarly, when y=100%, ΟƒC=ΟƒP . The tables shows us that ΟƒC is .220 when y=1.0. Therefore, ΟƒP=.220.
Finally, when y=0%, E(rC) = rF. The table shows us that E(rC)= .070 when y=0, so rF = .07.

Bonus exercise 2:

✏️ What is A?

Plug and chug: (help)
  1. Equation:
    U=E(r)βˆ’.5AΟƒ2U = E(r)-.5AΟƒ^2
  2. Plug:πŸ”Œ

    Let’s look at when y = 1 and plug in: U = E(r)-.5AΟƒ^2

    .0532=.150βˆ’.5A.2202.0532 = .150-.5A.220^2
  3. Solve: πŸš‚
    .0532βˆ’.150=βˆ’0.0968=βˆ’.5A.2202.0532-.150 = -0.0968 = -.5A.220^2βˆ’0.0968/(βˆ’.5)=0.1936=A.2202-0.0968 /(-.5)=0.1936 = A.220^20.1936/(.2202)=4.0=A0.1936/(.220^2) = 4.0 = A
  4. Reflect: 🧠

    The investor on that table has A=4.

In the following slide, he plots utility for each of the values in the table above:

The conclusion is that there is a specific point where utility is maximized. Looking at both the table and the chart, you can see that the utility is maximized around y=.4.

Therefore, for an investor with a risk aversion of A=4, the optimal capital allocation decision is for them to invest roughly 40% of their assets in the risky portfolio.

✏️ In the following diagram, what is the utility of portfolios A, B, C, D, and E?

Portfolio A is on the dashed black line, so it receives a utility of .07.
Portfolio B is on the solid blue line, so it receives a utility of .078

✏️ If the values of y for each of the β€œlettered” portfolios is given on the diagram, what percentage of their assets should the investor allocate to risk assets?
βœ” The highest utility is reached at portfolio C, so the investor should invest 42% of their investable wealth in risk assets.

Using algebra/Plug and chug, (help) we could solve for the portfolio weights that will give us a specific Er in our risky portfolio.


…or we could just use the formula Bruce gave us:

✏️ Suppose you want to make a risky portfolio with an expected return of 7% out of the following two assets. What should you invest in each asset?

E(r)sd
Bond fund4%8%
Stock Fund9%15%

βœ”

w1=E(rP)βˆ’E(r2)E(r1)βˆ’E(r2)=7%βˆ’9%4%βˆ’9%=40.0%\begin{aligned} w_1 &= \frac{E(r_P) - E(r_2)}{ E(r_1) - E(r_2)} \\ &= \frac{7\% - 9\%}{4\% - 9\%} \\ &= 40.0\% \end{aligned}
Plug and chug: (help)
  1. Equation:

    Our main formula for Er in this lecture is: E(rp)=w1E(r1)+w1E(r1)E(r_p) = w_1E(r_1) + w_1E(r_1)

  2. Plug:πŸ”Œ

    All of our money will either be invested in asset 1 or asset 2. Therefore, w_2 = 100%-w_1. If we substitute 100%-w_1 in for w_2, then we get:

    E(rp)=w1E(r1)+(1βˆ’w1) E(r2)E(r_p) = w_1E(r_1) + (1 - w_1)\,E(r_2)
  3. Solve: πŸš‚

    If we solve that equation for w_1 we get the formula Bruce gave us, above.