Professional Documents
Culture Documents
tests
Wei-Peng Chen*
Department oI Finance, Hsih-Shin University, Taiwan
c8145666ms18.hinet.net
Huimin Chung
Graduate Institute oI Finance, National Chiao Tung University, Taiwan
Keng-Yu Ho
Department oI Finance, National Central University, Taiwan
kengyuhocc.ncu.edu.tw
Tsui-Ling Hsu
Graduate Institute oI Finance, National Chiao Tung University, Taiwan
tracy.shumsa.hinet.net
Prepared for Handbook of Quantitative Finance and Risk Management
*
Wei-Peng Chen is at the Department oI Finance at Shih-Hsin University; Huimin Chung and Tsui-Ling Hsu are at the
Graduate Institute oI Finance at the National Chiao Tung University. Keng-Yu Ho is at Department oI Finance, National Central
University. Address correspondence to Huimin Chung, Graduate Institute oI Finance, National Chiao Tung University, 1001
Ta-Hsueh Road, Hsinchu 30050, Taiwan; Tel: 886-3-5712121 ext.57075; Fax: 886-3-5733260;. E-mail:
chunghuimail.nctu.edu.tw.
2
In this chapter we introduce the theory and the application oI computer program oI modern
portIolio theory. The notion oI diversiIication is age-old 'don't put your eggs in one basket,
obviously predates economic theory. However a Iormal model showing how to make the most oI
the power oI diversiIication was not devised until 1952, a Ieat Ior which Harry Markowitz
eventually won Nobel Prize in economics.
Markowitz portIolio shows that as you add assets to an investment portIolio the total risk oI that
portIolio - as measured by the variance (or standard deviation) oI total return - declines
continuously, but the expected return oI the portIolio is a weighted average oI the expected returns
oI the individual assets. In other words, by investing in portIolios rather than in individual assets,
investors could lower the total risk oI investing without sacriIicing return.
In the second part we introduce the mean-variance spanning test which Iollows directly Irom the
portIolio optimization problem.
IA1RODUC1IOA OF MARKOWI1Z POR1FOLIO-SELEC1IOA MODEL
Harry Markowitz (1952, 1959) developed his portIolio-selection technique, which came to be
called modern portIolio theory (MPT). Prior to Markowitz's work, security-selection models
Iocused primarily on the returns generated by investment opportunities. Standard investment advice
was to identiIy those securities that oIIered the best opportunities Ior gain with the least risk and
then construct a portIolio Irom these. Following this advice, an investor might conclude that
railroad stocks all oIIered good risk-reward characteristics and compile a portIolio entirely Irom
these. The Markowitz theory retained the emphasis on return; but it elevated risk to a coequal level
oI importance, and the concept oI portIolio risk was born. Whereas risk has been considered an
important Iactor and variance an accepted way oI measuring risk, Markowitz was the Iirst to clearly
and rigorously show how the variance oI a portIolio can be reduced through the impact oI
diversiIication, he proposed that investors Iocus on selecting portIolios based on their overall
risk-reward characteristics instead oI merely compiling portIolios Irom securities that each
individually have attractive risk-reward characteristics.
A Markowitz portIolio model is one where no added diversiIication can lower the portIolio's
risk Ior a given return expectation (alternately, no additional expected return can be gained without
increasing the risk oI the portIolio). The Markowitz EIIicient Frontier is the set oI all portIolios oI
3
which expected returns reach the maximum given a certain level oI risk.
The Markowitz model is based on several assumptions concerning the behavior oI investors
and Iinancial markets:
1. A probability distribution oI possible returns over some holding period can be estimated
by investors.
2. Investors have single-period utility Iunctions in which they maximize utility within the
Iramework oI diminishing marginal utility oI wealth.
3. Variability about the possible values oI return is used by investors to measure risk.
4. Investors care only about the means and variance oI the returns oI their portIolios over a
particular period.
5. Expected return and risk as used by investors are measured by the Iirst two moments oI
the probability distribution oI returns-expected value and variance.
6. Return is desirable; risk is to be avoided
1
.
7. Financial markets are Irictionless.
MEASURMEA1 OF RE1URA AAD RISK
Throughout this chapter, investors are assumed to measure the level oI return by computing the
expected value oI the distribution, using the probability distribution oI expected returns Ior a
portIolio. Risk is assumed to be measurable by the variability around the expected value oI the
probability distribution oI returns. The most accepted measures oI this variability are the variance
and standard deviation.
Return
1
Markowitz model assumes that investors are risk averse. This means that given two assets that oIIer the same
expected return, investors will preIer the less risky one. Thus, an investor will take on increased risk only iI
compensated by higher expected returns. Conversely, an investor who wants higher returns must accept more risk. The
exact trade-oII will diIIer by investor based on individual risk aversion characteristics. The implication is that a rational
investor will not invest in a portIolio iI a second portIolio exists with a more Iavorable risk-return proIile - i.e., iI Ior
that level oI risk an alternative portIolio exists which has better expected returns.
Using risk tolerance, we can simple classiIy investors into three types: risk-neutral, risk-averse, and risk-lover.
Risk-neutral investor`s do not require the risk premium Ior risk investments; they judge risky prospects solely by their
expected rates oI return. Risk-averse investors are willing to consider only risk-Iree or speculative prospects with
positive premium; they make investment according the risk-return trade-oII. A risk-lover is willing to engage in Iair
games and gambles; this investor adjusts the expected return upward to take into account the `Iun` oI conIronting the
prospect`s risk.
4
Given any set oI risky assets and a set oI weights that describe how the portIolio investment is
split, the general Iormulas oI expected return Ior n assets is:
1
( )
n
P i i
i
E r wE r
=
=
(X.1)
where:
1
n
i
i
w
=
1.0;
n the number oI securities;
i
w
the proportion oI the Iunds invested in security i;
,
i P
r r
the return on ith security and portIolio p; and
E
the expectation oI the variable in the parentheses.
The return computation is nothing more than Iinding the weighted average return oI the
securities included in the portIolio.
Risk
The variance oI a single security is the expected value oI the sum oI the squared deviations
Irom the mean, and the standard deviation is the square root oI the variance. The variance oI a
portIolio combination oI securities is equal to the weighted average covariance
2
oI the returns on
its individual securities:
2
1 1
Var Cov ,
n n
p p i f i f
i f
r ww r r o
= =
= =
(X.2)
Covariance can also be expressed in terms oI the correlation coeIIicient as Iollows:
Cov ,
i f if i f if
r r p o o o = = (X.3)
where
if
p correlation coeIIicient between the rates oI return on security i,
i
r , and the rates oI return
on security f,
f
r , and
i
o , and
f
o represent standard deviations oI
i
r and
f
r respectively. ThereIore:
1 1
Var
n n
p i f if i f
i f
r ww p o o
= =
=
(X.4)
2
High covariance indicates that an increase in one stock's return is likely to correspond to an increase in the other. A
low covariance means the return rates are relatively independent and a negative covariance means that an increase in
one stock's return is likely to correspond to a decrease in the other.
5
Overall, the estimate oI the mean return Ior each security is its average value in the sample
period; the estimate oI variance is the average value oI the squared deviations around the sample
average; the estimate oI the covariance is the average value oI the cross-product oI deviations.
EFFICIEA1 POR1FOLIO
fficient portfolios may contain any number oI asset combinations. We examine eIIicient
asset allocation by using two risky assets Ior example. AIter we understand the properties oI
portIolios Iormed by mixing two risky assets, it will be easy to see how portIolio oI many risky
assets might best be constructed.
1wo-risky-assets portfolio
Because we now envision Iorming a -portIolio Irom two risky assets, we need to understand
how the uncertainties oI asset returns interact. It turns out that the key determinant oI portIolio risk
id the extent to which the returns on the two assets tend to vary rather in tandem or in opposition.
The degree to which a two-risky-assets portIolio reduces variance oI returns depends on the degree
oI correlation between the returns oI the securities.
Suppose a proportion denoted by
A
w is invested in asset A, and the remainder 1
A
w , denoted
by
B
w , is invested in asset B. The expected rate oI return on the portIolio is a weighted average oI
the expected returns on the component assets, with the same portIolio proportions as weights.
( ) ( ) ( )
P A A B B
E r w E r w E r = + (X.5)
The variance oI the rate oI return on the two-asset portIolio is
2 2 2 2 2 2
( ) 2
P A A B B A A B B A B AB A B
w w w w w w o o o o o p o o = + = + + (X.6)
where
AB
p is the correlation coeIIicient between the returns on asset A and asset B. II the
correlation between the component assets is small or negative, this will reduce portIolio risk.
First, assume that 1.0
AB
p = , which would mean that Asset A and B are perIectly positively
correlated, the right-hand side oI equation X.6 is a perIect square and simpliIies to
2 2 2 2 2
2
2
( )
p A A B B A B A B
A A B B
w w w w
w w
o o o o o
o o
= + +
= +
6
or
p A A B B
w w o o o = +
ThereIore, the portIolio standard deviation is a weighted average oI the component security
standard deviations only in the special case oI perIect positive correlation. In this circumstance,
there are no gains to be had Iorm diversiIication. Whatever the proportions oI asset A and asset B,
both the portIolio mean and the standard deviation are simple weighted averages. Figure X.1 shows
the opportunity set with perIect positive correlation - a straight line through the component assets.
No portIolio can be discarded as ineIIicient in this case, and the choice among portIolios depends
only on risk preIerence. DiversiIication in the case oI perIect positive correlation is not eIIective.
Figure X.1 Investment opportunity sets for asset A and asset B with various correlation coefficients
3
PerIect positive correlation is the only case in which there is no beneIit Irom diversiIication.
With any correlation coeIIicient less than 1.0( 1 p ), there will be a diversiIication eIIect, the
portIolio standard deviation is less than the weighted average oI the standard deviations oI the
component securities. ThereIore, there are beneIits to diversiIication whenever asset returns are less
than perIectly correlated.
Our analysis has ranged Irom very attractive diversiIication beneIits ( 0
AB
p ) to no beneIits at
all 1.0
AB
p = . For
AB
p within this range, the beneIits will be somewhere in between.
Negative correlation between a pair oI assets is also possible. Where negative correlation is
3
The prooIs oI the slope and the shape oI extreme correlation between asset A and asset B are in Appendix A.
0
$tandard Deviation
p
e
c
t
e
d
R
e
t
u
r
n
asset B
asset A
1 p =
0 p =
1 p =
0 1 p
1 p =
7
present, there will be even greater diversiIication beneIits. Again, let us start with an extreme. With
perIect negative correlation, we substitute 1.0
AB
p = in equation X.6 and simpliIy it in the same
way as with positive perIect correlation. Here, too, we can complete the square, this time, however,
with diIIerent results.
2 2
( )
P A A B B
w w o o o =
And, thereIore,
| |
P A A B B
ABS w w o o o = (X.7)
With perIect negative correlation, the beneIits Irom diversiIication stretch to the limit.
Equation X.7 points to the proportions that will reduce the portIolio standard deviation all the way
to zero.
An investor can reduce portIolio risk simply by holding instruments which are not perIectly
correlated. In other words, investors can reduce their exposure to individual asset risk by holding a
diversiIied portIolio oI assets. DiversiIication will allow Ior the same portIolio return with reduced
risk.
1he concept of Markowitz efficient frontier
Every possible asset combination can be plotted in risk-return space, and the collection oI all
such possible portIolios deIines a region in this space. The line along the upper edge oI this region
is known as the eIIicient Irontier. Combinations along this line represent portIolios (explicitly
excluding the risk-Iree alternative) Ior which there is lowest risk Ior a given level oI return.
Conversely, Ior a given amount oI risk, the portIolio lying on the eIIicient Irontier represents the
combination oIIering the best possible return. Mathematically the eIIicient Irontier is the
intersection oI the set oI portIolios with minimum variance and the set oI portIolios with maximum
return.
Figure X.2 shows investors the entire investment opportunity set, which is the set oI all
attainable combinations oI risk and return oIIered by portIolios Iormed by asset A and asset B in
diIIering proportions. The curve passing through A and B shows the risk-return combinations oI all
the portIolios that can be Iormed by combining those two assets. Investors desire portIolios that lie
to the northwest in Figure X.2. These are portIolios with high expected returns (toward the north oI
the Iigure) and low volatility (to the west).
8
Figure X.2 Investment opportunity set for asset A and asset B
The area within curve 'AZ is the Ieasible opportunity set representing all possible portIolio
combinations. PortIolios that lie below the minimum-variance portIolio (point V) on the Iigure can
thereIore be rejected out oI hand as ineIIicient. The portIolios that lie on the Irontier 'A in Figure
X.2would not be likely candidates Ior investors to hold. Because they do not meet the criteria oI
maximizing expected return Ior a given level oI risk or minimizing risk Ior a given level oI return.
This is easily seen by comparing the portIolio represented by points B and B`. Since investors
always preIer more expected return than less Ior a given level oI risk, B` is always better than B.
Using similar reasoning, investors would always preIer B to V because it has both a higher return
and a lower level oI risk. In Iact, the portIolio at point V is identiIied as the minimum-variance
portfolio; since no other portIolio exists that has a lower standard deviation. The curve 'A
represents all possible eIIicient portIolios and is the eIIicient Irontier
4
, which represents the set oI
portIolios that oIIers the highest possible expected rate oI return Ior each level oI portIolio standard
deviation.
4
The eIIicient Irontier will be convex this is because the risk-return characteristics oI a portIolio change in a
non-linear Iashion as its component weightings are changed. (As described above, portIolio risk is a Iunction oI the
correlation oI the component assets, and thus changes in a non-linear Iashion as the weighting oI component assets
changes.) The eIIicient Irontier is a parabola (hyperbola) when expected return is plotted against variance (standard
deviation).
A
Minimum
Variance
PortIolio
(MVP)
0
B
B`
Investment
Opportunity
Set
V
$tandard Deviation
p
e
c
t
e
d
R
e
t
u
r
n
9
Figure X.3 The efficient frontier of risky assets and individual assets
Any portIolio on the down ward sloping potion oI the Irontier curve is dominated by the
portIolio that lies directly above it on the upward sloping portion oI the Irontier curve since that
portIolio has higher expected return and equal standard deviation. The best choice among the
portIolios on the upward sloping portion oI the Irontier curve is not as obvious, because in this
region higher expected return is accompanied by higher risk. The best choice will depend on the
investor`s willingness to trade oII risk against expected return.
Short selling
Various constraints may preclude a particular investor Irom choosing portIolios on the eIIicient
Irontier, however. Short sale restrictions are only one possible constraint. Short sale is a usual
regulated type oI market transaction. It involves selling assets that are borrowed in expectation oI a
Iall in the assets` price. When and iI the price declines, the investor buys an equivalent number oI
assets at the new lower price and returns to the lender the assets that was borrowed.
Now, relaxing the assumption oI no short selling, investors could sell the lowest-return asset B
(here, we assume that ( ) ( ) and
A B A B
E r E r o o > > ). II the number oI short sales is unrestricted,
then by a continuous short selling oI B and reinvesting in A the investor could generate an inIinite
expected return. The eIIicient Irontier oI unconstraint portIolio is shown in Figure X.4. The upper
bound oI the highest-return portIolio would no longer be A but inIinity (shown by the arrow on the
top oI the eIIicient Irontier). Likewise the investor could short sell the highest-return security A and
0
EIIicient Irontier
oI risky assets
$tandard Deviation
p
e
c
t
e
d
R
e
t
u
r
n
Individual assets
Minimum
variance
portIolio
10
reinvest the proceeds into the lowest-yield security B
5
, thereby generating a return less than the
return on the lowest-return assets. Given no restriction on the amount oI short selling, an inIinitely
negative return can be achieved, thereby removing the lower bound oI B on the eIIicient Irontier.
Hence, short selling generally will increase the range oI alternative investments Irom the
minimum-variance portIolio to plus or minus inIinity
6
.
Figure X.4 The efficient frontier of unrestricted/restricted portfolio
Relaxing the assumption oI no short selling in this development oI the eIIicient Irontier
involves a modiIication oI the analysis oI the eIIicient Irontier oI constraint (not allowed short
sales). Next section, we introduce the mathematical analysis oI the eIIicient Irontier with/without
short selling constraints.
Calculating the Minimum variance portfolio
In Markowitz portIolio model, we assume investors choose portIolios based on both expected
return, ( )
p
E r , and the standard deviation oI return as a measure oI its risk,
p
o . So, the portIolio
selection problem can be expressed as maximizing the return with respect to the risk oI the
investment (or, alternatively, minimizing the risk with respect to a given return, hold the return
constant and solve Ior the weighting Iactors that minimize the variance).
5
Rational investor will not short sell a high-return asset and buy a low-return asset. This case is just Ior extreme
assumption.
6
Whether an investor engages in any oI this short-selling activity depends on the investor`s own unique set oI
indiIIerence curves.
0
`
A
P
V
p
e
c
t
e
d
R
e
t
u
r
n
$tandard Deviation
B
without short sales
with short sales
11
Mathematically, the portIolio selection problem can be Iormulated as quadratic program. For
two risky assets A and B, the portIolio consists oI ,
A B
w w , the return oI the portIolio is then, The
weights should be chosen so that (Ior example) the risk is minimized, that is
2 2 2 2 2
Min 2
A
P A A B B A B AB A B
w
w w w w o o o p o o = + +
Ior each chosen return and subject to 1, 0, 0
A B A B
w w w w + = > > . The last two constraints
simply imply that the assets cannot be in short positions.
The minimum variance portIolio weights are shown in Table X.1, the detail prooIs are in
Appendix B.
Table X.1 The mimimum variance portfolio weight of two-assets portfolio without short selling
The correlation oI two assets Weight oI Asset A Weight oI Asset B
p 1
B
A
A B
w
o
o o
=
2
A B
B
A B
w
o o
o o
p -1
B
A
A B
w
o
o o
=
+
A
B
A B
w
o
o o
=
+
p 0
2
2 2
B
A B
A
w
o
o o
=
+
2 2
2 2
2
A B
A B
B
w
o o
o o
=
+
Above, we simply use two-risky-assets portIolio to calculate the minimum variance portIolio
weights. II we generalization to portIolios containing assets, the minimum portIolio weights can
then be obtained by minimizing the Lagrange Iunction Ior portIolio variance.
2
1 1
Min
n n
p i f if i f
i f
ww o p o o
= =
=
Subject to
1 2
... 1
w w w + + + =
1
1 1 1
Cov 1
n n n
i f i f i
i f i
ww rr W 2
= = =
+
= +
' '
(X.8)
in which
1
2 are the Lagrange multipliers, respectively,
if
p is the correlation coeIIicient between
i
r
and
f
r , and other variables are as previously deIined.
By using this approach the minimum variance can be computed Ior any given level oI expected
portIolio return (subject to the other constraint that the weights sum to one). In practice it is best to
12
use a computer because oI the explosive increase in the number oI calculations as the number oI
securities considered grows. The eIIicient set that is generated by the aIorementioned approach
(equation X.8) is sometimes called the minimum-variance set because oI the minimizing nature oI
the Lagrangian solution.
Calculating the weights of optimal risky portfolio
One oI the goals oI portIolio analysis is minimizing the risk or variance oI the portIolio.
Previous section introduce the calculation oI minimum variance portIolio, we minimum the
variance oI portIolio subject to the portIolio weights` summing to one. II we add a condition into
the equation X.8 whish is be subject to the portIolio`s attaining some target expected rate oI return,
we can get the optimal risky portIolio.
2
1 1
Min
n n
p i f if i f
i f
WW o p o o
= =
=
Subject to
*
1
n
i i
i
W E R E
=
=
, where
*
E is the target expected return and
1
1.0
n
i
i
W
=
=
The Iirst constraint simply says that the expected return on the portIolio should equal the target
return determined by the portIolio manager. The second constraint says that the weights oI the
securities invested in the portIolio must sum to one.
The Lagrangian objective Iunction can be written:
*
1 2
1 1 1 1
Cov 1
n n n n
i f i f i i i
i f i i
ww rr E wE r w 2 2
= = = =
+
= + +
| ' '
(X.9)
Taking the partial derivatives oI this equation with respect to each oI the
variables,
1 2
, ,....,
w w w
1 2
, , 2 2 and setting the resulting equations equal to zero yields the
minimization oI risk subject to the Lagrangian constraints. Then, we can solve the weights and
these weights are represented optimal risky portIolio by using oI matrix algebra.
II there no short selling constraint in the portIolio analysis, second constraint,
1
1.0
n
i
i
w
=
=
,
13
should substitute to
1
1.0
n
i
i
w
=
=
= (X.12)
For the portIolio with two risky assets, the expected return and standard deviation oI portIolio
S are
( ) ( ) ( )
P A A B B
E r w E r w E r = + (X.5)
2 2 2 2 1/ 2
( 2 )
P A A B B A B AB A B
w w w w o o o p o o = + + (X.13)
0
B
A
$tandard Deviation
p
e
c
t
e
d
R
e
t
u
r
n
Minimum
variance
portIolio EIIicient
Irontier oI
risky assets
1
U
2
U
16
When we maximize the objection Iunction,
S
AL , we have to satisIy the constraint that the
portIolio weights sum to 1. ThereIore, we solve a mathematical problem Iormally written as
( )
i
p f
S
w
p
E r r
AL
Max
o
=
Subject to 1
i
w =
.In this case oI two risky assets, the solution Ior the weights oI the optimal
risky portfolio S, can be shown to be as Iollows
7
:
2
2 2
| ( ) | | ( ) |
| ( ) | | ( ) | | ( ) ( ) |
1
A f B B f AB A B
A
A f B B f A A f B f AB A B
B A
E r r E r r
w
E r r E r r E r r E r r
w w
o p o o
o o p o o
=
+ +
=
Then, we Iorm an optimal complete portIolio
8
given an optimal risky portIolio and the CAL
generated by a combination oI portIolio S and risk-Iree asset. We have constructed the optimal
portIolio S, we can use the individual investor`s degree oI risk aversion, A, to calculate the optimal
proportion oI complete portIolio to invest in the risky component.
Assuming that a risk-Iree rate is
f
r , and a risky portIolio with expected return ( )
p
E r and
standard deviation
p
o will Iind that, Ior any choice oI , the expected return oI the complete
portIolio is
( ) | ( ) |
f p f
E r r E r r = +
The variance oI the overall portIolio is
2 2 2
p
o o =
The investor attempts to maximum utility, U, by choosing the best allocation to the risky asset,
. To solve the utility maximization problem more generally, we write the problem as Iollows:
2
y
2 2
U ( ) 0.005
| ( ) | 0.005
Max
f p f p
E r A
r E r r A
o
o
= +
Setting the derivative oI this expression to zero, we can solve Ior yield the optimal
7
The solution procedure Ior two risky assets is as Iollows. Substitute Ior expected return Irom equationX.5 and Ior
standard deviation Irom equation X.13. Substitute 1
A
w Ior
B
w . DiIIerentiate the resulting expression Ior Sp with
respect to
A
w , set the derivative equal to zero, and solve Ior
B
w .
8
The complete portIolio means that the entire portIolio including risky and risk-Iree assets.
17
position Ior risk-averse investors in the risky asset,
*
, as Iollows:
*
2
( )
0.01
p f
p
E r r
Ao
= (X.14)
The solution shows that the optimal position in the risky asset is, as one would expect,
inversely proportional to the level oI risk aversion and the level oI risk (measured by the variance)
and directly proportional to the risk premium oIIered by the risky asset.
Once we have reached this point, generalizing to the case oI many risky assets is
straightIorward. BeIore we move on, let us brieIly summarize the steps we Iollowed to arrive at the
complete portIolio.
1. SpeciIy the return characteristics oI all securities (expected returns, variances,
covariances).
2. Establish the risky portIolio:
a. Calculate the optimal risky portIolio S.
b. Calculate the properties oI portIolio S using the weights determined in step and
equations X.5 and X.13.
3. Allocation Iunds between the risky portIolio and the risk-Iree asset:
a. Calculate the Iraction oI the complete portIolio allocated to PortIolio S (the risky
portIolio) and to risk-Iree asset (equation X.14).
b. Calculate the share oI the complete portIolio invested in each asset and in risk-Iree
asset.
Figure X.7 Determination of the optimal portfolio
IndiIIerence Curve
Opportunity Set oI Risky
Assets
Optimal
Complete
PortIolio
CAL
0
Optimal Risky PortIolio
$tandard Deviation
p
e
c
t
e
d
R
e
t
u
r
n
f
r
18
In practice, when we try to construct optimal risky portIolios Irom more than two risky assets
we need to rely on MicrosoIt EXCEL or another computer program. We present can be used to
construct eIIicient portIolios oI many assets in the next section.
AL1ERAA1I'E COMPU1ER PROCAME 1O CALCULA1E EFFICIEA1 FROA1IER
Several soItware packages can be used to generate the eIIicient Irontier. In this section, we will
demonstrate the method using MicrosoIt Excel and MATLAB.
Application: Microsoft Excel
Excel is Iar Irom the best program Ior generating the eIIicient Irontier and is limited in the
number oI assets it can handle, but working through a simple portIolio optimizer in Excel can
illustrate concretely the nature oI the calculations used in more sophisticated black-box` programs.
You will Iind that Excel, the computation o the eIIicient Irontier is Iairly easy.
Assume an American investor who Iorms a six-stock-index portIolio. The portIolio consists oI
six stock indexes: United State (S&P500), United Kingdom (FTSE100), Switzerlan (Swiss Market
Index, SMI) ,Singapore (Straits Times Index, STI), HongKong (Hang Seng Index, HSI) , and Korea
(Korea Composite Stock Price Index, KOSPI), with monthly price data Irom Jan. 1990 to Dec. 2006.
He/she wants to know his/her optimal portIolio allocation.
The Markowitz portIolio selection problem can be divided into three parts. First, we need to
calculate the eIIicient Irontier. Secondly, we need to choose the optimal risky portIolio given one`s
capital allocation line (Iind the point at the tangent oI a CAL and the eIIicient Irontier). Finally,
using the optimal complete portIolio allocate Iunds between the risky portIolio and the risk-Iree
asset.
$tep one: Finding efficient frontier
First, we need to calculate expected return, standard deviation, and covariance matrix. The
expected return and standard deviation can been calculated by applying the Excel STDEV and
AVERAGE Iunctions to the historic monthly percentage returns data
9
. Table X.2A and B shows
average returns, standard deviations, and the correlation matrix
10
Ior the rates oI return on the stock
9
The expected return and standard deviation oI each index need to be annualized.
10
The correlation matrix is calculated in Excel using the data analysis Iunction that is Iound under the Tool Menu. Note
iI Data Analysis does not appear on the Tool Menu you will need to select Add-in and add to the Menu.
19
index. AIter we input Table X.2A into our spreadsheet as shown, we create the covariance matrix in
Table X.2B using the relationship ( , )
i f if i f
ov r r p o o = .
Table X.2 Performance of si stock indees
20
Table X.2 (Concluded)
21
Table X.2 (Concluded)
BeIore computing oI the eIIicient Irontier, we need to prepare the data to establish a
benchmark against which to evaluate our eIIicient portIolios, we can Iorm a border-multiplied
covariance matrix. We use the target mean oI 15 Ior example. To compute the target portIolio`s
mean and variance, these weights are entered in the border column B49-B54 and border row
C48-H48. We calculate the variance oI this portIolio in cell C56 in Table X.2D. The entry in C56
equals the sum oI all elements in the border-multiplied covariance matrix where each element is
Iirst multiplied by the portIolio weights given in both the row and column borders. We also include
two cells to compute the standard deviation and expected return oI the target portIolio (Iormulas in
cells C57, C58)
11
.
To compute points along the eIIicient Irontier we use the Excel Solver in Table X.2D (which
you can Iind in the Tools menu)
12
. Once you bring up Solver, you are asked to enter the cell oI the
target (objective) Iunction. In our application, the target is the variance oI the portIolio, given in cell
C56. Solver will minimize this target. You next must input the cell range iI the decision variables
( in this case, the portIolio weights, contained in cells B49-B54). Finally, you enter all necessary
constraints into the Solver. For an unrestricted eIIicient Irontier that allows short sales, there are two
constraints: Iirst, that the sum oI the weights1.0 (cell B551), and second, that the portIolio
11
Because the expected returns and the portIolio weights are represented by column vectors (denoted
e
and
w
respectively, with row vector transposes
T
e
and
T
w
), and the variance-covariance terms by matrix
J
, then
the expressions can be written as simple matrix Iormulas. So, the calculation oI expected return and variance oI
portIolio can use the Excel array Iunctions.
Matrix notation Excel Iormula:
PortIolio return:
T
w e SUMPRODUCT(w,e)
PortIolio variance:
T
w Jw MMULT(TRANSPOSE( ),MMULT( , )) w J w
12
II Solver does not show up under the Tools menu, you should select Add-Ins and then select Analysis. This should
ass Solver to the list oI options in the Tools menu.
22
expected return equals target return 15 (cell B5815)
13
. Once you have entered the two
constraints you ask the Solver to Iind the optimal portIolio weights.
The Solver beeps when it has Iound a solution and automatically alters the portIolio weight
cells in row 48 and column C to show the makeup oI the eIIicient portIolio. It adjusts the entries in
the border-multiplied covariance matrix to reIlect the multiplication by these new weights, and it
shows the mean and variance oI this optimal portIolio-the minimum variance portIolio with mean
return oI 15. These results are shown in Table X.2D, cells C56-C58. You can Iind that they yield
an expected return oI 15 with a standard deviation oI 17.11 (results in cells C58 and C57). To
generate the entire eIIicient Irontier, keep changing the required mean in the constraint (cell C58),
letting the Solver work Ior you. II you record a suIIicient number oI points, you will be able to
generate a graph oI the quality oI Figure X.8.
II short selling is not allowed, the Solver also allows you to all 'no short sales and other
constrains easily. We need to impose the additional constraints that each weight (the elements in
column B and row 49) must be nonnegative. Once they are entered, you repeat the
variance-minimization exercise until you generate the entire restricted Irontier. The outer Irontier in
Figure X.8 is drawn assuming that the investor may maintain negative portIolio weights, the inside
Irontier obtained allowing short sales. Table X.2 E and F present a number oI points on the two
Irontiers with and without short sales. You can see that the weights in restricted portIolios are never
negative. The minimum variance portIolios in two Irontiers are not the same.
BeIore we move on, let us summarize the steps oI using Solver to calculate the
variance-minimization portIolio.
The steps with Solver are:
1. Invoke Solver by choosing Tools then Options then Solver.
2. SpeciIy in the Solver parameter Dialog Box: the Target cell to be optimized speciIy max
or min
3. Choose Add to speciIy the constrains then OK
4. Solve and get the results in the spreadsheet.
13
II you do not set the second constraint: target mean equal to 20, then you can the minimum variance portIolio. The
minimum variance portIolio has 18.637 expected return and a standard deviation oI 15.643.
23
Figure X.8 fficient frontier of unrestricted and restricted portfolio
Portfolio fficient Frontier
0
5
10
15
20
25
30
0 5 10 15 20 25 30 35
PortIolio Risk ()
P
o
r
t
I
o
l
i
o
R
e
t
u
r
n
(
)
Restricted Unrestricted S&P 500 FTSE100 SMI STI HSI KOSPI
$tep two: Finding optimal risky portfolio
Now that we have the eIIicient Irontier, we proceed to step two. In order to get the optimal
risky portIolio, we should Iind the portIolio on the tangency point oI capital allocation and eIIicient
Irontier. To do so, we can use the Solver to help us. First, you enter the oI the target Iunction,
'maximum the reward-to-variability ratio (
( )
p f
p
E r r
o
and the
optimal position oI risk-Iree asset is 1-
2
( )
0.01
p f
p
E r r
Ao
=
+
* *
1
B A
w w =
Case one: Two assets are perIectly position correlated
II short sales are allowed, then even though 1 p =
Selling short asset A and go extra long in asset B
12
II 1, p = +
2 2
2
*
( ) ( ) (1 ) ( )
| (1 ) |
| (1 ) |
: 0
( )
, ( ) ( )
( )
( )
( ) ( )
p A A A B
p A A A B
p A A A B
p
B
A
A A B
p p
A B A B
A A
p
p
A A B
p
p A B
A
E R w E r w E r
w w
w w
MJP w
w
E R
E r E r
w w
E R
E R
w E r E r
w
o o o
o o o
o
o
o o
o
o o
o
o o o
= +
= +
= +
= =
= =
= = +
35
Case Two: Two assets are perIectly negative correlated
Just invest both asset A and b (both in long position)
12
II 1, p =
2 2
2
*
* 2
*
* *
( ) ( ) (1 ) ( )
| (1 ) |
| (1 ) |
: 0
a. 0
b.
2
2
2
( ) 0
| (1 ) | (
p A A A B
p A A A B
p A A A B
p
B
A
A A B
A A p
A A
B
A A A
A B
B
p A B B B
A B
p A A A B A
E R w E r w E r
w w
w w
MJP w
w
w w
w w
Let w w w
w w w
o o o
o o o
o
o
o o
o
o
o o
o
o o o o o
o o
o o o
= +
=
=
= =
+
= =
>
= = >
+
= + = >
+
= + =
*
*
* *
)
| (1 ) |
( )
( )
( ) ( )
c.
0.5
0.5
0.5
( ) 0.5 0
| (1
A B B
A A
p A A A B
p
p p
A A B
A B
p
A p B B
A
A A
B
A A A
A B
B
p A B B B
A B
p A A A
when w w
w w
E R
E R
w E r E r
w
w
w w
Let w w w
w w
o o o
o o o
o
o o
o
o o o
o
o o
o
o o o o o
o o
o o
+
>
= +
+
= + = = = +
+ +
= =
+
= + =
+
=
*
) | | ( ) |
| |
( )
( )
( ) ( )
( )
B A A B B
A A
p A A B A B
p
p p
A A B
A B
p
A p A B
A
w
when w w
w w
E R
E R
w E r E r
w
w
o o o o
o o o o
o
o o
o
o o o
= +
= +
+
= + = = =
36
Appendi B
The weights oI minimum variance portIolio
The weights should be chosen so that (Ior example) the risk is minimized, that is
2 2 2 2 2
Min 2
A
P A A B B A B AB A B
w
w w w w o o o p o o = + +
Ior each chosen return and subject to 1, 0, 0
A B A B
w w w w + = > > . The last two constraints simply
imply that the assets cannot be in short positions.
Substitute
( , )
A B
AB
A B
ov r r
p
o o
=
2
2 2 2
2 2 2 2 4
P
A A B A B AB A B A AB A A
A
w w w
w
o
o o o p o o p o o
= + +
2 2 2
2 ( 2 ) 2 2 0
A A B AB A B B AB B A
w o o p o o o p o o + =
2
2 2
2
B AB A B
A
A B AB A B
w
o p o o
o o p o o
=
+
1
B A
w w =
When p 1
B
A
A B
w
o
o o
=
2
A B
B
A B
w
o o
o o
When p -1
B
A
A B
w
o
o o
=
+
A
B
A B
w
o
o o
=
+
When p 0
2
2 2
B
A B
A
w
o
o o
=
+
2 2
2 2
2
A B
A B
B
w
o o
o o
=
+