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)
data <- read_excel('C:/Users/Thanh Lan/Documents/DATAlast.xlsx')

1 TRƯỚC COVID

databf <- data %>% filter(DATE < ymd(20200101))
TSXbf <- ts(databf$TSX)
TSVNbf <- ts(databf$TSVN)

1.1 MÔ HÌNH ARMA

autoarfima(TSXbf, 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|)
## mu    -0.000791    0.000000  -9051.698        0
## ar1    0.000000          NA         NA       NA
## ar2    0.706610    0.007644     92.438        0
## ma1   -0.115667    0.000053  -2187.891        0
## ma2   -0.918501    0.000015 -60981.410        0
## sigma  0.050613    0.001308     38.701        0
## 
## Robust Standard Errors:
##        Estimate  Std. Error    t value Pr(>|t|)
## mu    -0.000791    0.000000 -11663.247        0
## ar1    0.000000          NA         NA       NA
## ar2    0.706610    0.018171     38.887        0
## ma1   -0.115667    0.000081  -1431.834        0
## ma2   -0.918501    0.000021 -44037.964        0
## sigma  0.050613    0.002960     17.100        0
## 
## LogLikelihood : 762.1124 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -3.1093
## Bayes        -3.0663
## Shibata      -3.1095
## Hannan-Quinn -3.0924
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic   p-value
## Lag[1]                      0.1667 6.831e-01
## Lag[2*(p+q)+(p+q)-1][11]   18.5096 0.000e+00
## Lag[4*(p+q)+(p+q)-1][19]   35.8677 3.513e-12
## 
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                      1.426  0.2325
## Lag[2*(p+q)+(p+q)-1][2]     1.689  0.3200
## Lag[4*(p+q)+(p+q)-1][5]     3.330  0.3501
## 
## 
## ARCH LM Tests
## ------------------------------------
##              Statistic DoF   P-Value
## ARCH Lag[2]      2.040   2 3.606e-01
## ARCH Lag[5]      6.855   5 2.317e-01
## ARCH Lag[10]    68.713  10 7.854e-11
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  6.1962
## Individual Statistics:              
## mu    0.005382
## ar2   0.013610
## ma1   0.005936
## ma2   0.005978
## sigma 0.195077
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          1.28 1.47 1.88
## Individual Statistic:     0.35 0.47 0.75
## 
## 
## Elapsed time : 0.101733 
## 
## 
## $rank.matrix
##    ar1 ar2 ma1 ma2 im arf       AIC converged
## 1    0   1   1   1  1   0 -3.109291         1
## 2    1   1   0   1  0   0 -3.079920         1
## 3    1   1   0   1  1   0 -3.078241         1
## 4    1   1   1   1  0   0 -3.077839         1
## 5    1   1   1   1  1   0 -3.077299         1
## 6    0   1   1   1  0   0 -3.077053         1
## 7    1   0   1   0  0   0 -3.072672         1
## 8    1   0   1   0  1   0 -3.072211         1
## 9    1   1   1   0  0   0 -3.071854         1
## 10   1   0   1   1  0   0 -3.071295         1
## 11   1   1   1   0  1   0 -3.071232         1
## 12   1   0   1   1  1   0 -3.070706         1
## 13   0   1   0   1  0   0 -3.057465         1
## 14   0   1   0   1  1   0 -3.053915         1
## 15   0   0   1   0  0   0 -3.009988         1
## 16   1   0   0   0  0   0 -3.009944         1
## 17   0   0   0   1  0   0 -3.008819         1
## 18   0   1   0   0  0   0 -3.008802         1
## 19   0   0   0   0  1   0 -3.008697         1
## 20   0   0   1   1  0   0 -3.006166         1
## 21   1   0   0   1  0   0 -3.006130         1
## 22   0   1   1   0  0   0 -3.006108         1
## 23   1   1   0   0  0   0 -3.006074         1
## 24   0   0   1   0  1   0 -3.005980         1
## 25   1   0   0   0  1   0 -3.005936         1
## 26   0   0   0   1  1   0 -3.004806         1
## 27   0   1   0   0  1   0 -3.004787         1
## 28   0   0   1   1  1   0 -3.002161         1
## 29   1   0   0   1  1   0 -3.002125         1
## 30   0   1   1   0  1   0 -3.002102         1
## 31   1   1   0   0  1   0 -3.002068         1
autoarfima(TSVNbf, 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.407927    0.037818  -10.787        0
## ar2    0.557276    0.040686   13.697        0
## ma1    0.000000          NA       NA       NA
## ma2   -0.916797    0.020924  -43.816        0
## sigma  0.043588    0.001397   31.205        0
## 
## Robust Standard Errors:
##        Estimate  Std. Error  t value Pr(>|t|)
## ar1   -0.407927    0.053298  -7.6538        0
## ar2    0.557276    0.052907  10.5331        0
## ma1    0.000000          NA       NA       NA
## ma2   -0.916797    0.017733 -51.6994        0
## sigma  0.043588    0.002131  20.4532        0
## 
## LogLikelihood : 834.7337 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -3.4116
## Bayes        -3.3772
## Shibata      -3.4118
## Hannan-Quinn -3.3981
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                     0.01843  0.8920
## Lag[2*(p+q)+(p+q)-1][11]   4.83658  0.9791
## Lag[4*(p+q)+(p+q)-1][19]   8.41593  0.7332
## 
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic   p-value
## Lag[1]                      47.55 5.354e-12
## Lag[2*(p+q)+(p+q)-1][2]     56.64 1.110e-15
## Lag[4*(p+q)+(p+q)-1][5]     76.26 0.000e+00
## 
## 
## ARCH LM Tests
## ------------------------------------
##              Statistic DoF   P-Value
## ARCH Lag[2]      53.66   2 2.223e-12
## ARCH Lag[5]      59.96   5 1.237e-11
## ARCH Lag[10]     62.86  10 1.038e-09
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  5.0015
## Individual Statistics:             
## ar1   0.04744
## ar2   0.07879
## ma2   0.08999
## sigma 4.28695
## 
## 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.0619452 
## 
## 
## $rank.matrix
##    ar1 ar2 ma1 ma2 im arf       AIC converged
## 1    1   1   0   1  0   0 -3.411637         1
## 2    1   1   0   1  1   0 -3.410908         1
## 3    1   0   1   0  0   0 -3.406675         1
## 4    1   0   1   0  1   0 -3.405789         1
## 5    1   1   1   0  0   0 -3.403499         1
## 6    1   0   1   1  0   0 -3.403451         1
## 7    0   1   1   1  0   0 -3.403292         1
## 8    1   0   1   1  1   0 -3.402663         1
## 9    1   1   1   0  1   0 -3.402641         1
## 10   0   1   1   1  1   0 -3.402408         1
## 11   1   1   1   1  0   0 -3.399415         1
## 12   1   1   1   1  1   0 -3.398556         1
## 13   0   0   1   1  0   0 -3.335949         1
## 14   0   0   1   1  1   0 -3.332806         1
## 15   1   0   0   1  0   0 -3.304910         1
## 16   1   0   0   1  1   0 -3.300912         1
## 17   0   1   1   0  0   0 -3.298028         1
## 18   0   1   1   0  1   0 -3.293992         1
## 19   0   0   1   0  0   0 -3.291296         1
## 20   0   0   1   0  1   0 -3.287280         1
## 21   1   1   0   0  0   0 -3.285792         1
## 22   1   1   0   0  1   0 -3.281749         1
## 23   1   0   0   0  0   0 -3.263267         1
## 24   1   0   0   0  1   0 -3.259225         1
## 25   0   0   0   1  0   0 -3.210717         1
## 26   0   1   0   0  0   0 -3.210228         1
## 27   0   1   0   1  0   0 -3.207387         1
## 28   0   0   0   1  1   0 -3.206653         1
## 29   0   1   0   0  1   0 -3.206164         1
## 30   0   1   0   1  1   0 -3.203325         1
## 31   0   0   0   0  1   0 -3.201651         1

1.2 MÔ HÌNH GJR-GARCH

1.2.1 CÁC DẠNG MÔ HÌNH CHO CHUỖI LỢI SUẤT TSX

1.2.1.1 GJR-GARCH(11)TSXbf

# PHÂN PHỐI CHUẨN
TSXbf11n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSXbf11n <- ugarchfit(spec = TSXbf11n.spec, TSXbf)


# PHÂN PHỐI STUDENT
TSXbf11std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSXbf11std <- ugarchfit(TSXbf11std.spec, TSXbf)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSXbf11sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSXbf11sstd <- ugarchfit(TSXbf11sstd.spec, TSXbf)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSXbf11ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")

TSXbf11ged <- ugarchfit(TSXbf11ged.spec, TSXbf) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSXbf11sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSXbf11sged <- ugarchfit(TSXbf11sged.spec, TSXbf)

1.2.1.2 GJR-GARCH(12)TSXbf

# PHÂN PHỐI CHUẨN
TSXbf12n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSXbf12n <- ugarchfit(TSXbf12n.spec, TSXbf)

# PHÂN PHỐI STUDENT
TSXbf12std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSXbf12std <- ugarchfit(TSXbf12std.spec, TSXbf)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSXbf12sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSXbf12sstd <- ugarchfit(TSXbf12sstd.spec, TSXbf)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSXbf12ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSXbf12ged <- ugarchfit(TSXbf12ged.spec, TSXbf) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSXbf12sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSXbf12sged <- ugarchfit(TSXbf12sged.spec, TSXbf)

1.2.1.3 GJR-GARCH(21)TSXbf

# PHÂN PHỐI CHUẨN
TSXbf21n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSXbf21n <- ugarchfit(TSXbf21n.spec, TSXbf)

# PHÂN PHỐI STUDENT
TSXbf21std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSXbf21std <- ugarchfit(TSXbf21std.spec, TSXbf)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSXbf21sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSXbf21sstd <- ugarchfit(TSXbf21sstd.spec, TSXbf)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSXbf21ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSXbf21ged <- ugarchfit(TSXbf21ged.spec, TSXbf) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged) 
TSXbf21sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSXbf21sged <- ugarchfit(TSXbf21sged.spec, TSXbf)

1.2.1.4 GJR-GARCH(22)TSXbf

# PHÂN PHỐI CHUẨN
TSXbf22n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSXbf22n <- ugarchfit(TSXbf22n.spec, TSXbf)

# PHÂN PHỐI STUDENT
TSXbf22std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSXbf22std <- ugarchfit(TSXbf22std.spec, TSXbf)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSXbf22sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSXbf22sstd <- ugarchfit(TSXbf22sstd.spec, TSXbf)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSXbf22ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSXbf22ged <- ugarchfit(TSXbf22ged.spec, TSXbf) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSXbf22sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSXbf22sged <- ugarchfit(TSXbf22sged.spec, TSXbf)

1.2.2 CÁC DẠNG MÔ HÌNH CHO CHUỖI LỢI SUẤT TSVN

1.2.2.1 GJR-GARCH(11)TSVNbf

# PHÂN PHỐI CHUẨN
TSVNbf11n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model =  'norm')

TSVNbf11n <- ugarchfit(TSVNbf11n.spec, TSVNbf)

