You are on page 1of 42

Assignment-2.

R
ARHUM

2020-12-09
rm(list=ls()) #Clear the memory
setwd("F:/TERM 5/FRMM/Assignments") #Set WD
nikkei=read.csv("Dataset.csv", header=T)
nikkei=nikkei[,2]
library(rugarch)

## Warning: package 'rugarch' was built under R version 4.0.3

## Loading required package: parallel

##
## Attaching package: 'rugarch'

## The following object is masked from 'package:stats':


##
## sigma

# s GARCH Model with norm distribution


spec1=ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "norm")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * 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|)
## omega 0.000004 0.000002 2.824 0.004742
## alpha1 0.109319 0.008722 12.533 0.000000
## beta1 0.873368 0.010756 81.195 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000004 0.000006 0.76926 0.44174
## alpha1 0.109319 0.015162 7.21024 0.00000
## beta1 0.873368 0.030577 28.56299 0.00000
##
## LogLikelihood : 14918.48
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8298
## Bayes -5.8259
## Shibata -5.8298
## Hannan-Quinn -5.8284
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.0144 0.9045
## Lag[2*(p+q)+(p+q)-1][2] 1.1110 0.4636
## Lag[4*(p+q)+(p+q)-1][5] 1.9911 0.6205
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1685 0.6815
## Lag[2*(p+q)+(p+q)-1][5] 2.1985 0.5723
## Lag[4*(p+q)+(p+q)-1][9] 3.2451 0.7179
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.5854 0.500 2.000 0.4442
## ARCH Lag[5] 2.0967 1.440 1.667 0.4503
## ARCH Lag[7] 2.4580 2.315 1.543 0.6211
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 3.0743
## Individual Statistics:
## omega 0.1015
## alpha1 0.1934
## beta1 0.3608
##
## 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.5029 1.329e-01
## Negative Sign Bias 0.8338 4.044e-01
## Positive Sign Bias 3.0065 2.656e-03 ***
## Joint Effect 33.5811 2.429e-07 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 120.1 1.068e-16
## 2 30 131.1 6.199e-15
## 3 40 150.7 4.798e-15
## 4 50 169.2 3.930e-15
##
##
## Elapsed time : 0.5926571

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_sGARCH_norm.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.01152434

# s GARCH Model with std distribution


spec1=ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "std")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : std
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000003 0.000002 1.6695 0.095025
## alpha1 0.089533 0.015184 5.8967 0.000000
## beta1 0.899257 0.016769 53.6272 0.000000
## shape 7.663494 0.798705 9.5949 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000003 0.000008 0.39257 0.69464
## alpha1 0.089533 0.055758 1.60573 0.10833
## beta1 0.899257 0.064986 13.83779 0.00000
## shape 7.663494 1.142561 6.70730 0.00000
##
## LogLikelihood : 15001.39
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8618
## Bayes -5.8567
## Shibata -5.8618
## Hannan-Quinn -5.8600
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.02039 0.8865
## Lag[2*(p+q)+(p+q)-1][2] 1.18113 0.4430
## Lag[4*(p+q)+(p+q)-1][5] 2.16640 0.5797
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 3.468 0.06256
## Lag[2*(p+q)+(p+q)-1][5] 7.443 0.04044
## Lag[4*(p+q)+(p+q)-1][9] 8.458 0.10468
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 2.029 0.500 2.000 0.1543
## ARCH Lag[5] 2.580 1.440 1.667 0.3568
## ARCH Lag[7] 2.739 2.315 1.543 0.5641
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 43.2209
## Individual Statistics:
## omega 4.0219
## alpha1 0.8025
## beta1 1.1877
## shape 2.2210
##
## 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 1.274 2.028e-01
## Negative Sign Bias 1.653 9.834e-02 *
## Positive Sign Bias 2.721 6.524e-03 ***
## Joint Effect 34.274 1.734e-07 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 62.18 1.741e-06
## 2 30 73.89 8.739e-06
## 3 40 84.74 3.113e-05
## 4 50 109.16 1.784e-06
##
##
## Elapsed time : 0.8671701

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_sGARCH_std.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.01141483

# s GARCH Model with ged distribution


