Vmls Slides Lect17
Vmls Slides Lect17
Portfolio optimization
Vt+1 = V1 (1 + r1 )(1 + r2 ) · · · (1 + rt )
I define T ⇥ n (asset) return matrix, with Rtj the return of asset j in period t
I row t of R is r̃tT , where r̃t is the asset return vector over period t
I if last asset is risk-free, the last column of R is µrf 1, where µrf is the
risk-free per-period interest rate
I risk is std(r)
VT+1 = V1 (1 + r1 ) · · · (1 + rT )
⇡ V1 + V1 (r1 + · · · + rT )
= V1 + T avg(r)V1
I mean return and risk are often expressed in annualized form (i.e., per year)
(the squareroot in risk annualization comes from the assumption that the
fluctuations in return around the mean are independent)
I . . . and hope it will work well going forward (just like data fitting)
I we are really asking what would have been the best constant allocation,
had we known future returns
26 w 37 26 2RT R 1 µ 37 1 26 2⇢T µ 37
66 z 77 = 66 1T 77 66 1 77
66 1 77 66 0 0 77 66 77
4 z2 5 4 µ 5 4 ⇢ 5
T 0 0
26 w 37 26 2RT R 1 µ 37 1 26 0 37 26 2RT R 1 µ 37 1 26 2T µ 37
66 z 77 = 66 1T 77 66 1 77 + ⇢ 66 1T 77 66 0 77
66 1 77 66 0 0 77 66 77 66 0 0 77 66 77
4 z2 5 4 µ 5 4 5 4 µ 5 4 1 5
T 0 0 0 T 0 0
0.4
Annualized return
0.3
0.2
0.1
0
risk-free asset
0.4
Annualized return
0.3
0.2
0.1
1/n
0
Return Risk
Portfolio Train Test Train Test Leverage
risk-free 0.01 0.01 0.00 0.00 1.00
⇢ = 10% 0.10 0.08 0.09 0.07 1.96
⇢ = 20% 0.20 0.15 0.18 0.15 3.03
⇢ = 40% 0.40 0.30 0.38 0.31 5.48
1/n (uniform weights) 0.10 0.21 0.23 0.13 1.00
Train Test
18
150
Risk-free
Value (thousand dollars)
1/n 16
10%
100 20%
14
40%
50 12
10 10
0 400 800 1200 1600 2000 0 100 200 300 400 500
Day Day
Portfolio optimization
xt+1 = At xt + Bt ut , yt = Ct xt , t = 1, 2, . . .
I can be written as
minimize k Ãz b̃k 2
subject to C̃z = d̃
I vector z contains the Tn + (T 1)m variables:
z = (x1 , . . . , xT , u1 , . . . , uT 1 )
26 C1 ··· 0 0 ··· 0 37
66 .. .. .. .. 77
66 77
.. ..
. . . . . .
66 0 ··· CT 0 ··· 0 77
à = 66 7,
0 77
p b̃ = 0
66 0 ··· 0 ⇢I ···
66 .. .. .. .. 77
. 77
.. ..
66 . . . . .
⇢I 75
p
4 0 ··· 0 0 ···
66
I 0 0 ··· 0 0 0 0 ··· 0 77 66 7
4 0 0 0 ··· 0 I 0 0 ··· 0 75 4 xdes 75
I T = 100
4.4
4.2
⇢=1
Joutput
⇢ = 0.2
3.8
⇢ = 0.05
3.6
0 1 2 3 4
Jinput
0.5 0.4
⇢ = 0.05 0 0.2
ut
yt
0.5 0
0 20 40 60 80 100 0 20 40 60 80 100
0.5 0.4
⇢ = 0.2 0 0.2
ut
yt
0.5 0
0 20 40 60 80 100 0 20 40 60 80 100
0.5 0.4
⇢=1 0 0.2
ut
yt
0.5 0
0 20 40 60 80 100 0 20 40 60 80 100
t t
Introduction to Applied Linear Algebra Boyd & Vandenberghe 17.24
Linear state feedback control
ut = Kxt , t = 1, 2, . . .
I one choice for K : solve linear quadratic control problem with xdes = 0
I solution ut is a linear function of xinit , so u1 can be written as
u1 = Kxinit
0.1 0.4
State feedback
0 Optimal
ut
0.2
yt
Optimal
State feedback
0.1
0
0 50 100 150 0 50 100 150
t t
Portfolio optimization
xt+1 = At xt + Bt wt , yt = Ct xt + vt , t = 1, 2, . . .
I xt is state (n-vector)
I yt is measurement (p-vector)
I wt is input or process noise (m-vector)
I vt is measurement noise or measurement residual (p-vector)
I we know At , Bt , Ct , and measurements y1 , . . . , yT
I can be written as
minimize k Ãz b̃k 2
subject to C̃z = d̃
I vector z contains the Tn + (T 1)m variables:
z = (x1 , . . . , xT , w1 , . . . , wT 1 )
26 C1 0 ··· 0 0 ··· 0 37 26 y1 37
66 0 C2 0 0 0 77 66 77
66 77 66 77
··· ··· y2
66 .. .. ..
.
.. .. .. 77 66 .. 77
6 77 6 77
. . . . . .
à = 66 0 0 ··· CT 0 ··· 0 77 , b̃ = 66 yT 77
66 p
77 66 77
66 0 0 ··· 0 I ··· 0
77 66 0
77
66 .. .. .. .. .. ..
77 66 ..
77
66 66
. . . . .
p. .
4 0 0 ··· 0 0 ··· I 75 4 0 75
26 A1 I 0 ··· 0 0 B1 0 ··· 0 37
66 77
C̃ = 666 77 ,
0 A2 I ··· 0 0 0 B2 ··· 0
66
.. .. .. .. .. .. .. .. .. 77 d̃ = 0
77
. . . . . . . . .
64 0 0 0 ··· AT 1 I 0 0 ··· BT 1 5
26 37 26 37
6
1 0 1 0
77 6
0 0
77 " #
At = 666 Bt = 666
0 1 0 1 0 0 1 0 0 0
77 , 77 , Ct =
66 0 0 1 0 77 66 1 0 77 0 1 0 0
4 0 0 0 1 5 4 0 1 5
0
t=1
500
(xt )2
1000
1500 t = 100
=1 = 103 = 105
I randomly remove 20% (say) of the measurements and use as test set
80
60
RMS error
Test
40
20
Train
0
10 3 10 1 101 103 105