Assignment-3-Forecasting-
Assignment-3-Forecasting-
14/04/2022
#(a) We can check for ARCH effects by using the ArchTest() function from the FinTS
package. We will use a significance level of α=0.05 for our null hypothesis test. Because the
p-value is < 0.05, we reject the null hypothesis and conclude the presence of ARCH(1)
effects.
library(readr)
library(haven)
library(FinTS)
##
## Attaching package: 'zoo'
library(quantmod)
library(rugarch)
##
## Attaching package: 'rugarch'
## Warning: DJI contains missing values. Some functions will not work
if objects
## contain missing values in the middle of the series. Consider using
na.omit(),
## na.approx(), na.fill(), etc to remove or replace them.
## [1] "DJI"
head(DJI)
#(b)
The values of these series change rapidly from period to period in an seemingly
unpredictable manner, which we can say is volatile. Furthermore, there are periods when
large changes are followed by further large changes and periods in which small changes are
followed by further small changes, another evidence of volatility.
chartSeries(DJI)
dr_DJI <- dailyReturn(DJI)*100
chartSeries(dr_DJI)
dr_DJI.archTest <- ArchTest(dr_DJI$daily.returns, lags = 1, demean =
TRUE)
dr_DJI.archTest
##
## ARCH LM-test; Null hypothesis: no ARCH effects
##
## data: dr_DJI$daily.returns
## Chi-squared = 76.686, df = 1, p-value < 2.2e-16
#(c)
Based on the output, the estimated mean of the series is
r̂ t=β̂ 0=0.04992
and the estimated variance is
ĥ t=α̂ 0+α̂ 1ê 2t−1=1.57824+0.78650
ug_spec_c = ugarchspec(mean.model = list(armaOrder=c(0,0)),
variance.model = list(model = "sGARCH", garchOrder=c(1,0)))
ug_spec_c
##
## *---------------------------------*
## * GARCH Model Spec *
## *---------------------------------*
##
## Conditional Variance Dynamics
## ------------------------------------
## GARCH Model : sGARCH(1,0)
## Variance Targeting : FALSE
##
## Conditional Mean Dynamics
## ------------------------------------
## Mean Model : ARFIMA(0,0,0)
## Include Mean : TRUE
## GARCH-in-Mean : FALSE
##
## Conditional Distribution
## ------------------------------------
## Distribution : norm
## Includes Skew : FALSE
## Includes Shape : FALSE
## Includes Lambda : FALSE
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,0)
## Mean Model : ARFIMA(0,0,0)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.056037 0.017005 3.2953 0.000983
## omega 0.604997 0.023980 25.2297 0.000000
## alpha1 0.394428 0.043479 9.0717 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.056037 0.021656 2.5876 0.009666
## omega 0.604997 0.069008 8.7671 0.000000
## alpha1 0.394428 0.117886 3.3458 0.000820
##
## LogLikelihood : -3116.085
##
## Information Criteria
## ------------------------------------
##
## Akaike 2.6355
## Bayes 2.6428
## Shibata 2.6355
## Hannan-Quinn 2.6381
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1822 0.6695
## Lag[2*(p+q)+(p+q)-1][2] 0.6846 0.6129
## Lag[4*(p+q)+(p+q)-1][5] 4.7332 0.1757
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 1.799 1.798e-01
## Lag[2*(p+q)+(p+q)-1][2] 35.297 4.355e-10
## Lag[4*(p+q)+(p+q)-1][5] 82.405 0.000e+00
## d.o.f=1
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[2] 66.88 0.500 2.000 3.331e-16
## ARCH Lag[4] 93.79 1.397 1.611 0.000e+00
## ARCH Lag[6] 114.44 2.222 1.500 0.000e+00
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 3.0503
## Individual Statistics:
## mu 0.04992
## omega 1.57824
## alpha1 0.78650
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 0.846 1.01 1.35
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.0521 0.2929
## Negative Sign Bias 0.1643 0.8695
## Positive Sign Bias 0.3876 0.6984
## Joint Effect 2.6215 0.4537
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 281.5 1.212e-48
## 2 30 301.7 3.825e-47
## 3 40 313.6 1.357e-44
## 4 50 325.5 1.803e-42
##
##
## Elapsed time : 0.3352451
##
## *---------------------------------*
## * GARCH Model Spec *
## *---------------------------------*
##
## Conditional Variance Dynamics
## ------------------------------------
## GARCH Model : sGARCH(1,1)
## Variance Targeting : FALSE
##
## Conditional Mean Dynamics
## ------------------------------------
## Mean Model : ARFIMA(0,0,0)
## Include Mean : TRUE
## GARCH-in-Mean : FALSE
##
## Conditional Distribution
## ------------------------------------
## Distribution : norm
## Includes Skew : FALSE
## Includes Shape : FALSE
## Includes Lambda : FALSE
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.074986 0.013828 5.4228 0
## omega 0.036434 0.006024 6.0481 0
## alpha1 0.205540 0.021933 9.3712 0
## beta1 0.769724 0.021460 35.8684 0
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.074986 0.014129 5.3071 0.0e+00
## omega 0.036434 0.008804 4.1383 3.5e-05
## alpha1 0.205540 0.046843 4.3879 1.1e-05
## beta1 0.769724 0.038946 19.7638 0.0e+00
##
## LogLikelihood : -2828.736
##
## Information Criteria
## ------------------------------------
##
## Akaike 2.3935
## Bayes 2.4033
## Shibata 2.3935
## Hannan-Quinn 2.3971
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.2239 0.6361
## Lag[2*(p+q)+(p+q)-1][2] 0.8545 0.5479
## Lag[4*(p+q)+(p+q)-1][5] 4.5020 0.1977
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.2839 0.5941
## Lag[2*(p+q)+(p+q)-1][5] 0.4749 0.9615
## Lag[4*(p+q)+(p+q)-1][9] 1.1894 0.9770
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.2063 0.500 2.000 0.6497
## ARCH Lag[5] 0.3209 1.440 1.667 0.9347
## ARCH Lag[7] 0.9153 2.315 1.543 0.9269
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 1.1035
## Individual Statistics:
## mu 0.03647
## omega 0.15312
## alpha1 0.29362
## beta1 0.31417
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.07 1.24 1.6
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 2.4794 0.01323 **
## Negative Sign Bias 0.9722 0.33104
## Positive Sign Bias 0.1026 0.91828
## Joint Effect 8.8264 0.03169 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 119.0 1.675e-16
## 2 30 146.2 1.368e-17
## 3 40 164.0 2.938e-17
## 4 50 176.3 2.869e-16
##
##
## Elapsed time : 0.14431
#(e)
r_t= 0.3201+ 0.1450 u(t-1)^2 + 0.2305 h(t-1) + 0.2817 (0.3345) u(t-1)^2
ug_spec_e = ugarchspec(mean.model = list(armaOrder=c(0,0)),
variance.model = list(model = "gjrGARCH", garchOrder=c(1,1)))
ug_spec_e
##
## *---------------------------------*
## * GARCH Model Spec *
## *---------------------------------*
##
## Conditional Variance Dynamics
## ------------------------------------
## GARCH Model : gjrGARCH(1,1)
## Variance Targeting : FALSE
##
## Conditional Mean Dynamics
## ------------------------------------
## Mean Model : ARFIMA(0,0,0)
## Include Mean : TRUE
## GARCH-in-Mean : FALSE
##
## Conditional Distribution
## ------------------------------------
## Distribution : norm
## Includes Skew : FALSE
## Includes Shape : FALSE
## Includes Lambda : FALSE
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.042226 0.013905 3.0368 0.002391
## omega 0.026427 0.003466 7.6254 0.000000
## alpha1 0.000000 0.017976 0.0000 1.000000
## beta1 0.844069 0.007949 106.1909 0.000000
## gamma1 0.270490 0.028431 9.5140 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.042226 0.014231 2.9671 0.003006
## omega 0.026427 0.006870 3.8465 0.000120
## alpha1 0.000000 0.056550 0.0000 1.000000
## beta1 0.844069 0.047996 17.5864 0.000000
## gamma1 0.270490 0.043095 6.2766 0.000000
##
## LogLikelihood : -2782.435
##
## Information Criteria
## ------------------------------------
##
## Akaike 2.3552
## Bayes 2.3674
## Shibata 2.3552
## Hannan-Quinn 2.3597
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.09092 0.7630
## Lag[2*(p+q)+(p+q)-1][2] 0.98866 0.5019
## Lag[4*(p+q)+(p+q)-1][5] 4.64514 0.1838
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.0004001 0.9840
## Lag[2*(p+q)+(p+q)-1][5] 0.1155214 0.9975
## Lag[4*(p+q)+(p+q)-1][9] 0.5323937 0.9981
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.02723 0.500 2.000 0.8689
## ARCH Lag[5] 0.04781 1.440 1.667 0.9954
## ARCH Lag[7] 0.43142 2.315 1.543 0.9842
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 0.9877
## Individual Statistics:
## mu 0.3201
## omega 0.1450
## alpha1 0.2305
## beta1 0.2817
## gamma1 0.3345
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.28 1.47 1.88
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.660 0.09705 *
## Negative Sign Bias 1.246 0.21288
## Positive Sign Bias 1.291 0.19690
## Joint Effect 3.605 0.30741
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 97.77 1.357e-12
## 2 30 120.06 4.808e-13
## 3 40 118.26 6.529e-10
## 4 50 138.56 1.746e-10
##
##
## Elapsed time : 0.2775838
#(f)
We prefer one model to another when it captures the significance effect. For example if the
threshold GARCH or asymmetric effect are exist then if we include that it will give the
better forecasting.