Hw2 TSA
Hw2 TSA
Homework 2
1. (Commodity price) Consider the daily crude oil prices BRENT in Europe in U.S. dollars per barrel
from January 3, 2000 to October 3, 2022. The data can be obtained from FRED using the quantmod
package. Since there are some missing values, we need to remove them before analysis.
(a) Obtain the time plots of xt and rt (in one page, using the command par(mfcol=c(2,1)). In other
words, obtain 2 plots in one window (time plots for xt and rt).
(b) Let rt = 100*(xt – xt-1) be the return series of the gold prices, in percentages. Consider the r t series.
Test H0 : 1 = ... = 12 = 0 versus Ha : i 0 for some 1 ≤ i ≤ 12. Draw your conclusion.
Statistical analysis using the Box-Ljung test suggest that at 5% significance level, the null
hypothesis can be rejected. Thus, there is a significant serial autocorrelation among return series of
the daily crude oil prices in the past 12 months.
(c) Use the command ar(rt,method="mle",order.max=20) to specify the order of an AR model for r t.
An AR(18) is identified.
The order with the minimum AIC which is found to be 18 is chosen as the optimal order for the
AR model. The plot below visually shows the AIC values for orders 0 to 20, highlighting the
preference for the lower-order model (order k that has the minimum AIC value).
(d) Build an AR model for rt, including model checking.
The AR(18) model was employed for the data and the fitted model is:
x t=0.0205+0.0172 xt −1−0.0248 x t−2 +0.0163 x t−3 +0.0164 x t −4−0.0029 x t −5−0.0100 x t−6−0.002 x t −7 + 0.0347 x t −
, σ 2 = 7.063, σ^ a=2.658 , AIC=27732.88,
Considering the residual series of the fitted AR(18) model for the r t we have Q = 0.877 with p-value
0.645. This indicates that the null hypothesis of no residual serial correlation is not rejected at the
5% level. The model is adequate in modeling the linear dependence of the data. However, based on
the time series diagnostic plot it can also be concluded that the model is overfitted.
tstatistic
coefficients standard_errors
s
ar1 -0.017 0.013 -1.309
ar2 -0.025 0.013 -1.885
ar3 0.016 0.013 1.241
ar4 0.016 0.013 1.250
ar5 -0.003 0.013 -0.217
ar6 -0.010 0.013 -0.763
ar7 -0.002 0.013 -0.180
ar8 0.035 0.013 2.650
ar9 0.038 0.013 2.886
ar10 -0.047 0.013 -3.609
ar11 -0.028 0.013 -2.155
ar12 0.041 0.013 3.100
ar13 0.081 0.013 6.159
ar14 0.035 0.013 2.684
ar15 0.011 0.013 0.826
ar16 0.015 0.013 1.160
ar17 -0.005 0.013 -0.398
ar18 -0.041 0.013 -3.095
intercept 0.023 0.039 0.583
(e) Refine the model by excluding all estimates with t-ratio less than 1.96. Write down the fitted model.
Hint: Remove estimates with t-ratio less than 1.96 and re-estimate the AR model.
x t=0.0205+0.0358 x t−8 +0.0364 x t −9−0.0493 x t−10−0.0274 xt −11 +0.0441 x t−12+ 0.0803 x t −13+ 0.0304 x t−14−0.
, σ 2¿ 7.077 , σ^ a=2.660 , AIC=27724.21
(f) Perform tsdiag(model,gof=20) for your new fitted model and compare with (e). Provide the plots.
The refined model keeps the adequacy and provides a better fit according to the Box-Ljung test and
lower AIC value. The residual series gives Q = 11.834 with p-value 0.459 indicating that the null
hypothesis of no residual serial correlation is not rejected at the 5% level.
(g) Use the fitted AR model to compute 1-step to 4-step ahead forecasts of r t at the forecast origin
October 3, 2022. Also, compute the corresponding 95% interval forecasts.
Since the refined model is a more suitable choice for representing the linear dependence in the data, it
was used for computing the forecasts and corresponding CI. The forecasted values along with their
standard errors are presented in the table below.
Step 1 2 3 4
Forecast 0.100 -0.562 -0.611 0.373
Standard Error 2.660 2.660 2.660 2.660
Lower CI Upper CI Predicted Value
-5.114 5.314 0.100
-5.776 4.653 -0.562
-5.826 4.603 -0.611
-4.841 5.587 0.373
2. (Model comparison) Consider, again, the log return series of gold price of Problem 1.
(a) Build MA(10) and MA(13) models for rt. You do not need to write down the fitted model, however,
please provide the estimated coefficients. Note: You may provide the R output for this section using
copy-and-paste.
MA(10):
MA(13):
The examination of both model results shows the evidence of serial correlation in residuals. The MA(10)
model exhibits a Q = 74.937 with a p-value 0.01, indicating a presence of serial correlation. Similarly,
the MA(13) model shows a Q=18.833 with a p-value 0.01, further supporting the presence of serial
correlation. Thus, the model must be refined.
(b) Discuss what you observe in (a). Does each model need to be refined? For example, do coefficient
estimates have t-ratios less than 1.96?
Looking at the results tables for MA(10) and MA(13), it is evident that the coefficient estimates in both
tables have t-ratios less than 1.96. This observation suggests that the models require refinement, as the
coefficients lack statistical significance. (The diagnostics plots: MA(10) on the left, MA(13) on the
right)