spec1=ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "ged")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : ged
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000003 0.000002 2.2301 0.025744
## alpha1 0.097098 0.011780 8.2428 0.000000
## beta1 0.889576 0.013377 66.4983 0.000000
## shape 1.404367 0.039004 36.0060 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000003 0.000005 0.69778 0.485318
## alpha1 0.097098 0.027409 3.54256 0.000396
## beta1 0.889576 0.036070 24.66221 0.000000
## shape 1.404367 0.052390 26.80604 0.000000
##
## LogLikelihood : 15002.62
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8623
## Bayes -5.8572
## Shibata -5.8623
## Hannan-Quinn -5.8605
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.01924 0.8897
## Lag[2*(p+q)+(p+q)-1][2] 1.15202 0.4515
## Lag[4*(p+q)+(p+q)-1][5] 2.09076 0.5971
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 1.563 0.2113
## Lag[2*(p+q)+(p+q)-1][5] 4.528 0.1952
## Lag[4*(p+q)+(p+q)-1][9] 5.504 0.3593
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 1.299 0.500 2.000 0.2544
## ARCH Lag[5] 2.213 1.440 1.667 0.4260
## ARCH Lag[7] 2.453 2.315 1.543 0.6221
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 22.2221
## Individual Statistics:
## omega 1.7342
## alpha1 0.5012
## beta1 0.8276
## shape 1.6503
##
## 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 1.375 1.693e-01
## Negative Sign Bias 1.291 1.966e-01
## Positive Sign Bias 2.853 4.345e-03 ***
## Joint Effect 33.856 2.125e-07 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 47.76 0.0002781
## 2 30 58.71 0.0008922
## 3 40 73.30 0.0007259
## 4 50 79.61 0.0037064
##
##
## Elapsed time : 1.198512

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_sGARCH_ged.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.01145676
# s GARCH Model with snorm distribution
spec1=ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "snorm")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : snorm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000004 0.000001 2.9405 0.003276
## alpha1 0.108473 0.008617 12.5880 0.000000
## beta1 0.874030 0.010440 83.7155 0.000000
## skew 0.875867 0.015419 56.8057 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000004 0.000005 0.87427 0.38197
## alpha1 0.108473 0.013759 7.88368 0.00000
## beta1 0.874030 0.026284 33.25349 0.00000
## skew 0.875867 0.019053 45.97061 0.00000
##
## LogLikelihood : 14948.02
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8409
## Bayes -5.8358
## Shibata -5.8409
## Hannan-Quinn -5.8391
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.01507 0.9023
## Lag[2*(p+q)+(p+q)-1][2] 1.11182 0.4634
## Lag[4*(p+q)+(p+q)-1][5] 1.99362 0.6199
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1878 0.6648
## Lag[2*(p+q)+(p+q)-1][5] 2.2293 0.5653
## Lag[4*(p+q)+(p+q)-1][9] 3.2776 0.7124
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.5944 0.500 2.000 0.4407
## ARCH Lag[5] 2.0964 1.440 1.667 0.4503
## ARCH Lag[7] 2.4603 2.315 1.543 0.6206
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 4.3457
## Individual Statistics:
## omega 0.1397
## alpha1 0.2304
## beta1 0.4215
## skew 0.2084
##
## 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 1.5008 1.335e-01
## Negative Sign Bias 0.8367 4.028e-01
## Positive Sign Bias 3.0090 2.634e-03 ***
## Joint Effect 33.6097 2.395e-07 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 112.6 2.675e-15
## 2 30 124.6 8.139e-14
## 3 40 133.1 3.378e-12
## 4 50 135.1 5.548e-10
##
##
## Elapsed time : 0.4664528
sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_sGARCH_snorm.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.011493

# s GARCH Model with sstd distribution


spec1=ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "sstd")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : sstd
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000003 0.000002 1.8961 0.057951
## alpha1 0.091359 0.013828 6.6069 0.000000
## beta1 0.896788 0.015295 58.6311 0.000000
## skew 0.907415 0.016853 53.8439 0.000000
## shape 8.108687 0.896447 9.0454 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000003 0.000006 0.51772 0.604650
## alpha1 0.091359 0.041800 2.18563 0.028843
## beta1 0.896788 0.049760 18.02225 0.000000
## skew 0.907415 0.015689 57.83752 0.000000
## shape 8.108687 1.109509 7.30835 0.000000
##
## LogLikelihood : 15015.45
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8669
## Bayes -5.8605
## Shibata -5.8669
## Hannan-Quinn -5.8647
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.02014 0.8871
## Lag[2*(p+q)+(p+q)-1][2] 1.17353 0.4452
## Lag[4*(p+q)+(p+q)-1][5] 2.14618 0.5843
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 2.885 0.08939
## Lag[2*(p+q)+(p+q)-1][5] 6.565 0.06605
## Lag[4*(p+q)+(p+q)-1][9] 7.559 0.15672
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 1.818 0.500 2.000 0.1776
## ARCH Lag[5] 2.457 1.440 1.667 0.3788
## ARCH Lag[7] 2.635 2.315 1.543 0.5850
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 39.8433
## Individual Statistics:
## omega 3.4962
## alpha1 0.7744
## beta1 1.1870
## skew 0.4478
## shape 2.4284
##
## 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.301 1.933e-01
## Negative Sign Bias 1.556 1.197e-01
## Positive Sign Bias 2.757 5.858e-03 ***
## Joint Effect 34.137 1.853e-07 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 46.60 0.0004074
## 2 30 54.29 0.0029989
## 3 40 63.45 0.0079585
## 4 50 83.07 0.0017034
##
##
## Elapsed time : 1.553748

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_sGARCH_sstd.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.01141984