# PHÂN PHỐI STUDENT
TSVNbf11std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSVNbf11std <- ugarchfit(spec = TSVNbf11std.spec, data = TSVNbf)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSVNbf11sstd.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSVNbf11sstd <- ugarchfit(TSVNbf11sstd.spec, TSVNbf)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSVNbf11ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSVNbf11ged <- ugarchfit(TSVNbf11ged.spec, TSVNbf) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged) 
TSVNbf11sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSVNbf11sged <- ugarchfit(TSVNbf11sged.spec, TSVNbf)

1.2.2.2 GJR-GARCH(12)TSVNbf

# PHÂN PHỐI CHUẨN
TSVNbf12n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSVNbf12n <- ugarchfit(TSVNbf12n.spec, TSVNbf)

# PHÂN PHỐI STUDENT
TSVNbf12std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSVNbf12std <- ugarchfit(TSVNbf12std.spec, TSVNbf)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSVNbf12sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSVNbf12sstd <- ugarchfit(TSVNbf12sstd.spec, TSVNbf)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSVNbf12ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSVNbf12ged <- ugarchfit(TSVNbf12ged.spec, TSVNbf) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged) 
TSVNbf12sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSVNbf12sged <- ugarchfit(TSVNbf12sged.spec, TSVNbf)

1.2.2.3 GJR-GARCH(21)TSVNbf

# PHÂN PHỐI CHUẨN
TSVNbf21n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSVNbf21n <- ugarchfit(TSVNbf21n.spec, TSVNbf)

# PHÂN PHỐI STUDENT
TSVNbf21std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSVNbf21std <- ugarchfit(TSVNbf21std.spec, TSVNbf)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSVNbf21sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSVNbf21sstd <- ugarchfit(TSVNbf21sstd.spec, TSVNbf)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSVNbf21ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSVNbf21ged <- ugarchfit(TSVNbf21ged.spec, TSVNbf) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSVNbf21sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSVNbf21sged <- ugarchfit(TSVNbf21sged.spec, TSVNbf)

1.2.2.4 GJR-GARCH(22)TSVNbf

# PHÂN PHỐI CHUẨN
TSVNbf22n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSVNbf22n <- ugarchfit(TSVNbf22n.spec, TSVNbf)

# PHÂN PHỐI STUDENT
TSVNbf22std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSVNbf22std <- ugarchfit(TSVNbf22std.spec, TSVNbf)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSVNbf22sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSVNbf22sstd <- ugarchfit(TSVNbf22sstd.spec, TSVNbf)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSVNbf22ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSVNbf22ged <- ugarchfit(TSVNbf22ged.spec, TSVNbf) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged) 
TSVNbf22sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSVNbf22sged <- ugarchfit(TSVNbf22sged.spec, TSVNbf)

1.3 LỰA CHỌN MÔ HÌNH GJR-GARCH

1.3.1 LỰA CHỌN MÔ HÌNH BIÊN PHÙ HỢP NHẤT CHO CHUỖI TSXbf

TSXbf.model.list <- list(garch11n = TSXbf11n, 
                        garch11std = TSXbf11std,
                        garch11sstd = TSXbf11sstd,
                        garch11ged = TSXbf11ged,
                        garch11sged = TSXbf11sged,
                        
                        garch12n = TSXbf12n, 
                        garch12std = TSXbf12std,
                       garch12sstd = TSXbf12sstd,
                        garch12ged = TSXbf12ged,
                        garch12sged = TSXbf12sged,
                        
                        garch21n = TSXbf21n, 
                        garch21std = TSXbf21std,
                        garch21sstd = TSXbf21sstd,
                        garch21ged = TSXbf21ged,
                        garch21sged = TSXbf21sged,
                        
                        garch22n = TSXbf22n, 
                        garch22sstd = TSXbf22sstd)

TSXbf.info.mat <- sapply(TSXbf.model.list, infocriteria)

rownames(TSXbf.info.mat) <- rownames(infocriteria(TSXbf11n))

TSXbf.info.mat
##               garch11n garch11std garch11sstd garch11ged garch11sged  garch12n
## Akaike       -3.166518  -4.286883   -4.288578  -4.318377   -4.311625 -3.162415
## Bayes        -3.089116  -4.200881   -4.193977  -4.232376   -4.217023 -3.076413
## Shibata      -3.167184  -4.287703   -4.289569  -4.319198   -4.312615 -3.163236
## Hannan-Quinn -3.136112  -4.253098   -4.251415  -4.284593   -4.274462 -3.128630
##              garch12std garch12sstd garch12ged garch12sged  garch21n garch21std
## Akaike        -4.279452   -4.289255  -4.288580   -4.282941 -3.187011  -4.281015
## Bayes         -4.184851   -4.186054  -4.193978   -4.179740 -3.092410  -4.177814
## Shibata       -4.280443   -4.290431  -4.289570   -4.284117 -3.188002  -4.282191
## Hannan-Quinn  -4.242289   -4.248714  -4.251417   -4.242400 -3.149848  -4.240474
##              garch21sstd garch21ged garch21sged  garch22n garch22sstd
## Akaike         -4.244497  -4.128885   -4.078341 -3.178386   -4.268268
## Bayes          -4.132696  -4.025684   -3.966539 -3.075184   -4.147866
## Shibata        -4.245874  -4.130061   -4.079718 -3.179562   -4.269860
## Hannan-Quinn   -4.200577  -4.088344   -4.034421 -3.137844   -4.220969
TSXbf.inds <- which(TSXbf.info.mat == min(TSXbf.info.mat), arr.ind = TRUE)

colnames(TSXbf.info.mat)[TSXbf.inds[,2]]
## [1] "garch11ged"
TSXbf11ged
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : gjrGARCH(1,1)
## Mean Model   : ARFIMA(2,0,2)
## Distribution : ged 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error     t value Pr(>|t|)
## mu      0.000000    0.000003 -5.7011e-02  0.95454
## ar1     0.475031    0.000201  2.3684e+03  0.00000
## ar2     0.314639    0.000296  1.0645e+03  0.00000
## ma1    -0.475063    0.000193 -2.4606e+03  0.00000
## ma2    -0.314630    0.000293 -1.0729e+03  0.00000
## omega   0.000008    0.000001  8.3310e+00  0.00000
## alpha1  0.009835    0.019940  4.9323e-01  0.62185
## beta1   0.995959    0.000917  1.0855e+03  0.00000
## gamma1 -0.018896    0.041606 -4.5416e-01  0.64971
## shape   0.402339    0.024327  1.6539e+01  0.00000
## 
## Robust Standard Errors:
##         Estimate  Std. Error     t value Pr(>|t|)
## mu      0.000000    0.000060   -0.003114  0.99752
## ar1     0.475031    0.013380   35.502512  0.00000
## ar2     0.314639    0.009226   34.102886  0.00000
## ma1    -0.475063    0.013407  -35.434075  0.00000
## ma2    -0.314630    0.009240  -34.049525  0.00000
## omega   0.000008    0.000001    8.671350  0.00000
## alpha1  0.009835    0.022450    0.438083  0.66133
## beta1   0.995959    0.000291 3420.975511  0.00000
## gamma1 -0.018896    0.046596   -0.405530  0.68509
## shape   0.402339    0.040344    9.972638  0.00000
## 
## LogLikelihood : 1061.525 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -4.3184
## Bayes        -4.2324
## Shibata      -4.3192
## Hannan-Quinn -4.2846
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic   p-value
## Lag[1]                      0.7268 3.939e-01
## Lag[2*(p+q)+(p+q)-1][11]   20.0060 0.000e+00
## Lag[4*(p+q)+(p+q)-1][19]   40.1603 1.166e-14
## d.o.f=4
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic   p-value
## Lag[1]                      1.517 0.2180791
## Lag[2*(p+q)+(p+q)-1][5]     4.470 0.2009705
## Lag[4*(p+q)+(p+q)-1][9]    20.209 0.0001774
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[3]     1.576 0.500 2.000  0.2093
## ARCH Lag[5]     3.523 1.440 1.667  0.2224
## ARCH Lag[7]     4.579 2.315 1.543  0.2707
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  22.142
## Individual Statistics:              
## mu     0.13163
## ar1    2.97390
## ar2    0.79306
## ma1    2.97419
## ma2    0.79320
## omega  0.07523
## alpha1 0.04590
## beta1  0.03226
## gamma1 0.03545
## shape  0.04485
## 
## 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.8693 0.06219   *
## Negative Sign Bias  1.1483 0.25142    
## Positive Sign Bias  0.9156 0.36034    
## Joint Effect        6.2832 0.09861   *
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     67.37    2.499e-07
## 2    30     81.40    7.218e-07
## 3    40     97.89    5.741e-07
## 4    50    117.41    1.521e-07
## 
## 
## Elapsed time : 1.263251

1.3.2 LỰA CHỌN MÔ HÌNH BIÊN PHÙ HỢP NHẤT CHO TSVN

TSVNbf.model.list <- list(TSVNbf11n = TSVNbf11n, 
                        TSVNbf11std = TSVNbf11std,
                        TSVNbf11sstd = TSVNbf11sstd,
                        TSVNbf11ged = TSVNbf11ged,
                        
                        
                        TSVNbf12n = TSVNbf12n, 
                        TSVNbf12std = TSVNbf12std,
                        TSVNbf12sstd = TSVNbf12sstd,
                        TSVNbf12ged = TSVNbf12ged,
                        TSVNbf12sged = TSVNbf12sged,
                        
                       TSVNbf21n = TSVNbf21n, 
                       TSVNbf21std = TSVNbf21std,
                        TSVNbf21sstd = TSVNbf21sstd,
                        TSVNbf21sged = TSVNbf21sged,
                        
                       TSVNbf22n = TSVNbf22n, 
                        TSVNbf22std = TSVNbf22std,
                        TSVNbf22sstd = TSVNbf22sstd,
                        TSVNbf22ged = TSVNbf22ged,
                        TSVNbf22sged = TSVNbf22sged)

TSVNbf.info.mat <- sapply(TSVNbf.model.list, infocriteria)

rownames(TSVNbf.info.mat) <- rownames(infocriteria(TSVNbf11n))

TSVNbf.info.mat
##              TSVNbf11n TSVNbf11std TSVNbf11sstd TSVNbf11ged TSVNbf12n
## Akaike       -3.583890   -4.163137    -4.166940   -4.029580 -3.593860
## Bayes        -3.506489   -4.077136    -4.072339   -3.943578 -3.507858
## Shibata      -3.584557   -4.163958    -4.167931   -4.030401 -3.594680
## Hannan-Quinn -3.553484   -4.129353    -4.129777   -3.995795 -3.560075
##              TSVNbf12std TSVNbf12sstd TSVNbf12ged TSVNbf12sged TSVNbf21n
## Akaike         -4.160047    -4.164031   -4.167389    -4.056741 -3.639699
## Bayes          -4.065446    -4.060830   -4.072788    -3.953539 -3.545098
## Shibata        -4.161038    -4.165207   -4.168380    -4.057916 -3.640690
## Hannan-Quinn   -4.122884    -4.123490   -4.130226    -4.016199 -3.602536
##              TSVNbf21std TSVNbf21sstd TSVNbf21sged TSVNbf22n TSVNbf22std
## Akaike         -4.155229    -4.159176    -4.114584 -3.635594   -4.136810
## Bayes          -4.052028    -4.047374    -4.002782 -3.532392   -4.025008
## Shibata        -4.156405    -4.160552    -4.115960 -3.636770   -4.138186
## Hannan-Quinn   -4.114688    -4.115256    -4.070664 -3.595052   -4.092890
##              TSVNbf22sstd TSVNbf22ged TSVNbf22sged
## Akaike          -4.155891   -4.116216    -4.148033
## Bayes           -4.035489   -4.004414    -4.027632
## Shibata         -4.157483   -4.117592    -4.149626
## Hannan-Quinn    -4.108592   -4.072296    -4.100735
TSVNbf.inds <- which(TSVNbf.info.mat == min(TSVNbf.info.mat), arr.ind = TRUE)

