You are on page 1of 3

Small guide through spreadsheet ”Portfolio Optimization – Two Risky Assets

and a Riskfree Asset”

The equation numbers correspond to the numbers of the formulas in the spreadsheet.
I uploaded the book by Holden that contains this spreadsheet and others that we will use
later in the course. It contains some limited explanations on the data inputs but not much
about where the formulas used come from. So here is a guide for the spreadsheet that we saw
in Lecture 1.
The risky portfolio consists of two assets. You can think of them as a stock index (high
expected return and high volatility (standard deviation)) and a bond index (low expected return
and low standard deviation). Note that the returns and standard deviations are monthly.
Formulas 1 and 2 are the standard deviation and expected return of a portfolio of two risky
assets that we have seen in class:

2
σP,risky = ω 2 σ12 + (1 − ω)2 σ22 + 2ω(1 − ω)ρσ1 σ2

Taking the square root, you get the standard deviation

q
σP,risky = ω 2 σ12 + (1 − ω)2 σ22 + 2ω(1 − ω)ρσ1 σ2 (1)
µP,risky = ωµ1 + (1 − ω)µ2 (2)

To obtain formula (3) we need to solve the mean-variance optimization problem. The classical
formulation is that investors wish to minimize portfolio variance for a given return. Since we
have a riskless asset in addition to the two risky assets we need to optimize over all assets. We
denote by α the weight of risky assets in the composite portfolio. So in the composite portfolio,
risky asset 1 will have a weight of αω, risky asset 2 of α(1 − ω), and the riskless asset 1 − α.
The standard deviation and expected return of the composite portfolio are, respectively

σP2 = α2 σP,risky
2

= α2 ω 2 σ12 + (1 − ω)2 σ22 + 2ω(1 − ω)ρσ1 σ2 and


 

µP = αωµ1 + α(1 − ω)µ2 + (1 − α)r

The mean-variance problem is

min 21 σP2 s.t. µp = µ̄


α,ω

We set up the Lagrangian

L = 12 α2 ω 2 σ12 + (1 − ω)2 σ22 + 2ω(1 − ω)ρσ1 σ2 + λ [µ̄ − αωµ1 + α(1 − ω)µ2 + (1 − α)r]
 

The two first-order conditions with respect to α and ω read

1
∂L
= α ω 2 σ12 + (1 − ω)2 σ22 + 2ω(1 − ω)ρσ1 σ2 − λ [ωµ1 + (1 − ω)µ2 − r] = 0
 
∂α
∂L 1 2
2ωσ12 − 2(1 − ω)σ22 + 2ω(1 − 2ω)ρσ1 σ2 − λα(µ1 − µ2 ) = 0
 
= 2α
∂ω

The first of these two equations can be rewritten as

γ ω 2 σ12 + (1 − ω)2 σ22 + 2ω(1 − ω)ρσ1 σ2


=
α ωµ1 + (1 − ω)µ2 − r

Dividing the second of the two equations by α2 gives

γ
ωσ12 − (1 − ω)σ22 + ω(1 − 2ω)ρσ1 σ2 = (µ1 − µ2 )
α

Now substitute for αγ from the previous equation to get


 2 2
ω σ1 + (1 − ω)2 σ22 + 2ω(1 − ω)ρσ1 σ2 [ωµ1 + (1 − ω)µ2 − r]


= ω 2 σ12 + (1 − ω)2 σ22 + 2ω(1 − ω)ρσ1 σ2 (µ1 − µ2 )


 

It remains to solve for ω which involves a little algebra but everything is straightforward.
As a result you get formula (3):

σ22 (µ1 − r) − ρσ1 σ2 (µ2 − r)


ω= (3)
σ12 (µ2 − r) + σ22 (µ1 − r) − ρσ1 σ2 (µ1 + µ2 − 2r)
with the little difference that the excess return µi −r is denoted shortly by Ei in the spreadsheet.
This is the optimal risky portfolio, or tangent portfolio (T). The point of this portfolio in standard
deviation - expected return space and the point of the riskfree asset (0,r) define a line called the
capital allocation line. It gives all composite portfolios of T and the riskfree asset.
In lines 50 and 51, two points on the capital allocation line are computed – with 0 and 1000%
weight to the tangency portfolio. The resulting standard deviations and expected returns of the
composite portfolio P are

σP = ασT and (4)


µP = αµT + (1 − α)r (5)

It remains to find the optimal mix of tangency portfolio and riskfree asset for each investor.
We could proceed with the mean-variance problem, i.e. fixing an expected return and solving for
α. But here we look instead for the optimal portfolio of an investor with mean-variance utility
and risk aversion coefficient γ. This will lead to an optimal combination of expected return and
standard deviation so that we do not have to fix the desired expected return at some number.
Before we solve this problem, note that you can solve equation (4) for α and plug this into
equation(5). This gives you the equation for the capital allocation line
µT − r
µP = r + σP
σT
µT −r
where the slope coefficient σT is called the Sharpe ratio.

2
We now maximize utility, i.e.,
γ 2
max µP −
σ
α 2 P
where µP is given by equation (5) and σP2 by equation (4) taken to the square. The first-order
condition is

µT − r − γασT2 = 0
µT − r
α =
γσT2

This is the optimal composite portfolio, indicated by the green dot in the graph – the
tangency point of the indifference curve representing the mean-variance utility and the capital
allocation line.
The indifference curve is constructed in the bottom part of the spreadsheet.1 For this,
standard deviation varies from 0 to 15%. Only one indifference curve is drawn here – at the
optimal utility level (see equation (9) below). The corresponding expected returns come from
inverting the utility expression U = µP − γ2 σP2 :
γ
µP = U ∗ + σP2 (6)
2
where the star stands for the optimal level. Next, the standard deviation of the optimal com-
posite portfolio is
σP = ασT
µT − r
= σT
γσT2
µT − r
= (7)
γσT

The expected return of the optimal portfolio can be found with the equation of the capital
allocation line that we derived above and restate here
µT − r
µP = r + σP (8)
σT

Finally, the utility level at the optimum U ∗ that was used in equation (6) to construct the
indifference curve going through the optimal point is given by
γ
U ∗ = µP − σP2
2
µT − r µ T − r γ µT − r 2
 
= r+ −
σT γσT 2 γσT
1 (µT − r)2
= r+ (9)
γ 2σT2
where we have used equation (8) and (7) in the second line.
Unfortunately, there is a tiny mistake in the spreadsheet: The authors have used mean-
variance utility in the formulation µP − γ̃σP2 . This is not really wrong but note that here γ̃ is
not the risk aversion parameter but rather risk aversion times 2. So you just replace γ by 2γ in
equations (6) to (9) and you get now exactly the formulas in the spreadsheet.
1
The following equations (6) to (9) do not exactly match those in the spreadsheet file, see the last paragraph
below for an explanation.

You might also like