# s GARCH Model with sged distribution


spec1=ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "sged")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : sged
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000003 0.000001 2.3311 0.019748
## alpha1 0.097856 0.011415 8.5727 0.000000
## beta1 0.888031 0.013016 68.2238 0.000000
## skew 0.915922 0.015349 59.6744 0.000000
## shape 1.433158 0.040919 35.0245 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000003 0.000004 0.78531 0.432271
## alpha1 0.097856 0.023921 4.09088 0.000043
## beta1 0.888031 0.032097 27.66688 0.000000
## skew 0.915922 0.016171 56.63998 0.000000
## shape 1.433158 0.052323 27.39059 0.000000
##
## LogLikelihood : 15017.75
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8678
## Bayes -5.8614
## Shibata -5.8678
## Hannan-Quinn -5.8656
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.01906 0.8902
## Lag[2*(p+q)+(p+q)-1][2] 1.14763 0.4527
## Lag[4*(p+q)+(p+q)-1][5] 2.07993 0.5997
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 1.342 0.2467
## Lag[2*(p+q)+(p+q)-1][5] 4.177 0.2328
## Lag[4*(p+q)+(p+q)-1][9] 5.155 0.4070
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 1.202 0.500 2.000 0.2729
## ARCH Lag[5] 2.179 1.440 1.667 0.4330
## ARCH Lag[7] 2.434 2.315 1.543 0.6261
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 21.7739
## Individual Statistics:
## omega 1.5943
## alpha1 0.4948
## beta1 0.8414
## skew 0.3568
## shape 1.9518
##
## 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.390 1.646e-01
## Negative Sign Bias 1.236 2.164e-01
## Positive Sign Bias 2.873 4.077e-03 ***
## Joint Effect 33.817 2.166e-07 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 31.23 0.03807
## 2 30 33.23 0.26869
## 3 40 43.31 0.29243
## 4 50 59.73 0.14002
##
##
## Elapsed time : 3.054831

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_sGARCH_sged.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.01143509

# gjr GARCH Model with norm distribution


spec1=ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "norm")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * 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|)
## omega 0.000005 0.000001 8.1995 0
## alpha1 0.039724 0.003131 12.6876 0
## beta1 0.870210 0.006782 128.3137 0
## gamma1 0.130660 0.012035 10.8570 0
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000005 0.000001 3.9573 7.6e-05
## alpha1 0.039724 0.009552 4.1589 3.2e-05
## beta1 0.870210 0.008489 102.5145 0.0e+00
## gamma1 0.130660 0.021883 5.9709 0.0e+00
##
## LogLikelihood : 14974.22
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8512
## Bayes -5.8461
## Shibata -5.8512
## Hannan-Quinn -5.8494
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.01759 0.8945
## Lag[2*(p+q)+(p+q)-1][2] 1.17173 0.4457
## Lag[4*(p+q)+(p+q)-1][5] 1.95427 0.6293
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 3.217 0.07288
## Lag[2*(p+q)+(p+q)-1][5] 4.451 0.20287
## Lag[4*(p+q)+(p+q)-1][9] 5.577 0.34975
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.2488 0.500 2.000 0.6179
## ARCH Lag[5] 2.4751 1.440 1.667 0.3755
## ARCH Lag[7] 2.7645 2.315 1.543 0.5591
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 4.4307
## Individual Statistics:
## omega 1.9096
## alpha1 0.3155
## beta1 0.4847
## gamma1 0.1344
##
## 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 1.712 0.086868 *
## Negative Sign Bias 1.545 0.122525
## Positive Sign Bias 2.222 0.026304 **
## Joint Effect 16.212 0.001026 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 91.82 1.575e-11
## 2 30 117.73 1.188e-12
## 3 40 147.83 1.416e-14
## 4 50 153.70 9.829e-13
##
##
## Elapsed time : 0.757664

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_gjrGARCH_norm.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.01001574

# gjr GARCH Model with std distribution