model.TSVNbf <- colnames(TSVNbf.info.mat)[TSVNbf.inds[,2]]

model.TSVNbf
## [1] "TSVNbf12ged"
TSVNbf12ged
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : gjrGARCH(1,2)
## Mean Model   : ARFIMA(2,0,2)
## Distribution : ged 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error   t value Pr(>|t|)
## mu      0.001036    0.000067  15.37430 0.000000
## ar1    -0.091680    0.005698 -16.08873 0.000000
## ar2     0.072038    0.004718  15.26747 0.000000
## ma1    -0.165265    0.007350 -22.48391 0.000000
## ma2    -0.186385    0.007237 -25.75527 0.000000
## omega   0.000281    0.000076   3.72430 0.000196
## alpha1  0.787735    0.218791   3.60039 0.000318
## beta1   0.236487    0.139148   1.69953 0.089220
## beta2   0.045636    0.081045   0.56309 0.573371
## gamma1 -0.141714    0.278501  -0.50885 0.610860
## shape   0.665742    0.043688  15.23850 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error   t value Pr(>|t|)
## mu      0.001036    0.000067  15.39571 0.000000
## ar1    -0.091680    0.004848 -18.91219 0.000000
## ar2     0.072038    0.003939  18.28906 0.000000
## ma1    -0.165265    0.006404 -25.80684 0.000000
## ma2    -0.186385    0.005932 -31.42183 0.000000
## omega   0.000281    0.000089   3.15205 0.001621
## alpha1  0.787735    0.169507   4.64722 0.000003
## beta1   0.236487    0.108305   2.18353 0.028997
## beta2   0.045636    0.056377   0.80947 0.418246
## gamma1 -0.141714    0.239772  -0.59104 0.554495
## shape   0.665742    0.043591  15.27234 0.000000
## 
## LogLikelihood : 1025.759 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -4.1674
## Bayes        -4.0728
## Shibata      -4.1684
## Hannan-Quinn -4.1302
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic  p-value
## Lag[1]                      0.6582 0.417184
## Lag[2*(p+q)+(p+q)-1][11]    8.2783 0.000317
## Lag[4*(p+q)+(p+q)-1][19]   13.6639 0.072341
## d.o.f=4
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                      0.4667  0.4945
## Lag[2*(p+q)+(p+q)-1][8]     2.4916  0.7774
## Lag[4*(p+q)+(p+q)-1][14]    5.7772  0.6687
## d.o.f=3
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[4]    0.1215 0.500 2.000  0.7274
## ARCH Lag[6]    1.1534 1.461 1.711  0.7042
## ARCH Lag[8]    1.3318 2.368 1.583  0.8703
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  8.9338
## Individual Statistics:              
## mu     0.05655
## ar1    0.10306
## ar2    0.41075
## ma1    0.05948
## ma2    0.16407
## omega  0.53678
## alpha1 6.11820
## beta1  2.77097
## beta2  2.18698
## gamma1 4.06298
## shape  1.35327
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          2.49 2.75 3.27
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value   prob sig
## Sign Bias           1.0478 0.2953    
## Negative Sign Bias  1.5782 0.1152    
## Positive Sign Bias  0.6542 0.5133    
## Joint Effect        3.5536 0.3139    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     33.37      0.02178
## 2    30     35.32      0.19421
## 3    40     50.58      0.10139
## 4    50     67.93      0.03793
## 
## 
## Elapsed time : 2.019631

1.4 KIỂM ĐỊNH SỰ PHÙ HỢP CỦA MÔ HÌNH BIÊN

1.4.1 TRÍCH XUẤT CHUỖI PHẦN DƯ CỦA CHUỖI LỢI SUẤT TSX

TSXbf.res <- residuals(TSXbf11ged)/sigma(TSXbf11ged)

fitdist(distribution = 'ged' , TSXbf.res, control = list())$pars
##           mu        sigma        shape 
## 9.969367e-06 9.525559e-01 4.123138e-01
sb <- pdist(distribution = 'ged' , q = TSXbf.res, mu = 9.969367e-06 , sigma = 9.525559e-01, shape = 4.123138e-01 )

1.4.2 TRÍCH XUẤT CHUỖI PHẦN DƯ CỦA CHUỖI LỢI SUẤT TSVN

TSVNbf.res <- residuals(TSVNbf12ged)/sigma(TSVNbf12ged)

fitdist(distribution = 'ged' , TSVNbf.res, control = list())$pars
##           mu        sigma        shape 
## 0.0006281056 1.1209131383 0.6240881095
vb <- pdist(distribution = 'ged' , q = TSVNbf.res, mu = 0.0006281056 , sigma = 1.1209131383, shape = 0.6240881095)

1.4.3 CÁC KIỂM ĐỊNH SỰ PHÙ HỢP CỦA MÔ HÌNH BIÊN

# Kiểm định Anderson-Darling
ad.test(sb, 'punif')
## 
##  Anderson-Darling test of goodness-of-fit
##  Null hypothesis: uniform distribution
##  Parameters assumed to be fixed
## 
## data:  sb
## An = 3.1224, p-value = 0.02375
ad.test(vb, 'punif')
## 
##  Anderson-Darling test of goodness-of-fit
##  Null hypothesis: uniform distribution
##  Parameters assumed to be fixed
## 
## data:  vb
## An = 1.2671, p-value = 0.2433
# Kiểm định Cramer-von Mises
cvm.test(sb, 'punif')
## 
##  Cramer-von Mises test of goodness-of-fit
##  Null hypothesis: uniform distribution
##  Parameters assumed to be fixed
## 
## data:  sb
## omega2 = 0.57379, p-value = 0.02595
cvm.test(vb, 'punif')
## 
##  Cramer-von Mises test of goodness-of-fit
##  Null hypothesis: uniform distribution
##  Parameters assumed to be fixed
## 
## data:  vb
## omega2 = 0.19182, p-value = 0.2839
# Kiểm định ks-test
ks.test(sb, 'punif')
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  sb
## D = 0.079042, p-value = 0.004553
## alternative hypothesis: two-sided
ks.test(vb, 'punif')
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  vb
## D = 0.056215, p-value = 0.09209
## alternative hypothesis: two-sided

1.5 CHẠY COPULA

BiCopSelect(sb, vb, familyset = NA, selectioncrit = 'AIC' , indeptest = FALSE , level = 0.05)
## Bivariate copula: t (par = -0.07, par2 = 4.11, tau = -0.04)
hehe <- BiCopEst(sb,vb, family = 2, method = 'mle', se = T, max.df = 10)
summary(hehe)
## Family
## ------ 
## No:    2
## Name:  t
## 
## Parameter(s)
## ------------
## par:  -0.07  (SE = 0.05)
## par2: 4.11  (SE = 0.84)
## Dependence measures
## -------------------
## Kendall's tau:    -0.04 (empirical = -0.04, p value = 0.15)
## Upper TD:         0.06 
## Lower TD:         0.06 
## 
## Fit statistics
## --------------
## logLik:  18.49 
## AIC:    -32.98 
## BIC:    -24.61

2 TRONG COVID

dataing <- data %>% filter(DATE > ymd(20200101), DATE < ymd(20220101))
TSXing <- ts(dataing$TSX)
TSVNing <- ts(dataing$TSVN)

2.1 MÔ HÌNH ARMA

