CS代写 STAD70 Statistics & Finance II

STAD70 Statistics & Finance II
Assignment 4
Due date: April 8, 2022 (by 11:59pm). Late submissions will be penalized.
Include your codes in your submission.

Copyright By PowCoder代写 加微信 powcoder

1. Consider the problem of finding a growth optimal portfolio b∗ which maximizes the ob- jective function
V(b)=E logb X , b∈∆m.
In this problem we consider a variant of the stochastic gradient descent algorithm on the simplex.
(a) Let f : (0,∞)m → ∞ be a differentiable function, and let b ∈ ∆m. Define the 􏰀∂f ∂f 􏰁⊤
gradient ∇f(b) = ∂b1 ,…, ∂bm . Consider
∇ ̃ f (b) = ∇f (b) − m1 (1⊤ ∇f (b))1,
where 1 = (1, . . . , 1)⊤. Note that 1⊤∇ ̃ f(b) = 0. Draw a figure to visualize this definition when m = 2, f(b) = ∥b∥2 and b = (31, 23).
(b) Fix b ∈ ∆m and a vector v such that 1⊤v = 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 ̃ = b + γv. It is possible that b ̃ ∈/ ∆m, but there exists a maximal t∗ ∈ [0, 1] such that
b + t∗γv ∈ ∆m.
Write an R function modified update(b, v, gamma) that computes t∗ and returns the update b ̃.
Hint: For the i-th component, the condition means that
0 ≤ bi + tγvi ≤ 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
􏰂 X(k+1) 1 1⊤X(k+1) 􏰃
b(k+1) = b(k) + t∗kγk b⊤X(k+1) − m b⊤X(k+1) 1 ∈ ∆m,
where t∗k 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)⊤. 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.052 0.002 0.001  Σ = 0.002 0.082 −0.001 .
0.001 −0.001 0.072
(ii) m = 10, X = (X1, . . . , X10)⊤. Assume the Xi’s are independent, and Xi is
exponentially distributed with rate 3 + i . 10
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: Thegridisfor(θ1,θ2),andθ3 =1−θ1−θ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: 2 0.0 0.2 0.4 0.6 0.8 1.0 (a) Draw the trajectory of θ∗t (in the simplex) over time, where θ∗t is the weight vector which achieves Vt∗ = maxθ Vtθ. (b) Draw the trajectory of bˆt (in the simplex) over time. (c) The time series of Vt∗ and Vˆt. (d) The time series of t log Vt∗ . 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.25, 0.3, 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. 0.0 0.2 0.4 0.6 0.8 1.0 (b) For each time point t in the testing period, use the data up to time t − 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. −4 −2 0 2 4 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com