spec1=ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "std")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : std
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000005 0.000002 3.0770 0.002091
## alpha1 0.024284 0.007337 3.3099 0.000933
## beta1 0.883515 0.006681 132.2342 0.000000
## gamma1 0.142343 0.009288 15.3259 0.000000
## shape 8.442299 0.865530 9.7539 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000005 0.000005 0.96123 0.336436
## alpha1 0.024284 0.032130 0.75581 0.449762
## beta1 0.883515 0.015264 57.88084 0.000000
## gamma1 0.142343 0.044645 3.18836 0.001431
## shape 8.442299 1.330588 6.34479 0.000000
##
## LogLikelihood : 15050.99
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8808
## Bayes -5.8744
## Shibata -5.8808
## Hannan-Quinn -5.8785
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.02187 0.8824
## Lag[2*(p+q)+(p+q)-1][2] 1.16336 0.4482
## Lag[4*(p+q)+(p+q)-1][5] 1.98157 0.6228
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 1.908 0.1672
## Lag[2*(p+q)+(p+q)-1][5] 3.106 0.3880
## Lag[4*(p+q)+(p+q)-1][9] 4.269 0.5440
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.8858 0.500 2.000 0.3466
## ARCH Lag[5] 2.2791 1.440 1.667 0.4128
## ARCH Lag[7] 2.6789 2.315 1.543 0.5761
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 3.6215
## Individual Statistics:
## omega 1.0465
## alpha1 1.1746
## beta1 1.5242
## gamma1 0.5639
## shape 1.6557
##
## 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.609 0.10762
## Negative Sign Bias 1.565 0.11772
## Positive Sign Bias 1.988 0.04689 **
## Joint Effect 13.426 0.00380 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 44.18 8.927e-04
## 2 30 72.11 1.552e-05
## 3 40 88.26 1.108e-05
## 4 50 110.31 1.274e-06
##
##
## Elapsed time : 1.441114

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_gjrGARCH_std.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.009599717

# gjr GARCH Model with ged distribution


spec1=ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "ged")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : ged
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000005 0.000001 4.4179 1e-05
## alpha1 0.030755 0.002769 11.1078 0e+00
## beta1 0.879087 0.007429 118.3323 0e+00
## gamma1 0.136379 0.012591 10.8318 0e+00
## shape 1.440284 0.038891 37.0343 0e+00
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000005 0.000002 1.9563 0.050429
## alpha1 0.030755 0.016140 1.9055 0.056716
## beta1 0.879087 0.010303 85.3218 0.000000
## gamma1 0.136379 0.025792 5.2876 0.000000
## shape 1.440284 0.051828 27.7895 0.000000
##
## LogLikelihood : 15047.97
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8796
## Bayes -5.8732
## Shibata -5.8796
## Hannan-Quinn -5.8774
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.02153 0.8833
## Lag[2*(p+q)+(p+q)-1][2] 1.17098 0.4460
## Lag[4*(p+q)+(p+q)-1][5] 1.97728 0.6238
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 2.393 0.1219
## Lag[2*(p+q)+(p+q)-1][5] 3.560 0.3143
## Lag[4*(p+q)+(p+q)-1][9] 4.639 0.4843
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.5517 0.500 2.000 0.4576
## ARCH Lag[5] 2.2957 1.440 1.667 0.4095
## ARCH Lag[7] 2.6000 2.315 1.543 0.5920
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 3.7703
## Individual Statistics:
## omega 1.2164
## alpha1 0.7185
## beta1 1.0491
## gamma1 0.3453
## shape 1.1150
##
## 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.654 0.098281 *
## Negative Sign Bias 1.549 0.121556
## Positive Sign Bias 2.109 0.034976 **
## Joint Effect 14.759 0.002035 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 35.30 0.0128622
## 2 30 59.50 0.0007117
## 3 40 73.74 0.0006479
## 4 50 94.38 0.0001057
##
##
## Elapsed time : 2.116371

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_gjrGARCH_ged.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.009771488

# gjr GARCH Model with snorm distribution


spec1=ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "snorm")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : snorm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000005 0.000001 8.4344 0
## alpha1 0.040680 0.002901 14.0226 0
## beta1 0.870469 0.006725 129.4324 0
## gamma1 0.127261 0.011696 10.8811 0
## skew 0.878312 0.015590 56.3392 0
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000005 0.000001 4.1583 3.2e-05
## alpha1 0.040680 0.009369 4.3421 1.4e-05
## beta1 0.870469 0.008080 107.7262 0.0e+00
## gamma1 0.127261 0.020618 6.1724 0.0e+00
## skew 0.878312 0.020008 43.8984 0.0e+00
##
## LogLikelihood : 15001.81
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8616
## Bayes -5.8552
## Shibata -5.8616
## Hannan-Quinn -5.8593
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.01716 0.8958
## Lag[2*(p+q)+(p+q)-1][2] 1.17295 0.4454
## Lag[4*(p+q)+(p+q)-1][5] 1.95717 0.6286
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 3.145 0.07614
## Lag[2*(p+q)+(p+q)-1][5] 4.377 0.21059
## Lag[4*(p+q)+(p+q)-1][9] 5.497 0.36017
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.2404 0.500 2.000 0.6239
## ARCH Lag[5] 2.4840 1.440 1.667 0.3739
## ARCH Lag[7] 2.7702 2.315 1.543 0.5580
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 4.6369
## Individual Statistics:
## omega 1.9600
## alpha1 0.4029
## beta1 0.5810
## gamma1 0.1660
## skew 0.2173
##
## 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.714 0.0866416 *
## Negative Sign Bias 1.495 0.1349613
## Positive Sign Bias 2.237 0.0253136 **
## Joint Effect 16.407 0.0009355 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 84.28 3.367e-10
## 2 30 107.10 6.940e-11
## 3 40 115.01 2.000e-09
## 4 50 142.19 5.158e-11
##
##
## Elapsed time : 1.081108

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_gjrGARCH_snorm.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.01002158