autoarfima(TSXing, 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    1.808067    0.017787     101.649        0
## ar2   -0.881999    0.016569     -53.231        0
## ma1   -1.917991    0.000009 -214617.997        0
## ma2    0.943341    0.000037   25444.924        0
## sigma  0.059876    0.001914      31.278        0
## 
## Robust Standard Errors:
##        Estimate  Std. Error     t value Pr(>|t|)
## ar1    1.808067    0.017522     103.189        0
## ar2   -0.881999    0.012159     -72.539        0
## ma1   -1.917991    0.000007 -276777.843        0
## ma2    0.943341    0.000030   31822.332        0
## sigma  0.059876    0.003352      17.861        0
## 
## LogLikelihood : 684.308 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -2.7727
## Bayes        -2.7299
## Shibata      -2.7729
## Hannan-Quinn -2.7559
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic   p-value
## Lag[1]                      0.7768 3.781e-01
## Lag[2*(p+q)+(p+q)-1][11]   12.1996 4.441e-16
## Lag[4*(p+q)+(p+q)-1][19]   26.9366 2.274e-07
## 
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                      1.063  0.3025
## Lag[2*(p+q)+(p+q)-1][2]     1.389  0.3876
## Lag[4*(p+q)+(p+q)-1][5]     3.924  0.2637
## 
## 
## ARCH LM Tests
## ------------------------------------
##              Statistic DoF  P-Value
## ARCH Lag[2]      1.751   2 0.416655
## ARCH Lag[5]      9.476   5 0.091520
## ARCH Lag[10]    28.437  10 0.001536
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  2.1979
## Individual Statistics:            
## ar1   0.1217
## ar2   0.1438
## ma1   0.2585
## ma2   0.2106
## sigma 0.4184
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          1.28 1.47 1.88
## Individual Statistic:     0.35 0.47 0.75
## 
## 
## Elapsed time : 0.04762697 
## 
## 
## $rank.matrix
##    ar1 ar2 ma1 ma2 im arf       AIC converged
## 1    1   1   1   1  0   0 -2.772686         1
## 2    1   1   1   1  1   0 -2.769076         1
## 3    1   1   1   0  0   0 -2.684227         1
## 4    1   0   1   1  0   0 -2.677857         1
## 5    0   1   1   1  0   0 -2.676412         1
## 6    1   1   0   1  0   0 -2.674548         1
## 7    1   0   1   1  1   0 -2.673882         1
## 8    1   1   0   1  1   0 -2.670798         1
## 9    0   1   0   1  0   0 -2.635408         1
## 10   0   1   0   1  1   0 -2.631334         1
## 11   0   0   0   1  0   0 -2.622441         1
## 12   0   1   0   0  0   0 -2.622373         1
## 13   0   0   1   0  0   0 -2.621007         1
## 14   1   0   0   0  0   0 -2.620988         1
## 15   0   0   0   0  1   0 -2.620769         1
## 16   1   0   0   1  0   0 -2.618583         1
## 17   0   0   1   1  0   0 -2.618570         1
## 18   1   1   0   0  0   0 -2.618516         1
## 19   0   1   1   0  0   0 -2.618504         1
## 20   0   0   0   1  1   0 -2.618360         1
## 21   0   1   0   0  1   0 -2.618291         1
## 22   0   0   1   0  1   0 -2.616926         1
## 23   1   0   1   0  0   0 -2.616913         1
## 24   1   0   0   0  1   0 -2.616907         1
## 25   1   0   0   1  1   0 -2.614502         1
## 26   0   0   1   1  1   0 -2.614488         1
## 27   1   1   0   0  1   0 -2.614435         1
## 28   1   0   1   0  1   0 -2.612831         1
## 29   0   1   1   1  1   0 -2.537056         1
## 30   0   1   1   0  1   0        NA         0
## 31   1   1   1   0  1   0        NA         0
autoarfima(TSVNing, ar.max = 2, ma.max = 2, criterion = 'AIC', method = 'full')
## $fit
## 
## *----------------------------------*
## *          ARFIMA Model Fit        *
## *----------------------------------*
## Mean Model   : ARFIMA(1,0,1)
## Distribution : norm 
## 
## Optimal Parameters
## ------------------------------------
##        Estimate  Std. Error  t value Pr(>|t|)
## mu     0.000937    0.000565   1.6594  0.09703
## ar1    0.604656    0.060079  10.0643  0.00000
## ma1   -0.924889    0.034327 -26.9435  0.00000
## sigma  0.063198    0.002019  31.3039  0.00000
## 
## Robust Standard Errors:
##        Estimate  Std. Error  t value Pr(>|t|)
## mu     0.000937    0.000584   1.6055  0.10838
## ar1    0.604656    0.079896   7.5680  0.00000
## ma1   -0.924889    0.069410 -13.3249  0.00000
## sigma  0.063198    0.004427  14.2760  0.00000
## 
## LogLikelihood : 657.8492 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -2.6688
## Bayes        -2.6345
## Shibata      -2.6689
## Hannan-Quinn -2.6553
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                    0.05836  0.8091
## Lag[2*(p+q)+(p+q)-1][5]   1.56789  0.9966
## Lag[4*(p+q)+(p+q)-1][9]   2.87135  0.9092
## 
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic  p-value
## Lag[1]                      6.880 0.008716
## Lag[2*(p+q)+(p+q)-1][2]     7.447 0.009067
## Lag[4*(p+q)+(p+q)-1][5]     8.171 0.026720
## 
## 
## ARCH LM Tests
## ------------------------------------
##              Statistic DoF  P-Value
## ARCH Lag[2]      6.598   2 0.036922
## ARCH Lag[5]      8.899   5 0.113163
## ARCH Lag[10]    25.584  10 0.004342
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  2.2169
## Individual Statistics:             
## mu    0.23547
## ar1   0.32215
## ma1   0.05813
## sigma 1.50546
## 
## 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.172915 
## 
## 
## $rank.matrix
##    ar1 ar2 ma1 ma2 im arf       AIC converged
## 1    1   0   1   0  1   0 -2.668772         1
## 2    1   0   1   0  0   0 -2.667597         1
## 3    1   0   1   1  1   0 -2.665108         1
## 4    1   0   1   1  0   0 -2.663847         1
## 5    0   1   1   1  1   0 -2.632676         1
## 6    0   1   1   1  0   0 -2.630571         1
## 7    1   1   1   1  1   0 -2.628719         1
## 8    1   1   1   1  0   0 -2.626589         1
## 9    1   1   0   1  1   0 -2.626128         1
## 10   1   1   0   1  0   0 -2.625550         1
## 11   0   0   1   1  0   0 -2.625346         1
## 12   0   0   1   1  1   0 -2.622456         1
## 13   1   1   1   0  1   0 -2.621754         1
## 14   1   1   1   0  0   0 -2.620782         1
## 15   1   0   0   1  0   0 -2.614259         1
## 16   1   0   0   1  1   0 -2.610934         1
## 17   0   0   1   0  0   0 -2.592626         1
## 18   0   1   1   0  0   0 -2.589301         1
## 19   0   0   1   0  1   0 -2.589069         1
## 20   0   1   1   0  1   0 -2.585846         1
## 21   1   1   0   0  0   0 -2.583314         1
## 22   1   1   0   0  1   0 -2.579718         1
## 23   1   0   0   0  0   0 -2.570131         1
## 24   1   0   0   0  1   0 -2.566379         1
## 25   0   1   0   1  0   0 -2.551443         1
## 26   0   1   0   1  1   0 -2.547824         1
## 27   0   0   0   1  0   0 -2.546146         1
## 28   0   1   0   0  0   0 -2.544337         1
## 29   0   0   0   1  1   0 -2.542323         1
## 30   0   1   0   0  1   0 -2.540495         1
## 31   0   0   0   0  1   0 -2.527137         1

2.2 MÔ HÌNH GJR-GARCH

2.2.1 CÁC DẠNG MÔ HÌNH CHO CHUỖI LỢI SUẤT TSX

2.2.1.1 GJR-GARCH(11)TSXing

# PHÂN PHỐI CHUẨN
TSXing11n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSXing11n <- ugarchfit(spec = TSXing11n.spec, TSXing)

# PHÂN PHỐI STUDENT
TSXing11std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSXing11std <- ugarchfit(TSXing11std.spec, TSXing)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSXing11sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSXing11sstd <- ugarchfit(TSXing11sstd.spec, TSXing)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSXing11ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")

TSXing11ged <- ugarchfit(TSXing11ged.spec, TSXing) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSXing11sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSXing11sged <- ugarchfit(TSXing11sged.spec, TSXing)

2.2.1.2 GJR-GARCH(12)TSXing

# PHÂN PHỐI CHUẨN
TSXing12n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSXing12n <- ugarchfit(TSXing12n.spec, TSXing)

# PHÂN PHỐI STUDENT
TSXing12std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSXing12std <- ugarchfit(TSXing12std.spec, TSXing)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSXing12sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSXing12sstd <- ugarchfit(TSXing12sstd.spec, TSXing)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSXing12ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSXing12ged <- ugarchfit(TSXing12ged.spec, TSXing) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSXing12sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSXing12sged <- ugarchfit(TSXing12sged.spec, TSXing)

2.2.1.3 GJR-GARCH(21)TSXing

# PHÂN PHỐI CHUẨN
TSXing21n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSXing21n <- ugarchfit(TSXing21n.spec, TSXing)

# PHÂN PHỐI STUDENT
TSXing21std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSXing21std <- ugarchfit(TSXing21std.spec, TSXing)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSXing21sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSXing21sstd <- ugarchfit(TSXing21sstd.spec, TSXing)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSXing21ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSXing21ged <- ugarchfit(TSXing21ged.spec, TSXing) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged) 
TSXing21sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSXing21sged <- ugarchfit(TSXing21sged.spec, TSXing)

2.2.1.4 GJR-GARCH(22)TSXing

# PHÂN PHỐI CHUẨN
TSXing22n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSXing22n <- ugarchfit(TSXing22n.spec, TSXing)

# PHÂN PHỐI STUDENT
TSXing22std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSXing22std <- ugarchfit(TSXing22std.spec, TSXing)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSXing22sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSXing22sstd <- ugarchfit(TSXing22sstd.spec, TSXing)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSXing22ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSXing22ged <- ugarchfit(TSXing22ged.spec, TSXing) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSXing22sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSXing22sged <- ugarchfit(TSXing22sged.spec, TSXing)

2.2.2 CÁC DẠNG MÔ HÌNH CHO CHUỖI LỢI SUẤT TSVN

2.2.2.1 GJR-GARCH(11)TSVNing

# PHÂN PHỐI CHUẨN
TSVNing11n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'norm')

TSVNing11n <- ugarchfit(spec = TSVNing11n.spec, TSVNing)

# PHÂN PHỐI STUDENT
TSVNing11std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'std')

TSVNing11std <- ugarchfit(TSVNing11std.spec, TSVNing)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSVNing11sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'sstd')

TSVNing11sstd <- ugarchfit(TSVNing11sstd.spec, TSVNing)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSVNing11ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = "ged")

TSVNing11ged <- ugarchfit(TSVNing11ged.spec, TSVNing) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSVNing11sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'sged')

TSVNing11sged <- ugarchfit(TSVNing11sged.spec, TSVNing)

2.2.2.2 GJR-GARCH(12)TSVNing

# PHÂN PHỐI CHUẨN
TSVNing12n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'norm')

TSVNing12n <- ugarchfit(TSVNing12n.spec, TSVNing)

# PHÂN PHỐI STUDENT
TSVNing12std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'std')

TSVNing12std <- ugarchfit(TSVNing12std.spec, TSVNing)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSVNing12sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'sstd')

TSVNing12sstd <- ugarchfit(TSVNing12sstd.spec, TSVNing)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSVNing12ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,2)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = "ged")

TSVNing12ged <- ugarchfit(TSVNing12ged.spec, TSVNing) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSVNing12sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'sged')

TSVNing12sged <- ugarchfit(TSVNing12sged.spec, TSVNing)

2.2.2.3 GJR-GARCH(21)TSVNing

# PHÂN PHỐI CHUẨN
TSVNing21n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'norm')

TSVNing21n <- ugarchfit(TSVNing21n.spec, TSVNing)

# PHÂN PHỐI STUDENT
TSVNing21std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'std')

TSVNing21std <- ugarchfit(TSVNing21std.spec, TSVNing)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSVNing21sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'sstd')

TSVNing21sstd <- ugarchfit(TSVNing21sstd.spec, TSVNing)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSVNing21ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,1)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = "ged")

TSVNing21ged <- ugarchfit(TSVNing21ged.spec, TSVNing) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged) 
TSVNing21sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'sged')

TSVNing21sged <- ugarchfit(TSVNing21sged.spec, TSVNing)

2.2.2.4 GJR-GARCH(22)TSVNing

# PHÂN PHỐI CHUẨN
TSVNing22n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'norm')

TSVNing22n <- ugarchfit(TSVNing22n.spec, TSVNing)

# PHÂN PHỐI STUDENT
TSVNing22std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'std')

TSVNing22std <- ugarchfit(TSVNing22std.spec, TSVNing)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSVNing22sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'sstd')

TSVNing22sstd <- ugarchfit(TSVNing22sstd.spec, TSVNing)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSVNing22ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,2)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = "ged")

TSVNing22ged <- ugarchfit(TSVNing22ged.spec, TSVNing) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSVNing22sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(1,1), include.mean = TRUE), distribution.model = 'sged')

TSVNing22sged <- ugarchfit(TSVNing22sged.spec, TSVNing)

2.3 LỰA CHỌN MÔ HÌNH GJR-GARCH

2.3.1 LỰA CHỌN MÔ HÌNH BIÊN PHÙ HỢP NHẤT CHO CHUỖI TSX

TSXing.model.list <- list(garch11n = TSXing11n, 
                          garch11std = TSXing11std,
                          garch11sstd = TSXing11sstd,
                          garch11ged = TSXing11ged,
                          garch11sged = TSXing11sged,
                        
                          garch12n = TSXing12n, 
                          garch12std = TSXing12std,
                          garch12sstd = TSXing12sstd,
                          garch12ged = TSXing12ged,
                          garch12sged = TSXing12sged,
                        
                          garch21n = TSXing21n, 
                          garch21std = TSXing21std,
                          garch21ged = TSXing21ged,
                          
                        
                          garch22n = TSXing22n, 
                          garch22std = TSXing22std,
                          garch22sstd = TSXing22sstd,
                          garch22ged = TSXing22ged)

