Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

STAD70 Statistics & Finance II

Assignment 4

Include your codes in your submission.

1.  Consider the problem of finding a growth optimal portfolio b*  which maximizes the ob- jective function

V (b) = log bx┐ ,    b | ∆h .

In this problem we consider a variant of the stochastic gradient descent algorithm on the simplex.

(a) Let f  :  (0, 4)h   小 4 be a differentiable function,  and let b  | ∆h.   Define the

gradient vf(b) = ╱  , . . . , T . Consider

f(b) = vf(b) k  (lT vf(b))l,

where l =  (1, . . . , 1)T .   Note that  lf(b) = 0.   Draw a figure to visualize this definition when m = 2, f(b) = |b|2  and b = ( , ).

(b) Fix b | ∆h  and a vector v such that lTv = 0.  Geometrically, this means that v is parallel to the simplex.  Think of v as the direction of ascent, and let γ > 0 be the step size.  Consider  = b + γv.  It is possible that   ∆h, but there exists a maximal t*  | [0, 1] such that

b + t* γv | ∆h .

Write an R function modified update(b,  v,  gamma) that computes t*  and returns the update  .

Hint: For the i-th component, the condition means that

0 台 b; + tγv;  台 1.

This gives a range for t. The desired quantity t*  corresponds to the intersection over i = 1, . . . , m.

(c)  Suppose we can sample from x. Our modified stochastic descent algorithm is b(A+1) = b(A) + t γA(*) A  ╱  k   l\ | ∆h ,

where tA(*)  is computed using (b).  Implement the algorithm for the following distri- butions and report the corresponding growth optimal portfolios.  You may need to experiment a bit to find a (possibly time-dependent) step size that works.


(i) m = 3, x = (X1, X2 , X3 )T . Assume that the random vector (log X1 , log X2 , log X3) is normally distributed with mean vector (0.02, 0.03, 0.01) and covariance matrix

 

Σ =  ┌ '0.001


0.002

0.082

k0.001


0.072  , .


(ii) m  =  10,  x  =  (X1, . . . , X10 )T .   Assume the X;’s are independent,  and X;  is exponentially distributed with rate 3 +  .

2.  Consider weekly returns of the stocks JPM, GS and WFC from January 1, 2000 to December 31, 2021. In this problem, we implement Cover’s universal portfolio for these three stocks. To approximate the integral over the simplex, we consider a uniform grid on the simplex: The grid is for (θ1 , θ2 ), and θ3 = 1 k θ 1 k θ2 .

 

0.0                   0.2                   0.4                   0.6                   0.8                   1.0

 

To get you started we provide the code used to generate the grid:

N  <-  20    #  fixed

plot(NULL,  NULL,  xlim  =  c(0,  1),  ylim  =  c(0,  1),

xlab  =  "",  ylab  =  "")

segments(0,  0,  1,  0)

segments(0,  0,  0,  1)

segments(1,  0,  0,  1)

for  (i  in  0:N)  {

for  (j  in  0:(N  -  i))  {

points(i/N,  j/N)

}

}

To implement the universal portfolio, you need to keep track of the value of the constant rebalanced portfolio corresponding to each grid point. (In the lecture notes we implemented this when m = 2.)

Implement the universal portfolio and report the following:


(a)  Draw the trajectory of 9 t(*)  (in the simplex) over time, where 9 t(*)  is the weight vector which achieves Vt* = maxθ Vtθ .

(b)  Draw the trajectory of t  (in the simplex) over time.

(c)  The time series of Vt*  and t .

(d)  The time series of  log  .

Remark:  This is to illustrate the kind of graphs expected for (a) and (b).  You can use other formats and colours to improve the presentation.

#  example  of  a  path  in  the  simplex  (in  terms  of  the  first  two  coordinates) sample_path  <- matrix(c(1/3,  1/3,

0.2,  0.4,

0.1,  0.5,

0.25,  0.3,

0.5,  0.2,

0.6,  0.15),  byrow  =  TRUE,  ncol  =  2)

 

plot(NULL,  NULL,  xlim  =  c(0,  1),  ylim  =  c(0,  1),

xlab  =  "",  ylab  =  "")

segments(0,  0,  1,  0)

segments(0,  0,  0,  1)

segments(1,  0,  0,  1)

points(sample_path[,  1],  sample_path[,  2],  type  =  "b")

0.0                   0.2                   0.4                   0.6                   0.8                   1.0

 

 

3.  Consider weekly log returns of the S&P500 from Jan 1, 2000 to Dec 31, 2020. Use the first half as training data; the rest is used for testing.

(a) Using the training data, fit (i) an ARMA-GARCH model, and (ii) a plain ARMA model, both with Gaussian conditional distribution (i.e., εt is a Gaussian white noise). Also examine the residuals and comment on the fit of the model.

(b) For each time point t in the testing period, use the data up to time t k 1 to fit both

the ARMA-GARCH and ARMA model, with the orders identified in (a).  For each model, compute the 95% confidence interval for the return rt  at time t, then examine whether the realized return lies in the interval.  For each model, draw a time series plot which looks like the following one:

 

0


 

20


 

40


 

60


 

80


 

100


Here, the realized return is shown in black, the CIs are shown by the vertical line segments, and the red ones correspond to the times when the realized return lies outside of the CI. If the model is adequate, we expect that the interval contains the realized return about 95% of the time. Comment on the results you get.