# gjr GARCH Model with sstd distribution


spec1=ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "sstd")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : sstd
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000005 0.000001 3.1842 0.001451
## alpha1 0.026558 0.007234 3.6713 0.000241
## beta1 0.881952 0.006823 129.2538 0.000000
## gamma1 0.139801 0.009785 14.2870 0.000000
## skew 0.908783 0.017170 52.9280 0.000000
## shape 8.911650 0.961870 9.2649 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000005 0.000005 0.99634 0.319085
## alpha1 0.026558 0.031973 0.83063 0.406181
## beta1 0.881952 0.014592 60.44171 0.000000
## gamma1 0.139801 0.042796 3.26666 0.001088
## skew 0.908783 0.015937 57.02299 0.000000
## shape 8.911650 1.498264 5.94799 0.000000
##
## LogLikelihood : 15064.17
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8855
## Bayes -5.8779
## Shibata -5.8855
## Hannan-Quinn -5.8829
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.02143 0.8836
## Lag[2*(p+q)+(p+q)-1][2] 1.16716 0.4471
## Lag[4*(p+q)+(p+q)-1][5] 1.98098 0.6229
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 2.075 0.1497
## Lag[2*(p+q)+(p+q)-1][5] 3.255 0.3625
## Lag[4*(p+q)+(p+q)-1][9] 4.376 0.5264
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.7567 0.500 2.000 0.3844
## ARCH Lag[5] 2.2751 1.440 1.667 0.4136
## ARCH Lag[7] 2.6311 2.315 1.543 0.5857
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 4.0299
## Individual Statistics:
## omega 1.1446
## alpha1 1.1114
## beta1 1.4891
## gamma1 0.5268
## skew 0.4033
## shape 1.7889
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.49 1.68 2.12
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.626 0.103947
## Negative Sign Bias 1.550 0.121121
## Positive Sign Bias 2.029 0.042554 **
## Joint Effect 13.887 0.003064 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 41.53 0.0020525
## 2 30 45.55 0.0259953
## 3 40 77.46 0.0002408
## 4 50 88.77 0.0004375
##
##
## Elapsed time : 2.199118

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_gjrGARCH_sstd.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.009659659

# gjr GARCH Model with sged distribution


spec1=ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "sged")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : sged
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000005 0.000001 4.7394 2e-06
## alpha1 0.032206 0.002402 13.4105 0e+00
## beta1 0.878016 0.007435 118.0950 0e+00
## gamma1 0.134010 0.012503 10.7179 0e+00
## skew 0.914393 0.015327 59.6608 0e+00
## shape 1.468168 0.040567 36.1914 0e+00
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000005 0.000002 2.1638 0.030476
## alpha1 0.032206 0.015268 2.1094 0.034911
## beta1 0.878016 0.009657 90.9213 0.000000
## gamma1 0.134010 0.024601 5.4474 0.000000
## skew 0.914393 0.015899 57.5118 0.000000
## shape 1.468168 0.051531 28.4910 0.000000
##
## LogLikelihood : 15062.73
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8850
## Bayes -5.8773
## Shibata -5.8850
## Hannan-Quinn -5.8823
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.02082 0.8853
## Lag[2*(p+q)+(p+q)-1][2] 1.17249 0.4455
## Lag[4*(p+q)+(p+q)-1][5] 1.97598 0.6241
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 2.487 0.1148
## Lag[2*(p+q)+(p+q)-1][5] 3.656 0.3001
## Lag[4*(p+q)+(p+q)-1][9] 4.730 0.4701
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.4939 0.500 2.000 0.4822
## ARCH Lag[5] 2.3155 1.440 1.667 0.4056
## ARCH Lag[7] 2.6088 2.315 1.543 0.5902
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 4.4235
## Individual Statistics:
## omega 1.3215
## alpha1 0.7294
## beta1 1.0627
## gamma1 0.3353
## skew 0.3666
## shape 1.3673
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.49 1.68 2.12
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.663 0.096305 *
## Negative Sign Bias 1.530 0.126081
## Positive Sign Bias 2.131 0.033153 **
## Joint Effect 15.033 0.001789 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 28.68 0.07114
## 2 30 36.96 0.14737
## 3 40 66.95 0.00353
## 4 50 70.11 0.02552
##
##
## Elapsed time : 4.259612

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_gjrGARCH_sged.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.009795849