TSXing.info.mat <- sapply(TSXing.model.list, infocriteria)

rownames(TSXing.info.mat) <- rownames(infocriteria(TSXing11n))

TSXing.info.mat
##               garch11n garch11std garch11sstd garch11ged garch11sged  garch12n
## Akaike       -2.762436  -4.058712   -4.044594  -4.141586   -3.965044 -2.796488
## Bayes        -2.685396  -3.973112   -3.950434  -4.055986   -3.870884 -2.710888
## Shibata      -2.763094  -4.059523   -4.045572  -4.142397   -3.966023 -2.797299
## Hannan-Quinn -2.732179  -4.025093   -4.007614  -4.107968   -3.928064 -2.762870
##              garch12std garch12sstd garch12ged garch12sged  garch21n garch21std
## Akaike        -4.054523   -4.044480  -4.099929   -4.057761 -2.773750  -4.038621
## Bayes         -3.960363   -3.941760  -4.005769   -3.955041 -2.679590  -3.935901
## Shibata       -4.055502   -4.045642  -4.100908   -4.058923 -2.774729  -4.039782
## Hannan-Quinn  -4.017543   -4.004139  -4.062949   -4.017419 -2.736770  -3.998279
##              garch21ged  garch22n garch22std garch22sstd garch22ged
## Akaike        -4.107073 -2.715481  -4.045682   -4.042605  -4.077941
## Bayes         -4.004353 -2.612761  -3.934401   -3.922765  -3.966661
## Shibata       -4.108235 -2.716643  -4.047041   -4.044178  -4.079301
## Hannan-Quinn  -4.066731 -2.675139  -4.001978   -3.995540  -4.034237
TSXing.inds <- which(TSXing.info.mat == min(TSXing.info.mat), arr.ind = TRUE)

model.TSXing <- colnames(TSXing.info.mat)[TSXing.inds[,2]]

model.TSXing
## [1] "garch11ged"
TSXing11ged
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : gjrGARCH(1,1)
## Mean Model   : ARFIMA(2,0,2)
## Distribution : ged 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error     t value Pr(>|t|)
## mu     -0.001036    0.000011  -94.755551 0.000000
## ar1     0.205347    0.000243  843.382832 0.000000
## ar2     0.137399    0.000346  397.139832 0.000000
## ma1    -0.187813    0.000250 -752.486925 0.000000
## ma2    -0.136621    0.000305 -447.860816 0.000000
## omega   0.000009    0.000004    2.439229 0.014719
## alpha1  0.003639    0.018120    0.200844 0.840821
## beta1   0.994366    0.001603  620.444594 0.000000
## gamma1 -0.002814    0.036870   -0.076325 0.939161
## shape   0.387873    0.024990   15.520857 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error   t value Pr(>|t|)
## mu     -0.001036    0.000316  -3.28282 0.001028
## ar1     0.205347    0.031668   6.48428 0.000000
## ar2     0.137399    0.023330   5.88929 0.000000
## ma1    -0.187813    0.031288  -6.00275 0.000000
## ma2    -0.136621    0.022835  -5.98299 0.000000
## omega   0.000009    0.000004   2.27435 0.022945
## alpha1  0.003639    0.020811   0.17487 0.861182
## beta1   0.994366    0.002042 486.97065 0.000000
## gamma1 -0.002814    0.042521  -0.06618 0.947234
## shape   0.387873    0.050303   7.71074 0.000000
## 
## LogLikelihood : 1024.689 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -4.1416
## Bayes        -4.0560
## Shibata      -4.1424
## Hannan-Quinn -4.1080
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic   p-value
## Lag[1]                    0.001071 9.739e-01
## Lag[2*(p+q)+(p+q)-1][11] 16.153606 0.000e+00
## Lag[4*(p+q)+(p+q)-1][19] 36.767814 1.079e-12
## d.o.f=4
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic  p-value
## Lag[1]                      1.899 0.168194
## Lag[2*(p+q)+(p+q)-1][5]     6.144 0.083181
## Lag[4*(p+q)+(p+q)-1][9]    14.822 0.003949
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[3]     2.387 0.500 2.000 0.12231
## ARCH Lag[5]     5.533 1.440 1.667 0.07727
## ARCH Lag[7]    10.013 2.315 1.543 0.01828
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  25.6065
## Individual Statistics:              
## mu     0.03829
## ar1    0.50811
## ar2    0.58192
## ma1    0.49585
## ma2    0.57635
## omega  0.04473
## alpha1 0.02361
## beta1  0.01404
## gamma1 0.01327
## shape  0.07904
## 
## 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           0.6060 0.5448    
## Negative Sign Bias  0.8155 0.4152    
## Positive Sign Bias  0.9193 0.3584    
## Joint Effect        2.0424 0.5637    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     54.73    2.552e-05
## 2    30     77.43    2.738e-06
## 3    40     95.80    1.109e-06
## 4    50    107.55    2.841e-06
## 
## 
## Elapsed time : 1.157415

2.3.2 LỰA CHỌN MÔ HÌNH BIÊN PHÙ HỢP NHẤT CHO TSVN

TSVNing.model.list <- list(garch11n = TSVNing11n, 
                        garch11std = TSVNing11std,
                        garch11sstd = TSVNing11sstd,
                        garch11ged = TSVNing11ged,
                       
                        
                        garch12n = TSVNing12n, 
                        garch12std = TSVNing12std,
                        garch12sstd = TSVNing12sstd,
                        garch12ged = TSVNing12ged,
                       
                        
                       garch21n = TSVNing21n, 
                       garch21std = TSVNing21std,
                        garch21sstd = TSVNing21sstd,
                        
                        
                       garch22n = TSVNing22n, 
                        garch22std = TSVNing22std,
                        garch22sstd = TSVNing22sstd,
                       garch22ged = TSVNing22ged)
                      

TSVNing.info.mat <- sapply(TSVNing.model.list, infocriteria)

rownames(TSVNing.info.mat) <- rownames(infocriteria(TSVNing11n))

TSVNing.info.mat
##               garch11n garch11std garch11sstd garch11ged  garch12n garch12std
## Akaike       -2.711955  -3.369840   -3.372863  -3.420731 -2.698609  -3.357546
## Bayes        -2.652035  -3.301360   -3.295823  -3.352251 -2.630129  -3.280506
## Shibata      -2.712356  -3.370362   -3.373522  -3.421253 -2.699130  -3.358204
## Hannan-Quinn -2.688422  -3.342946   -3.342607  -3.393837 -2.671714  -3.327289
##              garch12sstd garch12ged  garch21n garch21std garch21sstd  garch22n
## Akaike         -3.359778  -3.428538 -2.732027  -3.386084   -3.385674 -2.746152
## Bayes          -3.274178  -3.351498 -2.654987  -3.300484   -3.291514 -2.660552
## Shibata        -3.360589  -3.429197 -2.732686  -3.386895   -3.386653 -2.746963
## Hannan-Quinn   -3.326160  -3.398282 -2.701770  -3.352466   -3.348694 -2.712534
##              garch22std garch22sstd garch22ged
## Akaike        -3.382003   -3.381016  -3.400268
## Bayes         -3.287843   -3.278296  -3.306108
## Shibata       -3.382981   -3.382178  -3.401246
## Hannan-Quinn  -3.345023   -3.340674  -3.363288
TSVNing.inds <- which(TSVNing.info.mat == min(TSVNing.info.mat), arr.ind = TRUE)

model.TSVNing <- colnames(TSVNing.info.mat)[TSVNing.inds[,2]]

model.TSVNing
## [1] "garch12ged"
TSVNing12ged
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : gjrGARCH(1,2)
## Mean Model   : ARFIMA(1,0,1)
## Distribution : ged 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error  t value Pr(>|t|)
## mu      0.001672    0.000002   816.17        0
## ar1     0.155997    0.000679   229.59        0
## ma1    -0.127693    0.000938  -136.15        0
## omega   0.000026    0.000000   366.47        0
## alpha1  0.044033    0.000062   706.40        0
## beta1   0.708876    0.000496  1430.46        0
## beta2   0.300999    0.000235  1282.37        0
## gamma1 -0.110367    0.000068 -1634.46        0
## shape   0.437139    0.025297    17.28        0
## 
## Robust Standard Errors:
##         Estimate  Std. Error  t value Pr(>|t|)
## mu      0.001672    0.000106  15.7204  0.00000
## ar1     0.155997    0.019928   7.8279  0.00000
## ma1    -0.127693    0.017022  -7.5016  0.00000
## omega   0.000026    0.000001  19.6976  0.00000
## alpha1  0.044033    0.000771  57.0968  0.00000
## beta1   0.708876    0.013389  52.9437  0.00000
## beta2   0.300999    0.004106  73.3082  0.00000
## gamma1 -0.110367    0.001700 -64.9061  0.00000
## shape   0.437139    0.373159   1.1715  0.24141
## 
## LogLikelihood : 848.9918 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -3.4285
## Bayes        -3.3515
## Shibata      -3.4292
## Hannan-Quinn -3.3983
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                         statistic   p-value
## Lag[1]                      17.47 2.913e-05
## Lag[2*(p+q)+(p+q)-1][5]     24.47 0.000e+00
## Lag[4*(p+q)+(p+q)-1][9]     26.88 7.141e-12
## d.o.f=2
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                          statistic   p-value
## Lag[1]                       14.22 0.0001624
## Lag[2*(p+q)+(p+q)-1][8]      15.32 0.0018463
## Lag[4*(p+q)+(p+q)-1][14]     22.20 0.0006630
## d.o.f=3
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[4]    0.5009 0.500 2.000  0.4791
## ARCH Lag[6]    0.5184 1.461 1.711  0.8868
## ARCH Lag[8]    0.7504 2.368 1.583  0.9574
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  3.5371
## Individual Statistics:              
## mu     0.03673
## ar1    0.28998
## ma1    0.28602
## omega  0.01947
## alpha1 0.01973
## beta1  0.02978
## beta2  0.01085
## gamma1 0.01953
## shape  0.35068
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          2.1 2.32 2.82
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value      prob sig
## Sign Bias           1.7440 8.179e-02   *
## Negative Sign Bias  4.6931 3.507e-06 ***
## Positive Sign Bias  0.9295 3.531e-01    
## Joint Effect       22.9674 4.102e-05 ***
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     46.73    0.0003897
## 2    30     65.80    0.0001114
## 3    40     71.31    0.0012097
## 4    50     82.86    0.0017881
## 
## 
## Elapsed time : 1.045662

2.4 KIỂM ĐỊNH SỰ PHÙ HỢP CỦA MÔ HÌNH BIÊN

2.4.1 TRÍCH XUẤT CHUỖI PHẦN DƯ CỦA CHUỖI LỢI SUẤT TSX

TSXing.res <- residuals(TSXing11ged)/sigma(TSXing11ged)

fitdist(distribution = 'ged' , TSXing.res, control = list())$pars
##           mu        sigma        shape 
## 1.988807e-06 7.919871e-01 4.351004e-01
si <- pdist(distribution = 'ged' , q = TSXing.res, mu = 1.988807e-06, sigma = 7.919871e-01, shape = 4.351004e-01)

