R代写-QF5210A

QF5210A Financial Time Series: Theory and Computation
AY2020/21SEM2

QF5210A A/P Chen Ying 1 | P a g e

Tutorial 2
Notes:
1. Submission Due: Sunday, Jan 24@23:59.
2. Summary table:
1(a) N.A.
1(b) ACF of lag-1 Only
1(c) Test decision.
1(d) AR order
1(e) N.A.
1(f) 1-step forecast Only.
1(g) N.A.
1(h) Decision
1(i) Model choice
1(j) Model choice
2(a) N.A.
2(b) AR order
2(c) Yes or no
2(d) Cycle length

1. Consider the daily gold fixing price recorded at 10:30 am (London time) in London Bullion
Market in U.S. dollars per Troy ounce from January 3, 1995 to March 30, 2017. The data
can be obtained from FRED using the quantmod package. Since there are some missing
values, we need to remove them before analysis.
Let xt = log(gold price).
See instructions below.
require(quantmod)
getSymbols(‘GOLDAMGBD228NLBM’, src=’FRED’)
GOLD <- GOLDAMGBD228NLBM[6982:12784]
idx <- c(1:nrow(GOLD))[is.na(GOLD)]
GOLD <- GOLD[-idx]
xt <- log(as.numeric(GOLD))
rt <- 100*diff(xt)
(a) Obtain the time plots of xt and rt (in one page, using the command par(mfcol=c(2,1)).
(b) Compute the first 12 lags of ACF of xt. Based on the ACF, is there a unit root in xt? Why?
(c) Let rt = 100∗(xt −xt−1) be the return series of the gold prices, in percentages. Consider
the rt series. Test H0 : ρ1 = · · · = ρ12 = 0 versus Ha : ρi ≠ 0 for some 1 ≤ i ≤ 12. Draw your
conclusion.
(d) Use the command ar(rt,method=‘‘mle’’,order.max=20) to specify the order of an AR
model for rt .
QF5210A Financial Time Series: Theory and Computation
AY2020/21SEM2

QF5210A A/P Chen Ying 2 | P a g e

(e) Build an AR model for rt , including model checking. Refine the model by excluding all
coefficient estimates with t-ratio less than 1.645. Write down the fitted mode.
(f) Use the fitted AR model to compute 1-step to 4-step ahead forecasts of rt at the
forecast origin March 30, 2017. Also, compute the corresponding 95% interval forecasts.
(g) Build an MA(7) model for rt . Refine the model by removing coefficient estimates with
t-ratio less than 1.645. Write down the fitted model.
(h) Compute the Ljung-Box statistic Q(10) of the residuals of the fitted MA(7) model. Is
there serial correlation in the residuals? Why?
(i) Consider in-sample fits of the AR model of Problem 1 and the MA(7) model. Which
model is preferred? Why?
(j) Use backtest at the forecast origin t = 5585 with horizon h = 1 to compare the two
models. Which model is preferred? Why?

2. Consider the U.S. quarterly real GDP growth rate from 1947.II to 2016.IV. The data are
available from FRED. See the command below.
getSymbols(‘‘A191RL1Q225SBEA’’,src=’’FRED’’)
gdp <- as.numeric(A191RL1Q225SBEA)
(a) Obtain time-series plot of the real GDP growth rates.
(b) Find an AR model for the real GDP growth rate, including model checking. Write down
the fitted model.
(c) Does the model imply existence of business cycle? Why?
(d) If business cycles are present, compute the average length of the cycles. Otherwise,
the length is infinity.
(e) Obtain 95% interval forecasts of 1-step to 4-step ahead GDP growth rates at the
forecast origin 2016.IV. 