# e GARCH Model with norm distribution


spec1=ugarchspec(variance.model = list(model = "eGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "norm")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : eGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega -0.31352 0.015461 -20.278 0
## alpha1 -0.10179 0.008085 -12.590 0
## beta1 0.96313 0.001770 544.105 0
## gamma1 0.19699 0.013375 14.728 0
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega -0.31352 0.015361 -20.4094 0
## alpha1 -0.10179 0.016494 -6.1712 0
## beta1 0.96313 0.001889 509.7869 0
## gamma1 0.19699 0.018500 10.6482 0
##
## LogLikelihood : 14994.31
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8590
## Bayes -5.8539
## Shibata -5.8590
## Hannan-Quinn -5.8572
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 1.875e-06 0.9989
## Lag[2*(p+q)+(p+q)-1][2] 9.434e-01 0.5170
## Lag[4*(p+q)+(p+q)-1][5] 1.547e+00 0.7284
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 1.079 0.2988
## Lag[2*(p+q)+(p+q)-1][5] 2.215 0.5686
## Lag[4*(p+q)+(p+q)-1][9] 3.156 0.7329
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 1.478 0.500 2.000 0.2240
## ARCH Lag[5] 1.984 1.440 1.667 0.4747
## ARCH Lag[7] 2.331 2.315 1.543 0.6476
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 0.5959
## Individual Statistics:
## omega 0.14198
## alpha1 0.18757
## beta1 0.13473
## gamma1 0.04556
##
## 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 1.1257 0.26033
## Negative Sign Bias 0.9204 0.35742
## Positive Sign Bias 1.9343 0.05313 *
## Joint Effect 10.2027 0.01692 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 85.77 1.845e-10
## 2 30 111.10 1.524e-11
## 3 40 128.93 1.503e-11
## 4 50 137.92 2.155e-10
##
##
## Elapsed time : 0.479712

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_eGARCH_norm.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.01049258

# e GARCH Model with std distribution


spec1=ugarchspec(variance.model = list(model = "eGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "std")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : eGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : std
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega -0.28089 0.013937 -20.1536 0
## alpha1 -0.11304 0.009335 -12.1094 0
## beta1 0.96760 0.001572 615.4217 0
## gamma1 0.17440 0.017124 10.1843 0
## shape 8.42865 0.955872 8.8178 0
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega -0.28089 0.014383 -19.5294 0
## alpha1 -0.11304 0.011111 -10.1737 0
## beta1 0.96760 0.001568 617.1358 0
## gamma1 0.17440 0.022633 7.7053 0
## shape 8.42865 1.184245 7.1173 0
##
## LogLikelihood : 15070.26
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8883
## Bayes -5.8819
## Shibata -5.8883
## Hannan-Quinn -5.8861
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.0001411 0.9905
## Lag[2*(p+q)+(p+q)-1][2] 0.9427254 0.5172
## Lag[4*(p+q)+(p+q)-1][5] 1.5728876 0.7220
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.2867 0.5923
## Lag[2*(p+q)+(p+q)-1][5] 2.1255 0.5891
## Lag[4*(p+q)+(p+q)-1][9] 3.7581 0.6301
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 2.897 0.500 2.000 0.08872
## ARCH Lag[5] 2.956 1.440 1.667 0.29628
## ARCH Lag[7] 3.834 2.315 1.543 0.37113
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 2.4763
## Individual Statistics:
## omega 0.6278
## alpha1 0.5223
## beta1 0.6038
## gamma1 0.1144
## shape 1.0163
##
## 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 0.9367 0.34894
## Negative Sign Bias 0.8969 0.36983
## Positive Sign Bias 1.7160 0.08623 *
## Joint Effect 7.5879 0.05534 *
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 42.10 1.720e-03
## 2 30 71.37 1.965e-05
## 3 40 84.15 3.696e-05
## 4 50 89.65 3.520e-04
##
##
## Elapsed time : 1.229681

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_eGARCH_std.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.01001461

# e GARCH Model with ged distribution


spec1=ugarchspec(variance.model = list(model = "eGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "ged")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : eGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : ged
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega -0.29458 0.027109 -10.866 0
## alpha1 -0.10778 0.004791 -22.497 0
## beta1 0.96612 0.003115 310.170 0
## gamma1 0.18321 0.003595 50.958 0
## shape 1.44941 0.039715 36.495 0
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega -0.29458 0.051461 -5.7244 0
## alpha1 -0.10778 0.013754 -7.8359 0
## beta1 0.96612 0.005962 162.0479 0
## gamma1 0.18321 0.019321 9.4826 0
## shape 1.44941 0.050635 28.6249 0
##
## LogLikelihood : 15065.37
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8864
## Bayes -5.8800
## Shibata -5.8864
## Hannan-Quinn -5.8842
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 9.043e-05 0.9924
## Lag[2*(p+q)+(p+q)-1][2] 9.495e-01 0.5149
## Lag[4*(p+q)+(p+q)-1][5] 1.571e+00 0.7225
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.5401 0.4624
## Lag[2*(p+q)+(p+q)-1][5] 2.0084 0.6164
## Lag[4*(p+q)+(p+q)-1][9] 3.2439 0.7181
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 2.225 0.500 2.000 0.1358
## ARCH Lag[5] 2.428 1.440 1.667 0.3841
## ARCH Lag[7] 3.004 2.315 1.543 0.5128
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 2.264
## Individual Statistics:
## omega 0.37733
## alpha1 0.32799
## beta1 0.36005
## gamma1 0.07367
## shape 0.68985
##
## 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.0179 0.30878
## Negative Sign Bias 0.8907 0.37313
## Positive Sign Bias 1.8166 0.06934 *
## Joint Effect 8.7221 0.03322 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 33.69 0.0200080
## 2 30 65.30 0.0001297
## 3 40 73.60 0.0006720
## 4 50 76.13 0.0077941
##
##
## Elapsed time : 1.753313

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_eGARCH_ged.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.01021362

# e GARCH Model with snorm distribution


spec1=ugarchspec(variance.model = list(model = "eGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "snorm")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : eGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : snorm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega -0.313586 0.028807 -10.886 0
## alpha1 -0.099608 0.008487 -11.736 0
## beta1 0.963170 0.003262 295.307 0
## gamma1 0.194723 0.013903 14.005 0
## skew 0.887312 0.015687 56.564 0
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega -0.313586 0.048584 -6.4545 0
## alpha1 -0.099608 0.016378 -6.0817 0
## beta1 0.963170 0.005390 178.6997 0
## gamma1 0.194723 0.023688 8.2202 0
## skew 0.887312 0.020394 43.5095 0
##
## LogLikelihood : 15017.8
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8678
## Bayes -5.8614
## Shibata -5.8678
## Hannan-Quinn -5.8656
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 6.707e-05 0.9935
## Lag[2*(p+q)+(p+q)-1][2] 9.507e-01 0.5145
## Lag[4*(p+q)+(p+q)-1][5] 1.559e+00 0.7255
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.9204 0.3374
## Lag[2*(p+q)+(p+q)-1][5] 2.1124 0.5921
## Lag[4*(p+q)+(p+q)-1][9] 3.0736 0.7468
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 1.567 0.500 2.000 0.2107
## ARCH Lag[5] 2.058 1.440 1.667 0.4585
## ARCH Lag[7] 2.410 2.315 1.543 0.6310
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 0.9648
## Individual Statistics:
## omega 0.15838
## alpha1 0.22462
## beta1 0.14755
## gamma1 0.03643
## skew 0.23775
##
## 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.1277 0.25950
## Negative Sign Bias 0.8106 0.41763
## Positive Sign Bias 1.9061 0.05669 *
## Joint Effect 10.1790 0.01710 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 78.18 3.820e-09
## 2 30 95.77 4.593e-09
## 3 40 104.18 7.572e-08
## 4 50 126.38 9.300e-09
##
##
## Elapsed time : 0.9803791
sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_eGARCH_snorm.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.01048793

# e GARCH Model with sstd distribution


spec1=ugarchspec(variance.model = list(model = "eGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "sstd")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : eGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : sstd
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega -0.28229 0.014362 -19.6556 0
## alpha1 -0.11074 0.009245 -11.9789 0
## beta1 0.96740 0.001619 597.6009 0
## gamma1 0.17536 0.017517 10.0112 0
## skew 0.91194 0.017281 52.7701 0
## shape 8.78852 1.052545 8.3498 0
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega -0.28229 0.015869 -17.7889 0
## alpha1 -0.11074 0.011092 -9.9836 0
## beta1 0.96740 0.001733 558.2215 0
## gamma1 0.17536 0.024134 7.2661 0
## skew 0.91194 0.016479 55.3384 0
## shape 8.78852 1.309494 6.7114 0
##
## LogLikelihood : 15082.41
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8927
## Bayes -5.8850
## Shibata -5.8927
## Hannan-Quinn -5.8900
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 5.685e-05 0.9940
## Lag[2*(p+q)+(p+q)-1][2] 9.489e-01 0.5151
## Lag[4*(p+q)+(p+q)-1][5] 1.579e+00 0.7204
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.2951 0.5869
## Lag[2*(p+q)+(p+q)-1][5] 2.0783 0.6000
## Lag[4*(p+q)+(p+q)-1][9] 3.6130 0.6550
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 2.780 0.500 2.000 0.09544
## ARCH Lag[5] 2.865 1.440 1.667 0.30998
## ARCH Lag[7] 3.660 2.315 1.543 0.39824
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 2.8734
## Individual Statistics:
## omega 0.6069
## alpha1 0.5019
## beta1 0.5851
## gamma1 0.1288
## skew 0.3986
## shape 1.1692
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.49 1.68 2.12
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 0.9569 0.33867
## Negative Sign Bias 0.8425 0.39954
## Positive Sign Bias 1.7300 0.08369 *
## Joint Effect 7.8451 0.04932 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 34.26 0.0171008
## 2 30 41.50 0.0621723
## 3 40 77.97 0.0002092
## 4 50 83.36 0.0015921
##
##
## Elapsed time : 1.836088

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_eGARCH_sstd.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.01006232

# e GARCH Model with sged distribution


spec1=ugarchspec(variance.model = list(model = "eGARCH", garchOrder = c(1,
1)),mean.model = list(armaOrder = c(0, 0),include.mean =
FALSE),distribution.model = "sged")
#Fit a GARCH model
garch_fit_1 = ugarchfit(spec = spec1, data = nikkei)
garch_fit_1

##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : eGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : sged
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega -0.29657 0.021802 -13.603 0
## alpha1 -0.10603 0.009328 -11.367 0
## beta1 0.96587 0.002488 388.190 0
## gamma1 0.18323 0.015670 11.693 0
## skew 0.91790 0.015419 59.529 0
## shape 1.47197 0.042966 34.259 0
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega -0.29657 0.024148 -12.2815 0
## alpha1 -0.10603 0.012467 -8.5046 0
## beta1 0.96587 0.002699 357.9258 0
## gamma1 0.18323 0.019846 9.2325 0
## skew 0.91790 0.016360 56.1065 0
## shape 1.47197 0.058886 24.9970 0
##
## LogLikelihood : 15078.84
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8913
## Bayes -5.8836
## Shibata -5.8913
## Hannan-Quinn -5.8886
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 1.312e-05 0.9971
## Lag[2*(p+q)+(p+q)-1][2] 9.534e-01 0.5136
## Lag[4*(p+q)+(p+q)-1][5] 1.575e+00 0.7215
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.5273 0.4678
## Lag[2*(p+q)+(p+q)-1][5] 1.9920 0.6203
## Lag[4*(p+q)+(p+q)-1][9] 3.2020 0.7252
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 2.192 0.500 2.000 0.1387
## ARCH Lag[5] 2.419 1.440 1.667 0.3859
## ARCH Lag[7] 2.968 2.315 1.543 0.5196
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 2.7473
## Individual Statistics:
## omega 0.37264
## alpha1 0.34340
## beta1 0.35513
## gamma1 0.07926
## skew 0.37724
## shape 0.89303
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.49 1.68 2.12
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.0299 0.30309
## Negative Sign Bias 0.8373 0.40245
## Positive Sign Bias 1.8129 0.06990 *
## Joint Effect 8.8384 0.03152 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 26.50 0.11680
## 2 30 37.35 0.13738
## 3 40 55.96 0.03839
## 4 50 71.91 0.01816
##
##
## Elapsed time : 3.02539

sigma=garch_fit_1@fit$sigma
write.csv(sigma,file="vol_estimates_eGARCH_sged.csv")
forc_1=ugarchforecast(garch_fit_1,n.ahead=1)
volforce=forc_1@forecast$sigmaFor
volforce

## 1984-01-05 05:30:00
## T+1 0.01023172

#CCC Portfolio VaR


rm(list=ls())
setwd("F:/TERM 5/FRMM/Assignments")
data=read.csv("Data.csv", header=T)
data1=cbind(data[,1],data[,2])
# CCC GARCH for two assets
library(ccgarch)
#Initial Values of the model coefficients
const=c(0.4,0.4)
arch_p=diag(2)
garch_p=diag(2)
corr_p=diag(2)
#Fit the model
garch_ccc <- eccc.estimation(const,arch_p,garch_p,corr_p,data1,
model="diagonal")
corr_1=garch_ccc$para.mat$R[1,2]
corr_1

## [1] 0.2172895

write.csv(garch_ccc$h,"CCC_GARCH_Var.csv")

You might also like