2.4.2 TRÍCH XUẤT CHUỖI PHẦN DƯ CỦA CHUỖI LỢI SUẤT TSVN

TSVNing.res <- residuals(TSVNing12ged)/sigma(TSVNing12ged)

fitdist(distribution = 'ged' , TSVNing.res, control = list())$pars
##            mu         sigma         shape 
## -3.156577e-05  1.146166e+00  4.177457e-01
vi <- pdist(distribution = 'ged' , q = TSVNing.res, mu = -0.001569485 , sigma = 1.084206215, shape = 0.423689743) 

2.4.3 CÁC KIỂM ĐỊNH SỰ PHÙ HỢP CỦA MÔ HÌNH BIÊN

# Kiểm định Anderson-Darling
ad.test(si, 'punif')
## 
##  Anderson-Darling test of goodness-of-fit
##  Null hypothesis: uniform distribution
##  Parameters assumed to be fixed
## 
## data:  si
## An = 2.3557, p-value = 0.05905
ad.test(vi, 'punif')
## 
##  Anderson-Darling test of goodness-of-fit
##  Null hypothesis: uniform distribution
##  Parameters assumed to be fixed
## 
## data:  vi
## An = 2.7523, p-value = 0.03664
# Kiểm định Cramer-von Mises
cvm.test(si, 'punif')
## 
##  Cramer-von Mises test of goodness-of-fit
##  Null hypothesis: uniform distribution
##  Parameters assumed to be fixed
## 
## data:  si
## omega2 = 0.31697, p-value = 0.1211
cvm.test(vi, 'punif')
## 
##  Cramer-von Mises test of goodness-of-fit
##  Null hypothesis: uniform distribution
##  Parameters assumed to be fixed
## 
## data:  vi
## omega2 = 0.44125, p-value = 0.05631
# Kiểm định ks-test
ks.test(si, 'punif')
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  si
## D = 0.064405, p-value = 0.03432
## alternative hypothesis: two-sided
ks.test(vi, 'punif')
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  vi
## D = 0.060394, p-value = 0.05606
## alternative hypothesis: two-sided

2.5 CHẠY COPULA

BiCopSelect(si, vi, familyset = NA, selectioncrit = 'AIC' , indeptest = FALSE , level = 0.05)
## Bivariate copula: Rotated Tawn type 2 180 degrees (par = 1.58, par2 = 0.1, tau = 0.07)
yeah <- BiCopEst(si, vi, family = 214, method = 'mle', se = T, max.df = 10)
summary(yeah)
## Family
## ------ 
## No:    214
## Name:  Rotated Tawn type 2 180 degrees
## 
## Parameter(s)
## ------------
## par:  1.58  (SE = 0.18)
## par2: 0.1  (SE = 0.03)
## Dependence measures
## -------------------
## Kendall's tau:    0.07 (empirical = 0.02, p value = 0.48)
## Upper TD:         0 
## Lower TD:         0.09 
## 
## Fit statistics
## --------------
## logLik:  15.6 
## AIC:    -27.2 
## BIC:    -18.81

3 SAU COVID

dataaft <- data %>% filter(DATE > ymd(20211231))
TSXaft <- ts(dataaft$TSX)
TSVNaft <- ts(dataaft$TSVN)

3.1 MÔ HÌNH ARMA

autoarfima(TSXaft, 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.767947    0.003185    241.087        0
## ar2    0.009244    0.000232     39.902        0
## ma1   -0.994890    0.000023 -42778.101        0
## ma2   -0.027939    0.000059   -470.650        0
## sigma  0.070298    0.002615     26.883        0
## 
## Robust Standard Errors:
##        Estimate  Std. Error    t value Pr(>|t|)
## ar1    0.767947    0.010055     76.377        0
## ar2    0.009244    0.000545     16.947        0
## ma1   -0.994890    0.000047 -21131.155        0
## ma2   -0.027939    0.000119   -235.515        0
## sigma  0.070298    0.005651     12.441        0
## 
## LogLikelihood : 436.6717 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -2.4049
## Bayes        -2.3508
## Shibata      -2.4052
## Hannan-Quinn -2.3833
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic   p-value
## Lag[1]                       2.575 1.086e-01
## Lag[2*(p+q)+(p+q)-1][11]     9.649 1.203e-07
## Lag[4*(p+q)+(p+q)-1][19]    26.451 3.989e-07
## 
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                      0.690  0.4062
## Lag[2*(p+q)+(p+q)-1][2]     1.236  0.4277
## Lag[4*(p+q)+(p+q)-1][5]     2.685  0.4675
## 
## 
## ARCH LM Tests
## ------------------------------------
##              Statistic DoF P-Value
## ARCH Lag[2]      1.817   2  0.4031
## ARCH Lag[5]      4.856   5  0.4338
## ARCH Lag[10]     9.906  10  0.4488
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  8.9673
## Individual Statistics:             
## ar1   0.03336
## ar2   0.03352
## ma1   0.03328
## ma2   0.03337
## sigma 0.57966
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          1.28 1.47 1.88
## Individual Statistic:     0.35 0.47 0.75
## 
## 
## Elapsed time : 0.05600214 
## 
## 
## $rank.matrix
##    ar1 ar2 ma1 ma2 im arf       AIC converged
## 1    1   1   1   1  0   0 -2.404856         1
## 2    1   1   1   0  0   0 -2.383456         1
## 3    0   1   1   1  1   0 -2.376003         1
## 4    1   1   0   1  0   0 -2.361318         1
## 5    1   1   0   1  1   0 -2.355749         1
## 6    0   1   0   1  1   0 -2.311608         1
## 7    0   0   1   0  0   0 -2.304061         1
## 8    1   0   0   0  0   0 -2.304059         1
## 9    0   0   0   1  0   0 -2.304005         1
## 10   0   1   0   0  0   0 -2.303993         1
## 11   0   0   0   0  1   0 -2.303938         1
## 12   0   0   1   1  0   0 -2.298569         1
## 13   1   0   0   1  0   0 -2.298561         1
## 14   0   1   1   0  0   0 -2.298548         1
## 15   1   1   0   0  0   0 -2.298543         1
## 16   0   0   1   0  1   0 -2.298490         1
## 17   1   0   0   0  1   0 -2.298488         1
## 18   1   0   1   0  0   0 -2.298488         1
## 19   0   0   0   1  1   0 -2.298434         1
## 20   0   1   0   0  1   0 -2.298422         1
## 21   0   1   0   1  0   0 -2.298375         1
## 22   0   0   1   1  1   0 -2.292999         1
## 23   1   0   1   1  0   0 -2.292993         1
## 24   1   0   0   1  1   0 -2.292990         1
## 25   1   1   0   0  1   0 -2.292972         1
## 26   1   0   1   0  1   0 -2.292918         1
## 27   0   1   1   1  0   0 -2.292896         1
## 28   1   0   1   1  1   0 -2.287422         1
## 29   1   1   1   1  1   0 -2.283200         1
## 30   0   1   1   0  1   0        NA         0
## 31   1   1   1   0  1   0        NA         0
autoarfima(TSVNaft, 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|)
## mu    -0.000785    0.000373  -2.1042 0.035364
## ar1    0.273134    0.061085   4.4714 0.000008
## ar2    0.228172    0.059479   3.8362 0.000125
## ma1   -0.363711    0.029784 -12.2115 0.000000
## ma2   -0.591012    0.029491 -20.0401 0.000000
## sigma  0.069531    0.002595  26.7940 0.000000
## 
## Robust Standard Errors:
##        Estimate  Std. Error  t value Pr(>|t|)
## mu    -0.000785    0.000344  -2.2795 0.022635
## ar1    0.273134    0.040623   6.7237 0.000000
## ar2    0.228172    0.050440   4.5236 0.000006
## ma1   -0.363711    0.013873 -26.2177 0.000000
## ma2   -0.591012    0.012310 -48.0100 0.000000
## sigma  0.069531    0.006120  11.3619 0.000000
## 
## LogLikelihood : 447.6868 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -2.4607
## Bayes        -2.3957
## Shibata      -2.4612
## Hannan-Quinn -2.4348
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                   4.305e-04 0.98345
## Lag[2*(p+q)+(p+q)-1][11] 7.481e+00 0.01042
## Lag[4*(p+q)+(p+q)-1][19] 1.212e+01 0.18059
## 
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                     0.1965 0.65757
## Lag[2*(p+q)+(p+q)-1][2]    5.6344 0.02753
## Lag[4*(p+q)+(p+q)-1][5]    9.1311 0.01533
## 
## 
## ARCH LM Tests
## ------------------------------------
##              Statistic DoF  P-Value
## ARCH Lag[2]      10.84   2 0.004425
## ARCH Lag[5]      12.44   5 0.029285
## ARCH Lag[10]     14.52  10 0.150732
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  3.2039
## Individual Statistics:             
## mu    0.39025
## ar1   0.08921
## ar2   0.15602
## ma1   0.37754
## ma2   0.44053
## sigma 1.05160
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          1.49 1.68 2.12
## Individual Statistic:     0.35 0.47 0.75
## 
## 
## Elapsed time : 0.03275704 
## 
## 
## $rank.matrix
##    ar1 ar2 ma1 ma2 im arf       AIC converged
## 1    1   1   1   1  1   0 -2.460651         1
## 2    1   1   1   1  0   0 -2.458731         1
## 3    1   0   1   1  1   0 -2.457749         1
## 4    1   0   1   1  0   0 -2.456311         1
## 5    0   1   1   1  1   0 -2.453854         1
## 6    0   1   1   1  0   0 -2.452359         1
## 7    1   1   0   1  0   0 -2.421220         1
## 8    1   1   0   1  1   0 -2.421176         1
## 9    0   1   0   1  0   0 -2.394706         1
## 10   0   1   0   1  1   0 -2.389320         1
## 11   0   0   0   1  0   0 -2.375237         1
## 12   1   0   0   1  0   0 -2.369935         1
## 13   0   0   1   1  0   0 -2.369844         1
## 14   0   0   0   1  1   0 -2.369785         1
## 15   1   0   0   1  1   0 -2.364479         1
## 16   0   0   1   1  1   0 -2.364397         1
## 17   0   1   0   0  0   0 -2.355538         1
## 18   0   1   1   0  0   0 -2.350974         1
## 19   1   1   1   0  0   0 -2.350888         1
## 20   1   1   0   0  0   0 -2.350358         1
## 21   0   1   0   0  1   0 -2.350059         1
## 22   0   1   1   0  1   0 -2.345489         1
## 23   1   1   1   0  1   0 -2.345398         1
## 24   1   1   0   0  1   0 -2.344876         1
## 25   1   0   1   0  0   0 -2.323858         1
## 26   1   0   1   0  1   0 -2.318338         1
## 27   0   0   1   0  0   0 -2.305028         1
## 28   1   0   0   0  0   0 -2.304826         1
## 29   0   0   0   0  1   0 -2.304632         1
## 30   0   0   1   0  1   0 -2.299510         1
## 31   1   0   0   0  1   0 -2.299308         1

3.2 MÔ HÌNH GJR-GARCH

3.2.1 CÁC DẠNG MÔ HÌNH CHO CHUỖI LỢI SUẤT TSX

3.2.1.1 GJR-GARCH(11)TSXaft

# PHÂN PHỐI CHUẨN
TSXaft11n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSXaft11n <- ugarchfit(spec = TSXaft11n.spec, TSXaft)

# PHÂN PHỐI STUDENT
TSXaft11std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSXaft11std <- ugarchfit(TSXaft11std.spec, TSXaft)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSXaft11sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSXaft11sstd <- ugarchfit(TSXaft11sstd.spec, TSXaft)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSXaft11ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")

TSXaft11ged <- ugarchfit(TSXaft11ged.spec, TSXaft) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSXaft11sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSXaft11sged <- ugarchfit(TSXaft11sged.spec, TSXaft)

3.2.1.2 GJR-GARCH(12)

# PHÂN PHỐI CHUẨN
TSXaft12n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSXaft12n <- ugarchfit(TSXaft12n.spec, TSXaft)

# PHÂN PHỐI STUDENT
TSXaft12std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSXaft12std <- ugarchfit(TSXaft12std.spec, TSXaft)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSXaft12sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSXaft12sstd <- ugarchfit(TSXaft12sstd.spec, TSXaft)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSXaft12ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSXaft12ged <- ugarchfit(TSXaft12ged.spec, TSXaft) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSXaft12sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSXaft12sged <- ugarchfit(TSXaft12sged.spec, TSXaft)

3.2.1.3 GJR-GARCH(21)

# PHÂN PHỐI CHUẨN
TSXaft21n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSXaft21n <- ugarchfit(TSXaft21n.spec, TSXaft)

# PHÂN PHỐI STUDENT
TSXaft21std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSXaft21std <- ugarchfit(TSXaft21std.spec, TSXaft)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSXaft21sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSXaft21sstd <- ugarchfit(TSXaft21sstd.spec, TSXaft)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSXaft21ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSXaft21ged <- ugarchfit(TSXaft21ged.spec, TSXaft) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged) 
TSXaft21sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSXaft21sged <- ugarchfit(TSXaft21sged.spec, TSXaft)

