Assignment 3
Assignment 3
Optimization I /MN 1
Martin Berggren
Uppsala University
Information Technology
Scientific Computing
To do
1. Formulate the linear program of maximizing the expected return of the portfolio when short selling is
not allowed. Solve the linear program by inspection (that is, do not use software or hand calculation).
What is the variance of the portfolio?
2. Formulate the quadratic program of minimizing the variance of the portfolio (short selling allowed).
Set up the KKT system and solve it using Matlab. Report the computed weights and the variance of
corresponding portfolio and compare with 1.
Table 1: Covariances and rates of returns for five assets. Note that the numberis in the table should be multiplied with
. For instance, r = . and = .. These values are borrowed from Example 6.11 of Chapter 6 in Luenberger:
Investment Science, Oxford Univ. Press (1997).
Asset
Covariances ( )
. . . .
. . .
.
. .
.
. .
.
ri ()
.
.
.
.
.
Note that Matlab can handle block matrices. Assume that A is an n-by-n matrix and b a column vector
of dimension n, and that these can be blocked as
A=
A
A
A
,
A
b
b = ,
b
where
matrix A has as many rows as matrix A and matrix A has as many rows as matrix A ,
matrix A has as many columns as matrix A and matrix A has as many columns as matrix A ;
both b and b are column vectors.
Then Matlab matrices A and b can be specified as
A = [A_11, A_12; A_21; A_22];
b = [b_1; b_2];
where A_11, A_12, A_21, A_22, b_1, and b_2 are previously defined matrices with dimensions that
match as above. Note that elements on the same row are separated with , (a separating space is also
OK), whereas a new row is indicated by ; (inserting a new row by pressing the return key is also OK).
3. An extremely risk averse investor would choose the strategy in 2 whereas an extremely risk preferring
investor would choose the strategy in 1. Most investors choose a strategy in between these extremes.
For instance, if an investor requires a particular expected rate of return r, it make sense to calculate the
particular portfolio that meets that goal at the minimum variance. Formulate the quadratic program
that minimizes the portfolio variance, subject to a precise value r of the expected rate of return for the
portfolio. Formulate the problem both for the case when short selling is and is not allowed.
4. Let and r be the portfolio variance and expected rate of return calculated as in 3 above. The efficient
frontier is the set of all possible pairs (, r). A good way of computing the efficient frontier is to solve,
for a parameter B B , the quadratic program
n
n n
min Q Q wi w ji j ( ) Q ri wi
i= j=
i=
n
(1)
i=
wi C , for i = , . . . , n.
(a) Which cases do the extreme values = and = correspond to?
(b) Solve (1) for = ., ., ., . . . , . using quadprog, both for the case when short selling is and
is not allowed. Plot and compare the efficient frontiers.