% Markowitz's
MV Model
% Created:
% Last revision:
function [w,obj,exprf,risk] = markowitz(exnum)
% risk taking coefficient
tau
= 0.1;
switch exnum
case 1
clear mean std CorMat CovMat w;
%Watson & Wyatt 2002 Asset Model
numinvestments
= 13;
% USlrg
USsm Intuhed Inthed EME PE HedFun Real Bonds HYBonds IntBondUHed IntBondHed Cash
% USLrg
USSm IntS1 IntS2 EME
PE HedFd
Real Bonds HYBds
IBUH IBHed
Cash
mean = [ 1.095
1.102 1.100 1.094 1.121 1.120 1.080 1.070 1.064 1.090 1.062 1.055 1.042 ];
std = [
.161 .214 .187
.157 .362 .299
.1 .1 .068
.143 .111 .045
.029 ];
CorMat = [ 1.00
0.76 0.68 0.80
0.46 0.56 0.47
0.37 0.47 0.08
0.19 0.62 0.05
0.76
1.00 0.52 0.61
0.35 0.43 0.36
0.28 0.36 0.06
0.14 0.47 0.03
0.68
0.52 1.00 0.86
0.49 0.49 0.41
0.11 0.27 0.57
0.31 0.54 0.12
0.80
0.61 0.86 1.00
0.49 0.57 0.48
0.15 0.32 0.14
0.29 0.63 0.14
0.46 0.35 0.49 0.49 1.00 0.33
0.28 0.06 0.16
0.19 0.14 0.36
0.07
0.56
0.43 0.49 0.57
0.33 1.00 0.34
0.11 0.21 0.04
0.09 0.45 -0.01
0.47
0.36 0.41 0.48
0.28 0.34 1.00
0.09 0.18 0.04
0.08 0.38 0.01
0.37
0.28 0.11 0.15
0.06 0.11 0.09
1.00 0.50 0.14
0.41 0.12 -0.17
0.47
0.36 0.27 0.32
0.16 0.21 0.18
0.50 1.00 0.12
0.31 0.23 -0.05
0.08
0.06 0.57 0.14
0.19 0.04 0.04 0.14
0.12 1.00 0.52
0.04 0.12
0.19
0.14 0.31 0.29
0.14 0.09 0.08
0.41 0.31 0.52
1.00 0.10 0.32
0.62
0.47 0.54 0.63
0.36 0.45 0.38
0.12 0.23 0.04
0.10 1.00 0.00
0.05 0.03
0.12 0.14 0.07 -0.01
0.01 -0.17 -0.05 0.12 0.32
0.00 1.00];
%
case 2
clear mean std CorMat CovMat w;
%Watson & Wyatt 2003 Asset Model - page
6 of K. David Jamison's notes
numinvestments
= 11;
% USlrg
USsm Intuhed Inthed EME PE HedFun Real Bonds HYBonds IntBondUHed IntBondHed Cash
% LgMCS
SmCS IntS1 EMStk Real FixIn LTGBd HiYBd TIPS IntB1 Cash
mean = [ 1.095
1.105 1.103 1.127 1.086 1.047 1.060 1.080 1.045 1.050 1.035];
std = [
.172 .223 .196
.326 .150 .072
.108 .140 .061
.110 .021];
CorMat = [ 1.00
0.76 0.68 0.43
0.49 0.33 0.41
0.56 -0.11 0.08 0.03
0.76 1.00
0.52 0.32 0.56
0.26 0.33 0.34 -0.15
0.06 0.02
0.68 0.52
1.00 0.46 0.39
0.11 0.14 0.40 -0.26
0.54 0.12
0.43 0.32
0.46 1.00 -0.06 -0.06 0.02
0.15 -0.04 0.18 0.04
0.49 0.56
0.39 -0.06 1.00 0.22
0.25 0.05 -0.08 0.08 -0.04
0.33 0.26
0.11 -0.06 0.22 1.00
0.97 0.46 0.28
0.22 -0.05
0.41 0.33
0.14 0.02 0.25
0.97 1.00 0.47
0.21 0.22 -0.13
0.56 0.34
0.40 0.15 0.05
0.46 0.47 1.00 -0.08
0.13 -0.08
-0.11 -0.15 -0.26 -0.04 -0.08 0.28 0.21 -0.08
1.00 -0.22 0.26
0.08 0.06
0.54 0.18 0.08
0.22 0.22 0.13 -0.22
1.00 -0.10
0.03 0.02
0.12 0.04 -0.04 -0.05 -0.13
-0.08 0.26 -0.10 1.000];
%
case 3
clear mean std CorMat CovMat w;
% Portfolio Selection - Chapter 8, page 375
% US Cash, US Bonds, Japan Bonds, Euro
Bonds, US Equity, Japan Equity, Euro Equity
numinvestments
= 7;
% Mean data taken from page 389 except for
US Cash which is taken from Watson&Wyatt above
% USCash
USBnd JapanB EuroB USEqui JapanE EuroEq
mean = [1.0420 1.065 1.060
1.055 1.095 1.095 1.095];
std = [ 0.500 5.230 14.660 12.520 14.450 26.190
17.060];
CorMat = [ 1.000 0.200 -0.040
0.120 0.080 -0.020 0.120
0.200 1.000 0.220
0.340 0.330 0.130
0.300
-0.040 0.220 1.000
0.680 -0.070 0.530 0.300
0.120 0.340 0.680
1.000 -0.040 0.380 0.510
0.080 0.330 -0.070 -0.040 1.000 0.210
0.610
-0.020 0.130 0.530
0.380 0.210 1.000
0.490
0.120 0.300 0.300 0.510
0.610 0.490 1.000];
case 4
clear mean std CorMat CovMat w;
% Michaud, "Efficient
Asset Management" Chapter 2, pages 17, 19
% January 1978 - December
1995 Correlations
%
numinvestments = 8;
% Mean data taken from page
17 times 12 + 1.000; SD is time sqrt(12)
%
mean = [ 1.0468
1.1056 1.0636 1.1056
1.0948 1.0852 1.0300
1.0324];
std = [19.0500 24.3500 21.5500 24.3900 20.8200
14.9000 6.9600 5.4000];
CorMat = [ 1.00 0.41 0.30
0.25 0.58 0.71
0.26 0.33
0.41 1.00
0.62 0.42 0.54
0.44 0.22 0.26
0.30 0.62
1.00 0.35 0.48
0.34 0.27 0.28
0.25 0.42
0.35 1.00 0.40
0.22 0.14 0.16
0.58 0.54
0.48 0.40 1.00
0.56 0.25 0.29
0.71 0.44
0.34 0.22 0.56
1.00 0.36 0.42
0.26 0.22
0.27 0.14 0.25
0.36 1.00 0.92
0.33 0.26
0.28 0.16 0.29
0.42 0.92 1.00];
otherwise
out = 'exnum not valid'
exnum
end % end case of exnum
for i = 1:numinvestments
for j = 1:numinvestments
%
NOTE: MATLAB QP minimizes
CovMat(i,j)= std(i)*std(j)*CorMat(i,j);
end %for j
end %for i
%CovMat
%pause
% Constraint matrix - sum
of investment portion is 1 and weights must be >= 0
for i = 1:numinvestments
A(1,i) = 1.0;
Aeq(1,i)
= 1.0;
vlb(i,1)
= 0.0;
vub(i,1)
= 1.0;
w0(i,1) =
1/numinvestments;
%
Linear terms - MATLAB minimizes and we want to maximize the means
f(i,1) = -2*tau*mean(i);
%f(i,1) = 0;
plusminus = -1;
end %for i
b(1,1) = 1;
beq(1,1) = 1;
% Call the qp solver and return minus the
objective function
[w,z] = quadprog(CovMat,f,[],[],Aeq,beq,vlb,vub,w0);
%[w,z]
= quadprog(CovMat,f,A,b,[],[],vlb,vub,w0);
obj
= plusminus*z;
exprf
= mean*w;
risk = w'*CovMat*w;