library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.2 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.2 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readxl)
library(rugarch)
## Warning: package 'rugarch' was built under R version 4.3.1
## Loading required package: parallel
##
## Attaching package: 'rugarch'
##
## The following object is masked from 'package:purrr':
##
## reduce
##
## The following object is masked from 'package:stats':
##
## sigma
library(VineCopula)
## Warning: package 'VineCopula' was built under R version 4.3.1
library(goftest)
data1 <- read_excel('C:/Users/Thanh Lan/Documents/DATAlast.xlsx')
TSX <- ts(data1$TSX)
TSVN <- ts(data1$TSVN)
autoarfima(TSX, ar.max = 2, ma.max = 2, criterion = "AIC", method = "full")
## $fit
##
## *----------------------------------*
## * ARFIMA Model Fit *
## *----------------------------------*
## Mean Model : ARFIMA(2,0,1)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## ar1 0.905060 0.015506 58.368 0
## ar2 -0.077398 0.002347 -32.971 0
## ma1 -0.984839 0.000009 -108804.170 0
## sigma 0.062061 0.001200 51.736 0
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## ar1 0.905060 0.012755 70.959 0
## ar2 -0.077398 0.002283 -33.907 0
## ma1 -0.984839 0.000004 -238162.091 0
## sigma 0.062061 0.002691 23.059 0
##
## LogLikelihood : 1817.896
##
## Information Criteria
## ------------------------------------
##
## Akaike -2.7154
## Bayes -2.6999
## Shibata -2.7154
## Hannan-Quinn -2.7096
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.03983 0.8418
## Lag[2*(p+q)+(p+q)-1][8] 12.99606 0.0000
## Lag[4*(p+q)+(p+q)-1][14] 42.00803 0.0000
##
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 4.864 0.027424
## Lag[2*(p+q)+(p+q)-1][2] 6.771 0.013716
## Lag[4*(p+q)+(p+q)-1][5] 10.638 0.006307
##
##
## ARCH LM Tests
## ------------------------------------
## Statistic DoF P-Value
## ARCH Lag[2] 9.205 2 1.003e-02
## ARCH Lag[5] 18.278 5 2.618e-03
## ARCH Lag[10] 67.679 10 1.241e-10
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 3.0936
## Individual Statistics:
## ar1 0.1303
## ar2 0.1893
## ma1 0.2446
## sigma 1.2500
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.07 1.24 1.6
## Individual Statistic: 0.35 0.47 0.75
##
##
## Elapsed time : 0.04197097
##
##
## $rank.matrix
## ar1 ar2 ma1 ma2 im arf AIC converged
## 1 1 1 1 0 0 0 -2.715413 1
## 2 1 0 1 1 0 0 -2.714649 1
## 3 1 1 1 0 1 0 -2.713996 1
## 4 1 0 1 1 1 0 -2.713254 1
## 5 0 1 1 1 0 0 -2.713011 1
## 6 0 1 1 1 1 0 -2.711660 1
## 7 1 1 1 1 0 0 -2.711521 1
## 8 1 1 1 1 1 0 -2.710169 1
## 9 1 1 0 1 1 0 -2.708656 1
## 10 0 1 0 1 0 0 -2.667983 1
## 11 0 1 0 1 1 0 -2.666506 1
## 12 1 1 0 1 0 0 -2.647098 1
## 13 0 0 0 1 0 0 -2.644799 1
## 14 0 1 0 0 0 0 -2.644738 1
## 15 0 0 1 0 0 0 -2.644310 1
## 16 1 0 0 0 0 0 -2.644304 1
## 17 0 0 0 0 1 0 -2.644241 1
## 18 0 0 1 1 0 0 -2.643404 1
## 19 1 0 0 1 0 0 -2.643392 1
## 20 0 1 1 0 0 0 -2.643329 1
## 21 1 1 0 0 0 0 -2.643319 1
## 22 0 0 0 1 1 0 -2.643312 1
## 23 0 1 0 0 1 0 -2.643251 1
## 24 0 0 1 0 1 0 -2.642823 1
## 25 1 0 0 0 1 0 -2.642818 1
## 26 1 0 1 0 0 0 -2.642809 1
## 27 0 0 1 1 1 0 -2.641918 1
## 28 1 0 0 1 1 0 -2.641906 1
## 29 0 1 1 0 1 0 -2.641843 1
## 30 1 1 0 0 1 0 -2.641833 1
## 31 1 0 1 0 1 0 -2.641322 1
autoarfima(TSVN, ar.max = 2, ma.max = 2, criterion = "AIC", method = "full")
## $fit
##
## *----------------------------------*
## * ARFIMA Model Fit *
## *----------------------------------*
## Mean Model : ARFIMA(2,0,2)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## ar1 0.00000 NA NA NA
## ar2 0.38912 0.036066 10.789 0
## ma1 -0.25910 0.023721 -10.923 0
## ma2 -0.64379 0.027921 -23.057 0
## sigma 0.05970 0.001155 51.691 0
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## ar1 0.00000 NA NA NA
## ar2 0.38912 0.054893 7.0887 0
## ma1 -0.25910 0.032356 -8.0078 0
## ma2 -0.64379 0.034722 -18.5414 0
## sigma 0.05970 0.002360 25.2962 0
##
## LogLikelihood : 1869.715
##
## Information Criteria
## ------------------------------------
##
## Akaike -2.7930
## Bayes -2.7774
## Shibata -2.7930
## Hannan-Quinn -2.7872
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.002303 0.961725
## Lag[2*(p+q)+(p+q)-1][11] 12.896603 0.000000
## Lag[4*(p+q)+(p+q)-1][19] 18.537460 0.001538
##
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 13.94 1.892e-04
## Lag[2*(p+q)+(p+q)-1][2] 25.84 1.307e-07
## Lag[4*(p+q)+(p+q)-1][5] 34.77 1.417e-09
##
##
## ARCH LM Tests
## ------------------------------------
## Statistic DoF P-Value
## ARCH Lag[2] 34.33 2 3.503e-08
## ARCH Lag[5] 38.10 5 3.603e-07
## ARCH Lag[10] 52.60 10 8.837e-08
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 3.2123
## Individual Statistics:
## ar2 0.1633
## ma1 0.2657
## ma2 0.2771
## sigma 0.8092
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.07 1.24 1.6
## Individual Statistic: 0.35 0.47 0.75
##
##
## Elapsed time : 0.165869
##
##
## $rank.matrix
## ar1 ar2 ma1 ma2 im arf AIC converged
## 1 0 1 1 1 0 0 -2.792987 1
## 2 1 1 1 1 0 0 -2.791621 1
## 3 0 1 1 1 1 0 -2.791514 1
## 4 1 0 1 1 0 0 -2.790961 1
## 5 1 1 1 0 0 0 -2.790702 1
## 6 1 1 1 1 1 0 -2.790149 1
## 7 1 0 1 0 0 0 -2.789616 1
## 8 1 0 1 1 1 0 -2.789489 1
## 9 1 1 1 0 1 0 -2.789230 1
## 10 1 1 0 1 0 0 -2.788634 1
## 11 1 0 1 0 1 0 -2.788142 1
## 12 1 1 0 1 1 0 -2.787159 1
## 13 0 0 1 1 0 0 -2.720560 1
## 14 0 0 1 1 1 0 -2.719070 1
## 15 1 0 0 1 0 0 -2.710612 1
## 16 1 0 0 1 1 0 -2.709119 1
## 17 0 1 1 0 0 0 -2.702017 1
## 18 0 1 1 0 1 0 -2.700523 1
## 19 1 1 0 0 0 0 -2.699674 1
## 20 1 1 0 0 1 0 -2.698180 1
## 21 0 1 0 1 0 0 -2.688082 1
## 22 0 1 0 1 1 0 -2.686588 1
## 23 0 0 0 1 0 0 -2.681386 1
## 24 0 0 0 1 1 0 -2.679891 1
## 25 0 0 1 0 0 0 -2.677996 1
## 26 0 1 0 0 0 0 -2.677261 1
## 27 0 0 1 0 1 0 -2.676500 1
## 28 0 1 0 0 1 0 -2.675766 1
## 29 1 0 0 0 0 0 -2.669007 1
## 30 1 0 0 0 1 0 -2.667511 1
## 31 0 0 0 0 1 0 -2.651976 1
# PHÂN PHỐI CHUẨN
TSX11n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'norm')
TSX11n <- ugarchfit(spec = TSX11n.spec, TSX)
# PHÂN PHỐI STUDENT
TSX11std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'std')
TSX11std <- ugarchfit(TSX11std.spec, TSX)
# PHÂN PHỐI ĐỐI XỨNG
TSX11sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'sstd')
TSX11sstd <- ugarchfit(TSX11sstd.spec, TSX)
# PHÂN PHỐI PHÂN PHỐI Generalized Error Distribution
TSX11ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = "ged")
TSX11ged <- ugarchfit(TSX11ged.spec, TSX)
# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSX11sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'sged')
TSX11sged <- ugarchfit(TSX11sged.spec, TSX)
# PHÂN PHỐI CHUẨN
TSX12n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'norm')
TSX12n <- ugarchfit(spec = TSX12n.spec, TSX)
# PHÂN PHỐI STUDENT
TSX12std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'std')
TSX12std <- ugarchfit(TSX12std.spec, TSX)
# PHÂN PHỐI ĐỐI XỨNG
TSX12sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'sstd')
TSX12sstd <- ugarchfit(TSX12sstd.spec, TSX)
# PHÂN PHỐI PHÂN PHỐI Generalized Error Distribution
TSX12ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = "ged")
TSX12ged <- ugarchfit(TSX12ged.spec, TSX)
# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSX12sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'sged')
TSX12sged <- ugarchfit(TSX12sged.spec, TSX)
# PHÂN PHỐI CHUẨN
TSX21n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'norm')
TSX21n <- ugarchfit(spec = TSX21n.spec, TSX)
# PHÂN PHỐI STUDENT
TSX21std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'std')
TSX21std <- ugarchfit(TSX21std.spec, TSX)
# PHÂN PHỐI ĐỐI XỨNG
TSX21sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'sstd')
TSX21sstd <- ugarchfit(TSX21sstd.spec, TSX)
# PHÂN PHỐI PHÂN PHỐI Generalized Error Distribution
TSX21ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = "ged")
TSX21ged <- ugarchfit(TSX21ged.spec, TSX)
# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSX21sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'sged')
TSX21sged <- ugarchfit(TSX21sged.spec, TSX)
# PHÂN PHỐI CHUẨN
TSX22n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'norm')
TSX22n <- ugarchfit(spec = TSX22n.spec, TSX)
# PHÂN PHỐI STUDENT
TSX22std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'std')
TSX22std <- ugarchfit(TSX22std.spec, TSX)
# PHÂN PHỐI ĐỐI XỨNG
TSX22sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'sstd')
TSX22sstd <- ugarchfit(TSX22sstd.spec, TSX)
# PHÂN PHỐI PHÂN PHỐI Generalized Error Distribution
TSX22ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = "ged")
TSX22ged <- ugarchfit(TSX22ged.spec, TSX)
# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSX22sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,1), include.mean = TRUE), distribution.model = 'sged')
TSX22sged <- ugarchfit(TSX22sged.spec, TSX)
# PHÂN PHỐI CHUẨN
TSVN11n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')
TSVN11n <- ugarchfit(spec = TSVN11n.spec, TSVN)
# PHÂN PHỐI STUDENT
TSVN11std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')
TSVN11std <- ugarchfit(TSVN11std.spec, TSVN)
# PHÂN PHỐI ĐỐI XỨNG
TSVN11sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')
TSVN11sstd <- ugarchfit(TSVN11sstd.spec, TSVN)
# PHÂN PHỐI PHÂN PHỐI Generalized Error Distribution
TSVN11ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
TSVN11ged <- ugarchfit(TSVN11ged.spec, TSVN)
# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSVN11sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')
TSVN11sged <- ugarchfit(TSVN11sged.spec, TSVN)
# PHÂN PHỐI CHUẨN
TSVN12n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')
TSVN12n <- ugarchfit(spec = TSVN12n.spec, TSVN)
# PHÂN PHỐI STUDENT
TSVN12std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')
TSVN12std <- ugarchfit(TSVN12std.spec, TSVN)
# PHÂN PHỐI ĐỐI XỨNG
TSVN12sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')
TSVN12sstd <- ugarchfit(TSVN12sstd.spec, TSVN)
# PHÂN PHỐI PHÂN PHỐI Generalized Error Distribution
TSVN12ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,2)), mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
TSVN12ged <- ugarchfit(TSVN12ged.spec, TSVN)
# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSVN12sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')
TSVN12sged <- ugarchfit(TSVN12sged.spec, TSVN)
# PHÂN PHỐI CHUẨN
TSVN21n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')
TSVN21n <- ugarchfit(spec = TSVN21n.spec, TSVN)
# PHÂN PHỐI STUDENT
TSVN21std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')
TSVN21std <- ugarchfit(TSVN21std.spec, TSVN)
# PHÂN PHỐI ĐỐI XỨNG
TSVN21sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')
TSVN21sstd <- ugarchfit(TSVN21sstd.spec, TSVN)
# PHÂN PHỐI PHÂN PHỐI Generalized Error Distribution
TSVN21ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,1)), mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
TSVN21ged <- ugarchfit(TSVN21ged.spec, TSVN)
# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSVN21sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')
TSVN21sged <- ugarchfit(TSVN21sged.spec, TSVN)
# PHÂN PHỐI CHUẨN
TSVN22n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')
TSVN22n <- ugarchfit(spec = TSVN22n.spec, TSVN)
# PHÂN PHỐI STUDENT
TSVN22std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')
TSVN22std <- ugarchfit(TSVN22std.spec, TSVN)
# PHÂN PHỐI ĐỐI XỨNG
TSVN22sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')
TSVN22sstd <- ugarchfit(TSVN22sstd.spec, TSVN)
# PHÂN PHỐI PHÂN PHỐI Generalized Error Distribution
TSVN22ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,2)), mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
TSVN22ged <- ugarchfit(TSVN22ged.spec, TSVN)
# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSVN22sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')
TSVN22sged <- ugarchfit(TSVN22sged.spec, TSVN)
TSX.model.list <- list(garch11n = TSX11n,
garch11std = TSX11std,
garch11sstd = TSX11sstd,
garch11ged = TSX11ged,
garch11sged = TSX11sged,
garch12n = TSX12n,
garch12std = TSX12std,
garch12sstd = TSX12sstd,
garch12ged = TSX12ged,
garch12sged = TSX12sged,
garch21n = TSX21n,
garch21std = TSX21std,
garch21sstd = TSX21sstd,
garch21ged = TSX21ged,
garch21sged = TSX21sged,
garch22n = TSX22n,
garch22std = TSX22std,
garch22sstd = TSX22sstd,
garch22ged = TSX22ged)
TSX.info.mat <- sapply(TSX.model.list, infocriteria)
rownames(TSX.info.mat) <- rownames(infocriteria(TSX11n))
TSX.info.mat
## garch11n garch11std garch11sstd garch11ged garch11sged garch12n
## Akaike -2.782007 -4.086703 -4.099832 -4.148079 -4.052338 -2.782974
## Bayes -2.750885 -4.051690 -4.060929 -4.113067 -4.013435 -2.747962
## Shibata -2.782079 -4.086793 -4.099943 -4.148169 -4.052449 -2.783064
## Hannan-Quinn -2.770346 -4.073584 -4.085255 -4.134960 -4.037761 -2.769855
## garch12std garch12sstd garch12ged garch12sged garch21n garch21std
## Akaike -4.085142 -4.095400 -4.150222 -4.137718 -2.807038 -4.072182
## Bayes -4.046239 -4.052607 -4.111319 -4.094925 -2.768136 -4.029389
## Shibata -4.085253 -4.095534 -4.150333 -4.137852 -2.807149 -4.072316
## Hannan-Quinn -4.070566 -4.079366 -4.135645 -4.121684 -2.792462 -4.056147
## garch21sstd garch21ged garch21sged garch22n garch22std
## Akaike -4.089476 -4.149383 -4.142275 -2.817898 -4.083227
## Bayes -4.042793 -4.106589 -4.095592 -2.775104 -4.036544
## Shibata -4.089636 -4.149517 -4.142435 -2.818032 -4.083387
## Hannan-Quinn -4.071984 -4.133348 -4.124783 -2.801863 -4.065735
## garch22sstd garch22ged
## Akaike -4.090694 -4.136800
## Bayes -4.040120 -4.090117
## Shibata -4.090880 -4.136960
## Hannan-Quinn -4.071744 -4.119308
TSX.inds <- which(TSX.info.mat == min(TSX.info.mat), arr.ind = TRUE)
model.TSX <- colnames(TSX.info.mat)[TSX.inds[,2]]
model.TSX
## [1] "garch12ged"
TSX12ged
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(1,2)
## Mean Model : ARFIMA(2,0,1)
## Distribution : ged
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu -0.000046 0.000002 -1.9017e+01 0.00000
## ar1 0.994777 0.001925 5.1671e+02 0.00000
## ar2 -0.005837 0.000078 -7.4461e+01 0.00000
## ma1 -0.988738 0.000246 -4.0207e+03 0.00000
## omega 0.000004 0.000005 9.0451e-01 0.36572
## alpha1 0.000019 0.007386 2.5980e-03 0.99793
## beta1 0.956017 0.000035 2.7245e+04 0.00000
## beta2 0.040183 0.000190 2.1119e+02 0.00000
## gamma1 0.004942 0.014604 3.3838e-01 0.73508
## shape 0.397799 0.015977 2.4898e+01 0.00000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu -0.000046 0.000004 -1.0414e+01 0.00000
## ar1 0.994777 0.023296 4.2701e+01 0.00000
## ar2 -0.005837 0.000097 -6.0278e+01 0.00000
## ma1 -0.988738 0.000647 -1.5278e+03 0.00000
## omega 0.000004 0.000005 8.0018e-01 0.42361
## alpha1 0.000019 0.013247 1.4490e-03 0.99884
## beta1 0.956017 0.000062 1.5483e+04 0.00000
## beta2 0.040183 0.000244 1.6495e+02 0.00000
## gamma1 0.004942 0.026805 1.8437e-01 0.85373
## shape 0.397799 0.016714 2.3800e+01 0.00000
##
## LogLikelihood : 2782.348
##
## Information Criteria
## ------------------------------------
##
## Akaike -4.1502
## Bayes -4.1113
## Shibata -4.1503
## Hannan-Quinn -4.1356
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.312 0.5764
## Lag[2*(p+q)+(p+q)-1][8] 15.586 0.0000
## Lag[4*(p+q)+(p+q)-1][14] 56.965 0.0000
## d.o.f=3
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 5.081 2.419e-02
## Lag[2*(p+q)+(p+q)-1][8] 25.922 3.009e-06
## Lag[4*(p+q)+(p+q)-1][14] 59.441 8.349e-14
## d.o.f=3
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[4] 1.238 0.500 2.000 2.658e-01
## ARCH Lag[6] 7.051 1.461 1.711 3.876e-02
## ARCH Lag[8] 39.894 2.368 1.583 8.183e-10
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 172.687
## Individual Statistics:
## mu 0.32499
## ar1 0.77199
## ar2 0.86216
## ma1 0.76827
## omega 0.51673
## alpha1 0.10253
## beta1 0.08019
## beta2 0.08021
## gamma1 0.08204
## shape 0.04262
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 2.29 2.54 3.05
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.483 0.13826
## Negative Sign Bias 1.787 0.07417 *
## Positive Sign Bias 1.581 0.11413
## Joint Effect 8.154 0.04293 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 153.6 4.517e-23
## 2 30 167.9 1.713e-21
## 3 40 205.4 1.769e-24
## 4 50 251.0 6.414e-29
##
##
## Elapsed time : 1.73164
TSVN.model.list <- list(garch11n = TSVN11n,
garch11std = TSVN11std,
garch11sstd = TSVN11sstd,
garch11ged = TSVN11ged,
garch12n = TSVN12n,
garch12std = TSVN12std,
garch12sstd = TSVN12sstd,
garch12ged = TSVN12ged,
garch12sged = TSVN12sged,
garch21n = TSVN21n,
garch21std = TSVN21std,
garch21sstd = TSVN21sstd,
garch21ged = TSVN21ged,
garch22n = TSVN22n,
garch22std = TSVN22std,
garch22sstd = TSVN22sstd,
garch22sged = TSVN22sged)
TSVN.info.mat <- sapply(TSVN.model.list, infocriteria)
rownames(TSVN.info.mat) <- rownames(infocriteria(TSVN11n))
TSVN.info.mat
## garch11n garch11std garch11sstd garch11ged garch12n garch12std
## Akaike -2.939318 -3.692566 -3.698011 -3.703356 -2.940722 -3.691069
## Bayes -2.904305 -3.653663 -3.655218 -3.664453 -2.901819 -3.648276
## Shibata -2.939408 -3.692677 -3.698145 -3.703467 -2.940832 -3.691203
## Hannan-Quinn -2.926199 -3.677990 -3.681977 -3.688779 -2.926145 -3.675035
## garch12sstd garch12ged garch12sged garch21n garch21std
## Akaike -3.695381 -3.691918 -3.683674 -2.954624 -3.550984
## Bayes -3.648697 -3.649125 -3.636990 -2.911830 -3.504300
## Shibata -3.695540 -3.692052 -3.683833 -2.954758 -3.551143
## Hannan-Quinn -3.677889 -3.675884 -3.666181 -2.938589 -3.533492
## garch21sstd garch21ged garch22n garch22std garch22sstd
## Akaike -3.556003 -3.735582 -2.930915 -3.688140 -3.541317
## Bayes -3.505429 -3.688899 -2.884231 -3.637566 -3.486853
## Shibata -3.556190 -3.735742 -2.931074 -3.688327 -3.541533
## Hannan-Quinn -3.537053 -3.718090 -2.913423 -3.669190 -3.520909
## garch22sged
## Akaike -3.733338
## Bayes -3.678874
## Shibata -3.733555
## Hannan-Quinn -3.712931
TSVN.inds <- which(TSVN.info.mat == min(TSVN.info.mat), arr.ind = TRUE)
model.TSVN <- colnames(TSVN.info.mat)[TSVN.inds[,2]]
model.TSVN
## [1] "garch21ged"
TSVN21ged
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(2,1)
## Mean Model : ARFIMA(2,0,2)
## Distribution : ged
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000847 0.000032 26.454142 0.00000
## ar1 -0.029555 0.001417 -20.854396 0.00000
## ar2 0.426059 0.005979 71.257861 0.00000
## ma1 0.010571 0.000510 20.739982 0.00000
## ma2 -0.440571 0.005196 -84.783373 0.00000
## omega 0.000012 0.000010 1.201771 0.22945
## alpha1 0.000143 0.000267 0.536355 0.59171
## alpha2 0.000032 0.001794 0.017757 0.98583
## beta1 0.974988 0.000231 4218.032420 0.00000
## gamma1 0.815996 0.007716 105.760197 0.00000
## gamma2 -0.768328 0.001561 -492.072125 0.00000
## shape 0.467730 0.017513 26.707308 0.00000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000847 0.000235 3.602595 0.000315
## ar1 -0.029555 0.010885 -2.715238 0.006623
## ar2 0.426059 0.050933 8.365007 0.000000
## ma1 0.010571 0.003490 3.029374 0.002451
## ma2 -0.440571 0.043046 -10.234901 0.000000
## omega 0.000012 0.000015 0.814780 0.415198
## alpha1 0.000143 0.000592 0.241789 0.808943
## alpha2 0.000032 0.000792 0.040205 0.967929
## beta1 0.974988 0.000862 1131.018264 0.000000
## gamma1 0.815996 0.011101 73.508065 0.000000
## gamma2 -0.768328 0.003938 -195.109789 0.000000
## shape 0.467730 0.021348 21.909696 0.000000
##
## LogLikelihood : 2507.369
##
## Information Criteria
## ------------------------------------
##
## Akaike -3.7356
## Bayes -3.6889
## Shibata -3.7357
## Hannan-Quinn -3.7181
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 9.736 0.001807
## Lag[2*(p+q)+(p+q)-1][11] 43.959 0.000000
## Lag[4*(p+q)+(p+q)-1][19] 50.855 0.000000
## d.o.f=4
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.457 0.4990
## Lag[2*(p+q)+(p+q)-1][8] 1.983 0.8615
## Lag[4*(p+q)+(p+q)-1][14] 6.177 0.6150
## d.o.f=3
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[4] 0.0672 0.500 2.000 0.7955
## ARCH Lag[6] 0.1880 1.461 1.711 0.9712
## ARCH Lag[8] 0.6998 2.368 1.583 0.9631
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 14.2131
## Individual Statistics:
## mu 0.5676
## ar1 0.7201
## ar2 0.5440
## ma1 0.7255
## ma2 0.5310
## omega 0.6464
## alpha1 1.2095
## alpha2 1.0135
## beta1 1.1015
## gamma1 1.0558
## gamma2 1.0222
## shape 0.7552
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 2.69 2.96 3.51
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 0.8153 0.4151
## Negative Sign Bias 1.4432 0.1492
## Positive Sign Bias 1.2222 0.2218
## Joint Effect 3.6459 0.3023
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 67.05 2.821e-07
## 2 30 78.45 1.951e-06
## 3 40 103.10 1.075e-07
## 4 50 108.91 1.918e-06
##
##
## Elapsed time : 2.858546
TSX.res <- residuals(TSX12ged)/sigma(TSX12ged)
fitdist(distribution = 'ged' , TSX.res, control = list())$pars
## mu sigma shape
## 0.000632791 0.953510801 0.405571674
s <- pdist(distribution = 'ged' , q = TSX.res, mu = 0.000632791 , sigma = 0.953510801, shape = 0.405571674)
TSVN.res <- residuals(TSVN21ged)/sigma(TSVN21ged)
fitdist(distribution = 'ged' , TSVN.res, control = list())$pars
## Warning in .safefunx(tmpv, .solnp_fun, .env, ...):
## solnp-->warning: NaN detected in function call...check your function
## mu sigma shape
## 0.02541317 1.11548994 0.44954935
v <- pdist(distribution = 'ged' , q = TSVN.res, mu = 0.02541317 , sigma = 1.11548994, shape = 0.44954935)
# Kiểm định Anderson-Darling
ad.test(s, 'punif')
##
## Anderson-Darling test of goodness-of-fit
## Null hypothesis: uniform distribution
## Parameters assumed to be fixed
##
## data: s
## An = 5.6552, p-value = 0.001402
ad.test(v, 'punif')
##
## Anderson-Darling test of goodness-of-fit
## Null hypothesis: uniform distribution
## Parameters assumed to be fixed
##
## data: v
## An = 3.3608, p-value = 0.01803
# Kiểm định Cramer-von Mises
cvm.test(s, 'punif')
##
## Cramer-von Mises test of goodness-of-fit
## Null hypothesis: uniform distribution
## Parameters assumed to be fixed
##
## data: s
## omega2 = 0.81824, p-value = 0.006607
cvm.test(v, 'punif')
##
## Cramer-von Mises test of goodness-of-fit
## Null hypothesis: uniform distribution
## Parameters assumed to be fixed
##
## data: v
## omega2 = 0.51974, p-value = 0.03549
# Kiểm định ks-test
ks.test(s, 'punif')
##
## Asymptotic one-sample Kolmogorov-Smirnov test
##
## data: s
## D = 0.048236, p-value = 0.003991
## alternative hypothesis: two-sided
ks.test(v, 'punif')
##
## Asymptotic one-sample Kolmogorov-Smirnov test
##
## data: v
## D = 0.044585, p-value = 0.00987
## alternative hypothesis: two-sided
BiCopSelect(s, v, familyset = 1:9, selectioncrit = 'AIC', indeptest = FALSE, level = 0.05)
## Bivariate copula: t (par = -0.02, par2 = 4.66, tau = -0.01)
Stu <- BiCopEst(s, v, family = 2, method = 'mle', se = T, max.df = 10)
summary(Stu)
## Family
## ------
## No: 2
## Name: t
##
## Parameter(s)
## ------------
## par: -0.02 (SE = 0.03)
## par2: 4.66 (SE = 0.6)
## Dependence measures
## -------------------
## Kendall's tau: -0.01 (empirical = -0.01, p value = 0.56)
## Upper TD: 0.05
## Lower TD: 0.05
##
## Fit statistics
## --------------
## logLik: 39.7
## AIC: -75.4
## BIC: -65.01