3.2.1.4 GJR-GARCH(22)

# PHÂN PHỐI CHUẨN
TSXaft22n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSXaft22n <- ugarchfit(TSXaft22n.spec, TSXaft)

# PHÂN PHỐI STUDENT
TSXaft22std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSXaft22std <- ugarchfit(TSXaft22std.spec, TSXaft)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSXaft22sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSXaft22sstd <- ugarchfit(TSXaft22sstd.spec, TSXaft)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSXaft22ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSXaft22ged <- ugarchfit(TSXaft22ged.spec, TSXaft) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSXaft22sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSXaft22sged <- ugarchfit(TSXaft22sged.spec, TSXaft)

3.2.2 CÁC DẠNG MÔ HÌNH CHO CHUỖI LỢI SUẤT TSVN

3.2.2.1 GJR-GARCH(11)TSVN

# PHÂN PHỐI CHUẨN
TSVNaft11n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model =  'norm')

TSVNaft11n <- ugarchfit(TSVNaft11n.spec, TSVNaft)

# PHÂN PHỐI STUDENT
TSVNaft11std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSVNaft11std <- ugarchfit(TSVNaft11std.spec, TSVNaft)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSVNaft11sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSVNaft11sstd <- ugarchfit(TSVNaft11sstd.spec, TSVNaft)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSVNaft11ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")

TSVNaft11ged <- ugarchfit(TSVNaft11ged.spec, TSVNaft) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged) 
TSVNaft11sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSVNaft11sged <- ugarchfit(TSVNaft11sged.spec, TSVNaft)

3.2.2.2 GJR-GARCH(12)

# PHÂN PHỐI CHUẨN
TSVNaft12n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSVNaft12n <- ugarchfit(TSVNaft12n.spec, TSVNaft)

# PHÂN PHỐI STUDENT
TSVNaft12std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSVNaft12std <- ugarchfit(TSVNaft12std.spec, TSVNaft)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSVNaft12sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSVNaft12sstd <- ugarchfit(TSVNaft12sstd.spec, TSVNaft)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSVNaft12ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSVNaft12ged <- ugarchfit(TSVNaft12ged.spec, TSVNaft) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged) 
TSVNaft12sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(1,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSVNaft12sged <- ugarchfit(TSVNaft12sged.spec, TSVNaft)

3.2.2.3 GJR-GARCH(21)

# PHÂN PHỐI CHUẨN
TSVNaft21n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSVNaft21n <- ugarchfit(TSVNaft21n.spec, TSVNaft)


# PHÂN PHỐI STUDENT
TSVNaft21std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSVNaft21std <- ugarchfit(TSVNaft21std.spec, TSVNaft)


# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSVNaft21sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSVNaft21sstd <- ugarchfit(TSVNaft21sstd.spec, TSVNaft)


# PHÂN PHỐI Generalized Error Distribution (ged)
TSVNaft21ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSVNaft21ged <- ugarchfit(TSVNaft21ged.spec, TSVNaft) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged)
TSVNaft21sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,1)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSVNaft21sged <- ugarchfit(TSVNaft21sged.spec, TSVNaft)

3.2.2.4 GJR-GARCH(22)

# PHÂN PHỐI CHUẨN
TSVNaft22n.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'norm')

TSVNaft22n <- ugarchfit(TSVNaft22n.spec, TSVNaft)

# PHÂN PHỐI STUDENT
TSVNaft22std.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'std')

TSVNaft22std <- ugarchfit(TSVNaft22std.spec, TSVNaft)

# PHÂN PHỐI ĐỐI XỨNG (sstd)
TSVNaft22sstd.spec <- ugarchspec(variance.model = list( model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sstd')

TSVNaft22sstd <- ugarchfit(TSVNaft22sstd.spec, TSVNaft)

# PHÂN PHỐI Generalized Error Distribution (ged)
TSVNaft22ged.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = "ged")

TSVNaft22ged <- ugarchfit(TSXaft22ged.spec, TSVNaft) 

# PHÂN PHỐI Generalized Error Distribution đối xứng (sged) 
TSVNaft22sged.spec <- ugarchspec(variance.model = list(model = 'gjrGARCH', garchOrder = c(2,2)), mean.model = list(armaOrder = c(2,2), include.mean = TRUE), distribution.model = 'sged')

TSVNaft22sged <- ugarchfit(TSXaft22sged.spec, TSVNaft)

3.3 LỰA CHỌN MÔ HÌNH GJR-GARCH

3.3.1 LỰA CHỌN MÔ HÌNH BIÊN PHÙ HỢP NHẤT CHO CHUỖI TSX

TSXaft.model.list <- list(garch11n = TSXaft11n, 
                          garch11std = TSXaft11std,
                          garch11sstd = TSXaft11sstd,
                          garch11sged = TSXaft11sged,
                        
                          garch12n = TSXaft12n,
                          garch12std = TSXaft12std,
                          garch12sstd = TSXaft12sstd,
                          garch12ged = TSXaft12ged,
                          garch12sged = TSXaft12sged,
                        
                          
                          garch21std = TSXaft21std,
                          garch21sged = TSXaft21sged,
                        
                          garch22n = TSXaft22n, 
                          garch22std = TSXaft22std,
                          garch22sstd = TSXaft22sstd,
                          garch22ged = TSXaft22ged)
                        

TSXaft.info.mat <- sapply(TSXaft.model.list, infocriteria)

rownames(TSXaft.info.mat) <- rownames(infocriteria(TSXaft11n))

TSXaft.info.mat
##               garch11n garch11std garch11sstd garch11sged  garch12n garch12std
## Akaike       -2.495518  -3.784704   -3.804895   -3.848287 -2.446719  -3.778958
## Bayes        -2.398164  -3.676533   -3.685908   -3.729300 -2.338548  -3.659971
## Shibata      -2.496734  -3.786200   -3.806700   -3.850092 -2.448215  -3.780763
## Hannan-Quinn -2.456804  -3.741689   -3.757579   -3.800971 -2.403703  -3.731642
##              garch12sstd garch12ged garch12sged garch21std garch21sged
## Akaike         -3.666447  -3.910292   -3.795799  -3.732425   -3.766929
## Bayes          -3.536643  -3.791304   -3.665995  -3.602620   -3.626307
## Shibata        -3.668587  -3.912096   -3.797939  -3.734565   -3.769431
## Hannan-Quinn   -3.614829  -3.862975   -3.744181  -3.680807   -3.711009
##               garch22n garch22std garch22sstd garch22ged
## Akaike       -2.478526  -3.786280   -3.814525  -3.807111
## Bayes        -2.348721  -3.645658   -3.663086  -3.666489
## Shibata      -2.480666  -3.788783   -3.817417  -3.809613
## Hannan-Quinn -2.426908  -3.730360   -3.754304  -3.751191
TSXaft.inds <- which(TSXaft.info.mat == min(TSXaft.info.mat), arr.ind = TRUE)

model.TSXaft <- colnames(TSXaft.info.mat)[TSXaft.inds[,2]]

model.TSXaft
## [1] "garch12ged"
TSXaft12ged
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : gjrGARCH(1,2)
## Mean Model   : ARFIMA(2,0,2)
## Distribution : ged 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error     t value Pr(>|t|)
## mu      0.001221    0.000007  176.138941  0.00000
## ar1     0.650099    0.002014  322.757437  0.00000
## ar2     0.287367    0.001109  259.192558  0.00000
## ma1    -0.639971    0.003439 -186.095729  0.00000
## ma2    -0.318577    0.001472 -216.360421  0.00000
## omega   0.000017    0.000082    0.211008  0.83288
## alpha1  0.007377    0.051346    0.143680  0.88575
## beta1   0.395598    0.010401   38.033722  0.00000
## beta2   0.594802    0.010051   59.178162  0.00000
## gamma1  0.000710    0.099671    0.007122  0.99432
## shape   0.367340    0.027173   13.518468  0.00000
## 
## Robust Standard Errors:
##         Estimate  Std. Error   t value Pr(>|t|)
## mu      0.001221    0.000959  1.273562 0.202819
## ar1     0.650099    0.204715  3.175633 0.001495
## ar2     0.287367    0.117658  2.442396 0.014590
## ma1    -0.639971    0.302088 -2.118492 0.034133
## ma2    -0.318577    0.135992 -2.342621 0.019149
## omega   0.000017    0.000590  0.029319 0.976610
## alpha1  0.007377    0.699389  0.010548 0.991584
## beta1   0.395598    0.007851 50.387359 0.000000
## beta2   0.594802    0.017794 33.426988 0.000000
## gamma1  0.000710    1.140485  0.000622 0.999503
## shape   0.367340    0.085951  4.273847 0.000019
## 
## LogLikelihood : 712.8974 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -3.9103
## Bayes        -3.7913
## Shibata      -3.9121
## Hannan-Quinn -3.8630
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic   p-value
## Lag[1]                      0.4544 5.003e-01
## Lag[2*(p+q)+(p+q)-1][11]    6.6572 1.388e-01
## Lag[4*(p+q)+(p+q)-1][19]   21.6385 7.611e-05
## d.o.f=4
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                       1.814 0.17803
## Lag[2*(p+q)+(p+q)-1][8]      6.348 0.20239
## Lag[4*(p+q)+(p+q)-1][14]    11.992 0.09275
## d.o.f=3
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[4]   0.09878 0.500 2.000  0.7533
## ARCH Lag[6]   1.58190 1.461 1.711  0.5897
## ARCH Lag[8]   5.02937 2.368 1.583  0.2457
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  4.0223
## Individual Statistics:              
## mu     0.26291
## ar1    0.12667
## ar2    0.19302
## ma1    0.15434
## ma2    0.16529
## omega  0.06879
## alpha1 0.03742
## beta1  0.08302
## beta2  0.08332
## gamma1 0.03523
## shape  0.18096
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          2.49 2.75 3.27
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value   prob sig
## Sign Bias           0.2678 0.7890    
## Negative Sign Bias  0.9865 0.3246    
## Positive Sign Bias  1.1610 0.2464    
## Joint Effect        2.3894 0.4956    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     53.42    4.040e-05
## 2    30     61.42    4.102e-04
## 3    40     81.45    7.989e-05
## 4    50     81.81    2.271e-03
## 
## 
## Elapsed time : 1.355784

3.3.2 LỰA CHỌN MÔ HÌNH BIÊN PHÙ HỢP NHẤT CHO TSVN

TSVNaft.model.list <- list(garch11n = TSVNaft11n, 
                        garch11std = TSVNaft11std,
                        garch11sstd = TSVNaft11sstd,
                        garch11ged = TSVNaft11ged,
                        garch11sged = TSVNaft11sged,
                        
                        garch12n = TSVNaft12n, 
                        garch12std = TSVNaft12std,
                        garch12sstd = TSVNaft12sstd,
                        garch12sged = TSVNaft12sged,
                        
                       garch21n = TSVNaft21n, 
                       garch21std = TSVNaft21std,
                        garch21sstd = TSVNaft21sstd,
                        garch21ged = TSVNaft21ged,
                        garch21sged = TSVNaft21sged,
                        
                       garch22n = TSVNaft22n, 
                        garch22std = TSVNaft22std,
                        garch22sstd = TSVNaft22sstd,
                        garch22ged = TSVNaft22ged,
                        garch22sged = TSVNaft22sged)

TSVNaft.info.mat <- sapply(TSVNaft.model.list, infocriteria)

rownames(TSVNaft.info.mat) <- rownames(infocriteria(TSVNaft11n))

TSVNaft.info.mat
##               garch11n garch11std garch11sstd garch11ged garch11sged  garch12n
## Akaike       -2.765198  -3.420058   -3.417891  -3.663148   -3.613890 -2.759820
## Bayes        -2.667845  -3.311888   -3.298903  -3.554978   -3.494902 -2.651649
## Shibata      -2.766415  -3.421555   -3.419695  -3.664645   -3.615694 -2.761317
## Hannan-Quinn -2.726484  -3.377043   -3.370574  -3.620133   -3.566573 -2.716805
##              garch12std garch12sstd garch12sged  garch21n garch21std
## Akaike        -3.417848   -3.634454   -3.626896 -2.759665  -3.525747
## Bayes         -3.298860   -3.504649   -3.497091 -2.640678  -3.395942
## Shibata       -3.419652   -3.636593   -3.629035 -2.761469  -3.527886
## Hannan-Quinn  -3.370531   -3.582835   -3.575277 -2.712348  -3.474128
##              garch21sstd garch21ged garch21sged  garch22n garch22std
## Akaike         -3.520362  -3.677414   -3.638286 -2.766677  -3.520167
## Bayes          -3.379741  -3.547609   -3.497664 -2.636873  -3.379546
## Shibata        -3.522865  -3.679553   -3.640788 -2.768817  -3.522670
## Hannan-Quinn   -3.464443  -3.625795   -3.582366 -2.715059  -3.464248
##              garch22sstd garch22ged garch22sged
## Akaike         -3.514783  -3.566606   -3.596615
## Bayes          -3.363345  -3.425984   -3.445176
## Shibata        -3.517676  -3.569108   -3.599507
## Hannan-Quinn   -3.454562  -3.510686   -3.536394
TSVNaft.inds <- which(TSVNaft.info.mat == min(TSVNaft.info.mat), arr.ind = TRUE)

model.TSVNaft <- colnames(TSVNaft.info.mat)[TSVNaft.inds[,2]]

model.TSVNaft
## [1] "garch21ged"
TSVNaft21ged
## 
## *---------------------------------*
## *          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.001981    0.000034   58.66451  0.00000
## ar1     0.351856    0.004439   79.27158  0.00000
## ar2    -0.039815    0.002014  -19.76676  0.00000
## ma1    -0.390770    0.004134  -94.53088  0.00000
## ma2    -0.011955    0.000533  -22.42283  0.00000
## omega   0.000009    0.000019    0.45853  0.64657
## alpha1  0.010322    0.013651    0.75615  0.44956
## alpha2  0.012142    0.015505    0.78312  0.43356
## beta1   0.966652    0.002340  413.10002  0.00000
## gamma1  0.677600    0.000977  693.81678  0.00000
## gamma2 -0.666050    0.003052 -218.21919  0.00000
## shape   0.452255    0.036868   12.26686  0.00000
## 
## Robust Standard Errors:
##         Estimate  Std. Error    t value Pr(>|t|)
## mu      0.001981    0.000049   40.76615  0.00000
## ar1     0.351856    0.009077   38.76196  0.00000
## ar2    -0.039815    0.007275   -5.47312  0.00000
## ma1    -0.390770    0.004635  -84.30320  0.00000
## ma2    -0.011955    0.002157   -5.54341  0.00000
## omega   0.000009    0.000032    0.27480  0.78347
## alpha1  0.010322    0.016945    0.60916  0.54242
## alpha2  0.012142    0.008965    1.35440  0.17561
## beta1   0.966652    0.001693  570.97921  0.00000
## gamma1  0.677600    0.002592  261.40592  0.00000
## gamma2 -0.666050    0.001687 -394.92406  0.00000
## shape   0.452255    0.034925   12.94926  0.00000
## 
## LogLikelihood : 672.0957 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -3.6774
## Bayes        -3.5476
## Shibata      -3.6796
## Hannan-Quinn -3.6258
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic   p-value
## Lag[1]                     0.08338 7.728e-01
## Lag[2*(p+q)+(p+q)-1][11]  19.79652 0.000e+00
## Lag[4*(p+q)+(p+q)-1][19]  26.83623 2.555e-07
## d.o.f=4
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                       1.744  0.1866
## Lag[2*(p+q)+(p+q)-1][8]      3.452  0.6029
## Lag[4*(p+q)+(p+q)-1][14]     6.558  0.5639
## d.o.f=3
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[4]   0.04466 0.500 2.000  0.8326
## ARCH Lag[6]   0.15780 1.461 1.711  0.9775
## ARCH Lag[8]   1.03095 2.368 1.583  0.9197
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  11.2263
## Individual Statistics:              
## mu     0.04593
## ar1    1.28066
## ar2    0.46260
## ma1    1.12307
## ma2    0.39342
## omega  0.08223
## alpha1 0.07939
## alpha2 0.10180
## beta1  0.16796
## gamma1 0.18803
## gamma2 0.17000
## shape  0.41439
## 
## 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.7035 0.4822    
## Negative Sign Bias  0.3439 0.7312    
## Positive Sign Bias  0.9092 0.3639    
## Joint Effect        1.3749 0.7114    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     41.95    0.0018018
## 2    30     63.76    0.0002059
## 3    40     60.94    0.0138311
## 4    50     71.22    0.0207102
## 
## 
## Elapsed time : 1.798247

3.4 KIỂM ĐỊNH SỰ PHÙ HỢP CỦA MÔ HÌNH BIÊN

3.4.1 TRÍCH XUẤT CHUỖI PHẦN DƯ CỦA CHUỖI LỢI SUẤT TSX

TSXaft.res <- residuals(TSXaft12ged)/sigma(TSXaft12ged)

fitdist(distribution = 'ged' , TSXaft.res, control = list())$pars
##            mu         sigma         shape 
## -4.503847e-05  9.405022e-01  3.718149e-01
sa <- pdist(distribution = 'ged' , q = TSXaft.res, mu = -4.503847e-05, sigma = 9.405022e-01, shape = 3.718149e-01) 

3.4.2 TRÍCH XUẤT CHUỖI PHẦN DƯ CỦA CHUỖI LỢI SUẤT TSVN

TSVNaft.res <- residuals(TSVNaft21ged)/sigma(TSVNaft21ged)

fitdist(distribution = 'ged' , TSVNaft.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.0002696898 1.1622061936 0.4054556239
va <- pdist(distribution = 'ged' , q = TSVNaft.res, mu =  0.0002696898 , sigma = 1.1622061936, shape = 0.4054556239) 

3.4.3 CÁC KIỂM ĐỊNH SỰ PHÙ HỢP CỦA MÔ HÌNH BIÊN

# Kiểm định Anderson-Darling
ad.test(sa, 'punif')
## 
##  Anderson-Darling test of goodness-of-fit
##  Null hypothesis: uniform distribution
##  Parameters assumed to be fixed
## 
## data:  sa
## An = 2.0008, p-value = 0.09178
ad.test(va, 'punif')
## 
##  Anderson-Darling test of goodness-of-fit
##  Null hypothesis: uniform distribution
##  Parameters assumed to be fixed
## 
## data:  va
## An = 2.1564, p-value = 0.07552
# Kiểm định Cramer-von Mises
cvm.test(sa, 'punif')
## 
##  Cramer-von Mises test of goodness-of-fit
##  Null hypothesis: uniform distribution
##  Parameters assumed to be fixed
## 
## data:  sa
## omega2 = 0.29182, p-value = 0.1425
cvm.test(va, 'punif')
## 
##  Cramer-von Mises test of goodness-of-fit
##  Null hypothesis: uniform distribution
##  Parameters assumed to be fixed
## 
## data:  va
## omega2 = 0.33542, p-value = 0.1077
# Kiểm định ks-test
ks.test(sa, 'punif')
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  sa
## D = 0.073892, p-value = 0.03967
## alternative hypothesis: two-sided
ks.test(va, 'punif')
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  va
## D = 0.06693, p-value = 0.0802
## alternative hypothesis: two-sided

3.5 CHẠY COPULA

BiCopSelect(sa, va, familyset = NA, selectioncrit = 'AIC' , indeptest = FALSE , level = 0.05)
## Bivariate copula: t (par = 0.01, par2 = 3.67, tau = 0.01)
hihi <- BiCopEst(sa,va, family = 2, method = 'mle', se = T, max.df = 10)
summary(hihi)
## Family
## ------ 
## No:    2
## Name:  t
## 
## Parameter(s)
## ------------
## par:  0.01  (SE = 0.06)
## par2: 3.67  (SE = 0.77)
## Dependence measures
## -------------------
## Kendall's tau:    0.01 (empirical = -0.01, p value = 0.87)
## Upper TD:         0.09 
## Lower TD:         0.09 
## 
## Fit statistics
## --------------
## logLik:  15.51 
## AIC:    -27.01 
## BIC:    -19.24