library(xlsx)
library(tseries)
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
library(fBasics)
library(FinTS)
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
library(forecast)
##
## Attaching package: 'forecast'
## The following object is masked from 'package:FinTS':
##
## Acf
library(arfima)
## Loading required package: ltsa
## Note that the arfima package has new defaults starting with
## 1.4-0: type arfimachanges() for a list, as well as some other notes.
## NOTE: some of these are quite important!
##
## Attaching package: 'arfima'
## The following object is masked from 'package:forecast':
##
## arfima
## The following object is masked from 'package:stats':
##
## BIC
library(rugarch)
## Loading required package: parallel
##
## Attaching package: 'rugarch'
## The following objects are masked from 'package:fBasics':
##
## qgh, qnig
## The following object is masked from 'package:stats':
##
## sigma
library(nortest)
library(ADGofTest)
##
## Attaching package: 'ADGofTest'
## The following object is masked from 'package:nortest':
##
## ad.test
library(goftest)
##
## Attaching package: 'goftest'
## The following object is masked from 'package:ADGofTest':
##
## ad.test
## The following objects are masked from 'package:nortest':
##
## ad.test, cvm.test
library(copula)
library(VineCopula)
##
## Attaching package: 'VineCopula'
## The following object is masked from 'package:copula':
##
## pobs
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(lubridate)
##
## Attaching package: 'lubridate'
## The following object is masked from 'package:copula':
##
## interval
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
library(xts)
##
## ######################### Warning from 'xts' package ##########################
## # #
## # The dplyr lag() function breaks how base R's lag() function is supposed to #
## # work, which breaks lag(my_xts). Calls to lag(my_xts) that you type or #
## # source() into this session won't work correctly. #
## # #
## # Use stats::lag() to make sure you're not using dplyr::lag(), or you can add #
## # conflictRules('dplyr', exclude = 'lag') to your .Rprofile to stop #
## # dplyr from breaking base R's lag() function. #
## # #
## # Code in packages is not affected. It's protected by R's namespace mechanism #
## # Set `options(xts.warn_dplyr_breaks_lag = FALSE)` to suppress this warning. #
## # #
## ###############################################################################
##
## Attaching package: 'xts'
## The following objects are masked from 'package:dplyr':
##
## first, last
library(corrplot)
## corrplot 0.92 loaded
library(moments)
##
## Attaching package: 'moments'
## The following objects are masked from 'package:fBasics':
##
## kurtosis, skewness
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ purrr 1.0.2 ✔ tidyr 1.3.0
## ✔ readr 2.1.5
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ xts::first() masks dplyr::first()
## ✖ lubridate::interval() masks copula::interval()
## ✖ dplyr::lag() masks stats::lag()
## ✖ xts::last() masks dplyr::last()
## ✖ purrr::reduce() masks rugarch::reduce()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(knitr)
library(ggplot2)
library(plotly)
##
## Attaching package: 'plotly'
##
## The following object is masked from 'package:ggplot2':
##
## last_plot
##
## The following object is masked from 'package:stats':
##
## filter
##
## The following object is masked from 'package:graphics':
##
## layout
library(gridExtra)
##
## Attaching package: 'gridExtra'
##
## The following object is masked from 'package:dplyr':
##
## combine
library(gridGraphics)
## Loading required package: grid
library(png)
library(PerformanceAnalytics)
##
## Attaching package: 'PerformanceAnalytics'
##
## The following objects are masked from 'package:moments':
##
## kurtosis, skewness
##
## The following objects are masked from 'package:fBasics':
##
## kurtosis, skewness
##
## The following object is masked from 'package:graphics':
##
## legend
library(kableExtra)
##
## Attaching package: 'kableExtra'
##
## The following object is masked from 'package:dplyr':
##
## group_rows
# Hàm vẽ biểu đồ phân tán
scatter_plot <- function(random_data) {
ggplot(data.frame(random_data), aes(x = random_data[,1], y = random_data[,2])) +
geom_point(alpha = 0.5) +
theme_minimal() +
labs(x = "u", y = "v")
}
# Hàm vẽ biểu đồ phối cảnh
persp_plot <- function(copula_obj, file_name) {
png(file_name)
persp(copula_obj, dCopula,
xlab = 'u', ylab = 'v', ltheta = 120,
ticktype = "detailed", cex.axis = 0.8)
dev.off()
rasterGrob(readPNG(file_name), interpolate = TRUE)
}
# Mô phỏng dữ liệu
set.seed(123)
cop_nor <- normalCopula(param = 0.8, dim = 2)
random_nor <- rCopula(copula = cop_nor, n = 7600)
cop_std <- tCopula(param = 0.8, dim = 2, df = 1)
random_std <- rCopula(copula = cop_std, n = 7600)
# Vẽ biểu đồ phân tán
png('nors.png')
scatter_plot(random_nor)
dev.off()
## png
## 2
nors <- rasterGrob(readPNG('nors.png'), interpolate = TRUE)
png('stds.png')
scatter_plot(random_std)
dev.off()
## png
## 2
stds <- rasterGrob(readPNG('stds.png'), interpolate = TRUE)
# Vẽ biểu đồ phối cảnh
nor_per <- persp_plot(cop_nor, 'norp.png')
std_per <- persp_plot(cop_std, 'stdp.png')
# Thêm ghi chú cho biểu đồ
top_note <- textGrob("Biểu đồ phân tán và phối cảnh PDF với Copula Gaussian và Copula t-Student",
gp = gpar(fontsize = 12, font = 1), hjust = 0.5)
# Kết hợp các biểu đồ và ghi chú
grid.arrange(
top_note,
arrangeGrob(nors, nor_per, stds, std_per, ncol = 3,
layout_matrix = rbind(c(1, 2, 5), c(3, 4, 5)),
widths = c(2, 2, 1)),
nrow = 3,
heights = c(1, 4, 1)
)

data <- read.xlsx("C:/Users/ASUS/OneDrive - UFM/Desktop/mpnn/dulieuthuchanh.xlsx",1)
a1<- read.xlsx("C:/Users/ASUS/OneDrive - UFM/Desktop/mpnn/vni.xlsx", sheetIndex=1, header=T)
a2<- read.xlsx("C:/Users/ASUS/OneDrive - UFM/Desktop/mpnn/hsi.xlsx", sheetIndex=1, header=T)
vni_1<- xts(a1[,-1], order.by = a1$Date)
hsi_1<-xts(a2[,-1], order.by = a2$i)
vni <- data$r_VNI
hsi <- data$R_HSI
# Thống kê mô tả dữ liệu
# mô tả thống kê VNI
tkmtvni<-data %>% summarise(Min = min(vni),
Max = max(vni),
Mean = mean(vni),
StDev = sd(vni),
Skewness = skewness(vni),
Kurtosis = kurtosis(vni))
tkmtvni
## Min Max Mean StDev Skewness Kurtosis
## 1 0.9332556 1.049801 1.000174 0.01307976 -0.8961616 3.582298
# mô tả thống kê HSI
tkmthsi<-data %>% summarise(Min = min(hsi),
Max = max(hsi),
Mean = mean(hsi),
StDev = sd(hsi),
Skewness = skewness(hsi),
Kurtosis = kurtosis(hsi))
tkmthsi
## Min Max Mean StDev Skewness Kurtosis
## 1 0.9332449 1.090818 0.9997044 0.01478338 0.325473 3.291129
ggplot(data, aes(x = data$Date, y = data$r_VNI)) +
geom_line(color = "black") +
labs(title = "Biến động theo ngày của hệ số giá VNINDEX",
x = "Ngày",
y = "Hệ số giá của chuỗi VNI") +
theme_minimal()
## Warning: Use of `data$Date` is discouraged.
## ℹ Use `Date` instead.
## Warning: Use of `data$r_VNI` is discouraged.
## ℹ Use `r_VNI` instead.

ggplot(data, aes(x = data$Date, y = data$R_HSI)) +
geom_line(color = "black") +
labs(title = "Biến động theo ngày của hệ số giá HSI",
x = "Ngày",
y = "Hệ số giá") +
theme_minimal()
## Warning: Use of `data$Date` is discouraged.
## ℹ Use `Date` instead.
## Warning: Use of `data$R_HSI` is discouraged.
## ℹ Use `R_HSI` instead.

# Kiểm định ADF cho VNI
adf_vni <- adf.test(vni)
## Warning in adf.test(vni): p-value smaller than printed p-value
print(adf_vni)
##
## Augmented Dickey-Fuller Test
##
## data: vni
## Dickey-Fuller = -11.341, Lag order = 11, p-value = 0.01
## alternative hypothesis: stationary
# Kiểm định ADF cho HSI
adf_hsi <- adf.test(hsi)
## Warning in adf.test(hsi): p-value smaller than printed p-value
print(adf_hsi)
##
## Augmented Dickey-Fuller Test
##
## data: hsi
## Dickey-Fuller = -11.692, Lag order = 11, p-value = 0.01
## alternative hypothesis: stationary
# Kiểm định J-B cho VNI
jb_vni <- jarqueberaTest(vni)
print(jb_vni)
##
## Title:
## Jarque - Bera Normalality Test
##
## Test Results:
## STATISTIC:
## X-squared: 962.0486
## P VALUE:
## Asymptotic p Value: < 2.2e-16
# Kiểm định J-B cho HSI
jb_hsi <- jarqueberaTest(hsi)
print(jb_hsi)
##
## Title:
## Jarque - Bera Normalality Test
##
## Test Results:
## STATISTIC:
## X-squared: 674.8465
## P VALUE:
## Asymptotic p Value: < 2.2e-16
# Kiểm định Q(2) cho VNI
q_vni <- Box.test(vni, lag = 2, type = "Ljung-Box")
print(q_vni)
##
## Box-Ljung test
##
## data: vni
## X-squared = 10.849, df = 2, p-value = 0.004406
# Kiểm định Q(2) cho HSI
q_hsi <- Box.test(hsi, lag = 2, type = "Ljung-Box")
print(q_hsi)
##
## Box-Ljung test
##
## data: hsi
## X-squared = 0.79445, df = 2, p-value = 0.6722
# Kiểm định Q^2(2) cho VNI
q2_vni <- Box.test(vni^2, lag = 2, type = "Ljung-Box")
print(q2_vni)
##
## Box-Ljung test
##
## data: vni^2
## X-squared = 10.483, df = 2, p-value = 0.005293
# Kiểm định Q^2(2) cho HSI
q2_hsi <- Box.test(hsi^2, lag = 2, type = "Ljung-Box")
print(q2_hsi)
##
## Box-Ljung test
##
## data: hsi^2
## X-squared = 0.76348, df = 2, p-value = 0.6827
# Kiểm định ARCH cho VNI
arch_vni <- ArchTest(vni, lags = 2)
print(arch_vni)
##
## ARCH LM-test; Null hypothesis: no ARCH effects
##
## data: vni
## Chi-squared = 9.9304, df = 2, p-value = 0.006977
# Kiểm định ARCH cho HSI
arch_hsi <- ArchTest(hsi, lags = 2)
print(arch_hsi)
##
## ARCH LM-test; Null hypothesis: no ARCH effects
##
## data: hsi
## Chi-squared = 0.77668, df = 2, p-value = 0.6782
pearson <- cor(data$r_VNI,data$R_HSI, method="pearson")
pearson
## [1] 0.3243279
spearman <- cor(data$r_VNI,data$R_HSI, method="spearman")
spearman
## [1] 0.3015104
kendall <- cor(data$r_VNI,data$R_HSI, method="kendall")
kendall
## [1] 0.2062329
cor_pea<- cor(data[, c("r_VNI", "R_HSI")], method = "pearson")
cor_pea
## r_VNI R_HSI
## r_VNI 1.0000000 0.3243279
## R_HSI 0.3243279 1.0000000
corrplot(cor_pea, method = "color")

cor_spea<- cor(data[, c("r_VNI", "R_HSI")], method = "spearman")
cor_spea
## r_VNI R_HSI
## r_VNI 1.0000000 0.3015104
## R_HSI 0.3015104 1.0000000
corrplot(cor_spea, method = "color")

cor_ken<- cor(data[, c("r_VNI", "R_HSI")], method = "kendall")
cor_ken
## r_VNI R_HSI
## r_VNI 1.0000000 0.2062329
## R_HSI 0.2062329 1.0000000
corrplot(cor_ken, method = "color")

#ước lượng mô hình arma chuỗi vni
autoarfima(vni,ar.max = 2, ma.max = 2, criterion = "AIC", method = "full")$fit
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
##
## *----------------------------------*
## * ARFIMA Model Fit *
## *----------------------------------*
## Mean Model : ARFIMA(0,0,2)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 1.000176 0.000386 2592.6530 0.000000
## ma1 0.046748 0.026402 1.7706 0.076620
## ma2 0.072217 0.026447 2.7306 0.006321
## sigma 0.013080 0.000245 53.3250 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 1.000176 0.000386 2594.1144 0.000000
## ma1 0.046748 0.031246 1.4961 0.134623
## ma2 0.072217 0.030184 2.3925 0.016732
## sigma 0.013080 0.000689 18.9973 0.000000
##
## LogLikelihood : 4204.384
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8379
## Bayes -5.8233
## Shibata -5.8379
## Hannan-Quinn -5.8325
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.0001263 0.9910
## Lag[2*(p+q)+(p+q)-1][5] 0.0695023 1.0000
## Lag[4*(p+q)+(p+q)-1][9] 1.1767727 0.9994
##
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 44.35 2.742e-11
## Lag[2*(p+q)+(p+q)-1][2] 71.28 0.000e+00
## Lag[4*(p+q)+(p+q)-1][5] 128.99 0.000e+00
##
##
## ARCH LM Tests
## ------------------------------------
## Statistic DoF P-Value
## ARCH Lag[2] 83.34 2 0
## ARCH Lag[5] 115.93 5 0
## ARCH Lag[10] 150.49 10 0
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 0.9095
## Individual Statistics:
## mu 0.07437
## ma1 0.13278
## ma2 0.33128
## sigma 0.31399
##
## 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.02199101
#ước lượng mô hình arma chuỗi hsi
autoarfima(hsi, ar.max = 2, ma.max = 2, criterion = "AIC", method = "full")$fit
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
##
## *----------------------------------*
## * ARFIMA Model Fit *
## *----------------------------------*
## Mean Model : ARFIMA(2,0,2)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999758 0.000016 64378.322 0
## ar1 0.000000 NA NA NA
## ar2 0.964266 0.006410 150.437 0
## ma1 -0.024572 0.000542 -45.298 0
## ma2 -0.986805 0.000022 -44238.056 0
## sigma 0.014664 0.000650 22.543 0
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999758 0.002339 427.46774 0.00000
## ar1 0.000000 NA NA NA
## ar2 0.964266 1.420942 0.67861 0.49739
## ma1 -0.024572 0.113659 -0.21619 0.82884
## ma2 -0.986805 0.009495 -103.93076 0.00000
## sigma 0.014664 0.136754 0.10723 0.91461
##
## LogLikelihood : 4034.156
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.5999
## Bayes -5.5816
## Shibata -5.6000
## Hannan-Quinn -5.5931
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1484 0.700090
## Lag[2*(p+q)+(p+q)-1][11] 7.9995 0.001189
## Lag[4*(p+q)+(p+q)-1][19] 11.9252 0.200679
##
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 79.96 0
## Lag[2*(p+q)+(p+q)-1][2] 102.44 0
## Lag[4*(p+q)+(p+q)-1][5] 132.28 0
##
##
## ARCH LM Tests
## ------------------------------------
## Statistic DoF P-Value
## ARCH Lag[2] 102.0 2 0
## ARCH Lag[5] 108.3 5 0
## ARCH Lag[10] 121.8 10 0
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 2.8501
## Individual Statistics:
## mu 0.01994
## ar2 0.01948
## ma1 0.01552
## ma2 0.01558
## sigma 2.12253
##
## 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.4894309
# ƯỚC LƯỢNG CÁC DẠNG MÔ HÌNH GJR-GARCH
## Các dạng MH GJR-GARCH cho chuỗi lợi suất VNI
### GJR-GARCH(11)VNI
vni.garch11n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "norm")
vni.garch11n.fit <- ugarchfit(spec = vni.garch11n.spec, data = vni)
vni.garch11t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "std")
vni.garch11t.fit <- ugarchfit(spec = vni.garch11t.spec, data = vni)
vni.garch11st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "sstd")
vni.garch11st.fit <- ugarchfit(spec = vni.garch11st.spec, data = vni)
vni.garch11g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "ged")
vni.garch11g.fit <- ugarchfit(spec = vni.garch11g.spec, data = vni)
vni.garch11sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "sged")
vni.garch11sg.fit <- ugarchfit(spec = vni.garch11sg.spec, data = vni)
## GJR-GARCH(12)VNI
vni.garch12n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "norm")
vni.garch12n.fit <- ugarchfit(spec = vni.garch12n.spec, data = vni)
vni.garch12t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "std")
vni.garch12t.fit <- ugarchfit(spec = vni.garch12t.spec, data = vni)
vni.garch12st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "sstd")
vni.garch12st.fit <- ugarchfit(spec = vni.garch12st.spec, data = vni)
vni.garch12g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "ged")
vni.garch12g.fit <- ugarchfit(spec = vni.garch12g.spec, data = vni)
vni.garch12sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "sged")
vni.garch12sg.fit <- ugarchfit(spec = vni.garch12sg.spec, data = vni)
## GJR-GARCH(21)VNI
vni.garch21n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "norm")
vni.garch21n.fit <- ugarchfit(spec = vni.garch21n.spec, data = vni)
vni.garch21t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "std")
vni.garch21t.fit <- ugarchfit(spec = vni.garch21t.spec, data = vni)
vni.garch21st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "sstd")
vni.garch21st.fit <- ugarchfit(spec = vni.garch21st.spec, data = vni)
vni.garch21g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "ged")
vni.garch21g.fit <- ugarchfit(spec = vni.garch21g.spec, data = vni)
vni.garch21sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "sged")
vni.garch21sg.fit <- ugarchfit(spec = vni.garch21sg.spec, data = vni)
## GJR-GARCH(22)VNI
vni.garch22n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "norm")
vni.garch22n.fit <- ugarchfit(spec = vni.garch22n.spec, data = vni)
vni.garch22t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "std")
vni.garch22t.fit <- ugarchfit(spec = vni.garch22t.spec, data = vni)
vni.garch22st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "sstd")
vni.garch22st.fit <- ugarchfit(spec = vni.garch22st.spec, data = vni)
vni.garch22g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "ged")
vni.garch22g.fit <- ugarchfit(spec = vni.garch22g.spec, data = vni)
vni.garch22sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(0, 2), include.mean = TRUE), distribution.model = "sged")
vni.garch22sg.fit <- ugarchfit(spec = vni.garch22sg.spec, data = vni)
### GJR-GARCH(11)HSI
hsi.garch11n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
hsi.garch11n.fit <- ugarchfit(spec = hsi.garch11n.spec, data = hsi)
hsi.garch11t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
hsi.garch11t.fit <- ugarchfit(spec = hsi.garch11t.spec, data = hsi)
hsi.garch11st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
hsi.garch11st.fit <- ugarchfit(spec = hsi.garch11st.spec, data = hsi)
hsi.garch11g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
hsi.garch11g.fit <- ugarchfit(spec = hsi.garch11g.spec, data = hsi)
hsi.garch11sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
hsi.garch11sg.fit <- ugarchfit(spec = hsi.garch11sg.spec, data = hsi)
## GJR-GARCH(12)HSI
hsi.garch12n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
hsi.garch12n.fit <- ugarchfit(spec = hsi.garch12n.spec, data = hsi)
hsi.garch12t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
hsi.garch12t.fit <- ugarchfit(spec = hsi.garch12t.spec, data = hsi)
hsi.garch12st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
hsi.garch12st.fit <- ugarchfit(spec = hsi.garch12st.spec, data = hsi)
hsi.garch12g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
hsi.garch12g.fit <- ugarchfit(spec = hsi.garch12g.spec, data = hsi)
hsi.garch12sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
hsi.garch12sg.fit <- ugarchfit(spec = hsi.garch12sg.spec, data = hsi)
## GJR-GARCH(21)HSI
hsi.garch21n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
hsi.garch21n.fit <- ugarchfit(spec = hsi.garch21n.spec, data = hsi)
hsi.garch21t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
hsi.garch21t.fit <- ugarchfit(spec = hsi.garch21t.spec, data = hsi)
hsi.garch21st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
hsi.garch21st.fit <- ugarchfit(spec = hsi.garch21st.spec, data = hsi)
hsi.garch21g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
hsi.garch21g.fit <- ugarchfit(spec = hsi.garch21g.spec, data = hsi)
hsi.garch21sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
hsi.garch21sg.fit <- ugarchfit(spec = hsi.garch21sg.spec, data = hsi)
## GJR-GARCH(22)HSI
hsi.garch22n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
hsi.garch22n.fit <- ugarchfit(spec = hsi.garch22n.spec, data = hsi)
hsi.garch22t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
hsi.garch22t.fit <- ugarchfit(spec = hsi.garch22t.spec, data = hsi)
hsi.garch22st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
hsi.garch22st.fit <- ugarchfit(spec = hsi.garch22st.spec, data = hsi)
hsi.garch22g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
hsi.garch22g.fit <- ugarchfit(spec = hsi.garch22g.spec, data = hsi)
hsi.garch22sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
hsi.garch22sg.fit <- ugarchfit(spec = hsi.garch22sg.spec, data = hsi)
### LỰA CHỌN MO HINH GJR-GARCH ###
# Lựa chọn mô hình biên phù hợp nhất cho chuỗi VNI
vni.model.list <- list(garch11n = vni.garch11n.fit, garch11t = vni.garch11t.fit, garch11st = vni.garch11st.fit,
garch11g = vni.garch11g.fit, garch11sg = vni.garch11sg.fit,
garch12n = vni.garch12n.fit, garch12t = vni.garch12t.fit, garch12st = vni.garch12st.fit, garch12g =
vni.garch12g.fit, garch12sg = vni.garch12sg.fit,
garch21n = vni.garch21n.fit, garch21t = vni.garch21t.fit, garch21st = vni.garch21st.fit, garch21g =
vni.garch21g.fit, garch21sg = vni.garch21sg.fit,
garch22n = vni.garch22n.fit, garch22t = vni.garch22t.fit, garch22st = vni.garch22st.fit, garch22g =
vni.garch22g.fit, garch22sg = vni.garch22sg.fit)
vni.info.mat <- sapply(vni.model.list, infocriteria)
rownames(vni.info.mat) <- rownames(infocriteria(vni.garch11n.fit))
vni.info.mat
## garch11n garch11t garch11st garch11g garch11sg garch12n
## Akaike -6.054170 -6.190024 -6.204934 -6.180953 -6.196469 -6.053739
## Bayes -6.028526 -6.160716 -6.171963 -6.151646 -6.163498 -6.024432
## Shibata -6.054217 -6.190085 -6.205011 -6.181015 -6.196547 -6.053801
## Hannan-Quinn -6.044597 -6.179083 -6.192625 -6.170012 -6.184161 -6.042799
## garch12t garch12st garch12g garch12sg garch21n garch21t
## Akaike -6.189065 -6.204124 -6.179909 -6.195561 -6.061177 -6.191209
## Bayes -6.156094 -6.167489 -6.146938 -6.158926 -6.028206 -6.154574
## Shibata -6.189142 -6.204219 -6.179987 -6.195656 -6.061255 -6.191304
## Hannan-Quinn -6.176756 -6.190448 -6.167601 -6.181885 -6.048869 -6.177533
## garch21st garch21g garch21sg garch22n garch22t garch22st
## Akaike -6.206075 -6.182498 -6.198247 -6.059787 -6.189819 -6.204685
## Bayes -6.165777 -6.145864 -6.157949 -6.023152 -6.149521 -6.160724
## Shibata -6.206191 -6.182594 -6.198363 -6.059883 -6.189935 -6.204823
## Hannan-Quinn -6.191031 -6.168822 -6.183204 -6.046111 -6.174775 -6.188274
## garch22g garch22sg
## Akaike -6.181108 -6.196858
## Bayes -6.140810 -6.152896
## Shibata -6.181224 -6.196995
## Hannan-Quinn -6.166065 -6.180446
vni.inds <- which(vni.info.mat == min(vni.info.mat), arr.ind=TRUE)
model.vni <- colnames(vni.info.mat)[vni.inds[,2]]
model.vni
## [1] "garch21st"
safe_infocriteria <- function(model) {
tryCatch(
infocriteria(model),
error = function(e) return(rep(NA, 4))
)
}
# Lựa chọn mô hình biên phù hợp nhất cho chuỗi HSI
hsi.model.list <- list(
garch11n = hsi.garch11n.fit,
garch11t = hsi.garch11t.fit,
garch11st = hsi.garch11st.fit,
garch11g = hsi.garch11g.fit,
garch11sg = hsi.garch11sg.fit,
garch12n = hsi.garch12n.fit,
garch12t = hsi.garch12t.fit,
garch12st = hsi.garch12st.fit,
garch12g = hsi.garch12g.fit,
garch12sg = hsi.garch12sg.fit,
garch21n = hsi.garch21n.fit,
garch21t = hsi.garch21t.fit,
garch21st = hsi.garch21st.fit,
garch21g = hsi.garch21g.fit,
garch21sg = hsi.garch21sg.fit,
garch22n = hsi.garch22n.fit,
garch22t = hsi.garch22t.fit,
garch22st = hsi.garch22st.fit,
garch22g = hsi.garch22g.fit,
garch22sg = hsi.garch22sg.fit
)
hsi.info.mat <- sapply(hsi.model.list, safe_infocriteria)
rownames(hsi.info.mat) <- rownames(infocriteria(hsi.garch11n.fit))
hsi.info.mat
## garch11n garch11t garch11st garch11g garch11sg garch12n
## Akaike -5.719379 -5.759857 -5.761984 -5.753427 -5.753936 -5.696673
## Bayes -5.686408 -5.723222 -5.721686 -5.716792 -5.713638 -5.660039
## Shibata -5.719456 -5.759953 -5.762100 -5.753523 -5.754052 -5.696769
## Hannan-Quinn -5.707070 -5.746181 -5.746940 -5.739751 -5.738893 -5.682997
## garch12t garch12st garch12g garch12sg garch21n garch21t
## Akaike -5.761214 -5.760604 -5.752037 -5.752133 -5.718929 -5.762572
## Bayes -5.720916 -5.716643 -5.711739 -5.708172 -5.678631 -5.718611
## Shibata -5.761330 -5.760742 -5.752153 -5.752271 -5.719045 -5.762710
## Hannan-Quinn -5.746170 -5.744193 -5.736993 -5.735722 -5.703886 -5.746161
## garch21st garch21g garch21sg garch22n garch22t garch22st
## Akaike -5.761933 -5.752587 -5.753035 -5.717236 -5.761416 -5.751100
## Bayes -5.714308 -5.708626 -5.705410 -5.673275 -5.713791 -5.699812
## Shibata -5.762094 -5.752725 -5.753196 -5.717374 -5.761577 -5.751287
## Hannan-Quinn -5.744154 -5.736176 -5.735256 -5.700825 -5.743637 -5.731954
## garch22g garch22sg
## Akaike -5.757997 -5.752568
## Bayes -5.710373 -5.701280
## Shibata -5.758159 -5.752755
## Hannan-Quinn -5.740219 -5.733422
hsi.inds <- which(hsi.info.mat == min(hsi.info.mat, na.rm = TRUE), arr.ind = TRUE)
model.hsi <- colnames(hsi.info.mat)[hsi.inds[, 2]]
model.hsi
## [1] "garch21t"
### THAM SỐ ƯỚC LƯỢNG MÔ HÌNH BIÊN PHÙ HỢP NHẤT
vni.garch21st.fit
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(2,1)
## Mean Model : ARFIMA(0,0,2)
## Distribution : sstd
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 1.000392 0.000647 1546.399494 0.000000
## ma1 0.063814 0.031991 1.994751 0.046070
## ma2 0.039839 0.025807 1.543735 0.122653
## omega 0.000008 0.000001 5.666472 0.000000
## alpha1 0.000002 0.053934 0.000044 0.999965
## alpha2 0.038735 0.069696 0.555761 0.578374
## beta1 0.830101 0.019982 41.542005 0.000000
## gamma1 0.382496 0.103672 3.689499 0.000225
## gamma2 -0.215836 0.107099 -2.015306 0.043873
## skew 0.835023 0.037349 22.357044 0.000000
## shape 4.446862 0.718473 6.189325 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 1.000392 0.001923 520.234970 0.000000
## ma1 0.063814 0.046995 1.357886 0.174500
## ma2 0.039839 0.028785 1.384047 0.166344
## omega 0.000008 0.000004 1.819350 0.068858
## alpha1 0.000002 0.116158 0.000021 0.999984
## alpha2 0.038735 0.170063 0.227766 0.819828
## beta1 0.830101 0.028686 28.937680 0.000000
## gamma1 0.382496 0.086019 4.446669 0.000009
## gamma2 -0.215836 0.188205 -1.146817 0.251457
## skew 0.835023 0.076012 10.985395 0.000000
## shape 4.446862 1.712330 2.596966 0.009405
##
## LogLikelihood : 4476.271
##
## Information Criteria
## ------------------------------------
##
## Akaike -6.2061
## Bayes -6.1658
## Shibata -6.2062
## Hannan-Quinn -6.1910
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.8543 0.3553
## Lag[2*(p+q)+(p+q)-1][5] 1.6181 0.9951
## Lag[4*(p+q)+(p+q)-1][9] 2.3903 0.9611
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 2.319 0.1278
## Lag[2*(p+q)+(p+q)-1][8] 3.549 0.5854
## Lag[4*(p+q)+(p+q)-1][14] 6.458 0.5773
## d.o.f=3
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[4] 0.1360 0.500 2.000 0.7122
## ARCH Lag[6] 0.4466 1.461 1.711 0.9068
## ARCH Lag[8] 1.2559 2.368 1.583 0.8835
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 30.9322
## Individual Statistics:
## mu 0.29105
## ma1 0.12289
## ma2 0.45091
## omega 4.64889
## alpha1 0.17290
## alpha2 0.11623
## beta1 0.16510
## gamma1 0.08140
## gamma2 0.06384
## skew 0.12334
## shape 0.19285
##
## 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.930 0.05382 *
## Negative Sign Bias 2.221 0.02651 **
## Positive Sign Bias 1.007 0.31388
## Joint Effect 9.992 0.01864 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 25.70 0.13883
## 2 30 36.59 0.15708
## 3 40 50.40 0.10449
## 4 50 73.06 0.01452
##
##
## Elapsed time : 2.855613
hsi.garch21t.fit
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(2,1)
## Mean Model : ARFIMA(2,0,2)
## Distribution : std
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999744 0.000061 1.6374e+04 0.000000
## ar1 0.728926 0.000605 1.2040e+03 0.000000
## ar2 0.255337 0.000297 8.5948e+02 0.000000
## ma1 -0.773369 0.000069 -1.1153e+04 0.000000
## ma2 -0.233049 0.000048 -4.8171e+03 0.000000
## omega 0.000013 0.000001 1.5125e+01 0.000000
## alpha1 0.000000 0.024092 1.5000e-05 0.999988
## alpha2 0.026834 0.024399 1.0998e+00 0.271407
## beta1 0.852460 0.016037 5.3157e+01 0.000000
## gamma1 0.007043 0.044248 1.5917e-01 0.873538
## gamma2 0.131463 0.053203 2.4709e+00 0.013476
## shape 5.930144 0.831933 7.1281e+00 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999744 0.012291 81.340868 0.00000
## ar1 0.728926 0.008509 85.668147 0.00000
## ar2 0.255337 0.001929 132.341812 0.00000
## ma1 -0.773369 0.007140 -108.315335 0.00000
## ma2 -0.233049 0.003755 -62.061769 0.00000
## omega 0.000013 0.000034 0.371184 0.71050
## alpha1 0.000000 0.309461 0.000001 1.00000
## alpha2 0.026834 0.154737 0.173418 0.86232
## beta1 0.852460 0.945380 0.901712 0.36721
## gamma1 0.007043 0.607135 0.011600 0.99074
## gamma2 0.131463 0.648345 0.202767 0.83932
## shape 5.930144 39.843173 0.148837 0.88168
##
## LogLikelihood : 4158.171
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.7626
## Bayes -5.7186
## Shibata -5.7627
## Hannan-Quinn -5.7462
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.3102 0.5775
## Lag[2*(p+q)+(p+q)-1][11] 4.0429 0.9999
## Lag[4*(p+q)+(p+q)-1][19] 6.9615 0.9116
## d.o.f=4
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.2722 0.6019
## Lag[2*(p+q)+(p+q)-1][8] 3.6258 0.5715
## Lag[4*(p+q)+(p+q)-1][14] 6.5301 0.5676
## d.o.f=3
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[4] 2.591 0.500 2.000 0.1075
## ARCH Lag[6] 3.689 1.461 1.711 0.2198
## ARCH Lag[8] 5.811 2.368 1.583 0.1743
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 73.4419
## Individual Statistics:
## mu 2.17659
## ar1 0.02534
## ar2 0.02029
## ma1 0.02845
## ma2 0.03256
## omega 5.52670
## alpha1 1.54623
## alpha2 1.42713
## beta1 1.64102
## gamma1 1.39359
## gamma2 1.52695
## shape 1.06234
##
## 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.4935 0.6217
## Negative Sign Bias 0.8415 0.4002
## Positive Sign Bias 0.4633 0.6432
## Joint Effect 3.9206 0.2702
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 27.12 0.1020
## 2 30 33.08 0.2743
## 3 40 41.61 0.3577
## 4 50 55.75 0.2358
##
##
## Elapsed time : 3.908672
### KIỂM ĐỊNH SỰ PHÙ HỢP CỦA MÔ HÌNH BIÊN
## Trích xuất chuỗi phần dư u của chuỗi lợi suất HSI
hsi.res <- residuals(hsi.garch21t.fit)/sigma(hsi.garch21t.fit)
fitdist(distribution = "std", hsi.res, control = list())$pars
## mu sigma shape
## 0.01276228 0.98573294 6.17652129
u <- pdist(distribution = "std", q = hsi.res, mu =0.01276228 , sigma = 0.98573294, shape = 6.17652129 )
## Trích xuất chuỗi phần dư v của chuỗi lợi suất VNI
vni.res <- residuals(vni.garch21st.fit)/sigma(vni.garch21st.fit)
fitdist(distribution = "sstd", vni.res, control = list()) $pars
## mu sigma skew shape
## -0.004896141 1.004409661 0.832541797 4.415188211
v = pdist("sstd",vni.res, mu = -0.004896141, sigma = 1.004409661, skew = 0.832541797, shape = 4.415188211)
### Các kiểm định sự phù hợp của mô hình biên:
# Kiem dinh Anderson-Darling
ad.test(u, "punif")
##
## Anderson-Darling test of goodness-of-fit
## Null hypothesis: uniform distribution
## Parameters assumed to be fixed
##
## data: u
## An = 0.62089, p-value = 0.6284
ad.test(v, "punif")
##
## Anderson-Darling test of goodness-of-fit
## Null hypothesis: uniform distribution
## Parameters assumed to be fixed
##
## data: v
## An = 0.73995, p-value = 0.5264
cvm.test(u, "punif")
##
## Cramer-von Mises test of goodness-of-fit
## Null hypothesis: uniform distribution
## Parameters assumed to be fixed
##
## data: u
## omega2 = 0.11699, p-value = 0.5079
cvm.test(v, "punif")
##
## Cramer-von Mises test of goodness-of-fit
## Null hypothesis: uniform distribution
## Parameters assumed to be fixed
##
## data: v
## omega2 = 0.1346, p-value = 0.4401
# Kiem dinh ks-test
##Null hypothesis: uniform distribution
ks.test(u, "punif")
##
## Asymptotic one-sample Kolmogorov-Smirnov test
##
## data: u
## D = 0.022039, p-value = 0.4868
## alternative hypothesis: two-sided
ks.test(v, "punif")
##
## Asymptotic one-sample Kolmogorov-Smirnov test
##
## data: v
## D = 0.03132, p-value = 0.1188
## alternative hypothesis: two-sided
#Ước lượng
gau <- BiCopEst(u,v,family = 1, method = "mle", se = T, max.df = 10)
stu <- BiCopEst(u,v,family = 2, method = "mle", se = T, max.df = 10)
#Trình bày kết quả
est <- data.frame(mqh = c('VNI-STI' ,'VNI-STI'),
Copula = c('Gauss', 'Student'),
Thamso = c(gau$par, stu$par),
Thamso2 = c(gau$par2, stu$par2),
duoi = c(gau$taildep$lower,stu$taildep$lower))
kable(est,
caption = "Bảng : Kết quả ước lượng Copula họ Elip", col.names = c("Chỉ số","Copula", "Par","Par2", "Phụ thuộc đuôi"),
format = 'pandoc') %>% kable_styling(
bootstrap_options = c("striped", "hover", "condensed"),
full_width = F)
## Warning in kable_styling(., bootstrap_options = c("striped", "hover",
## "condensed"), : Please specify format in kable. kableExtra can customize either
## HTML or LaTeX outputs. See https://haozhu233.github.io/kableExtra/ for details.
Bảng : Kết quả ước lượng Copula họ Elip
| VNI-STI |
Gauss |
0.3162881 |
0 |
0.000000 |
| VNI-STI |
Student |
0.3103801 |
10 |
0.034858 |
### ƯỚC LƯỢNG THAM SỐ MÔ HÌNH COPULA
#Ước lượng
gau <- BiCopEst(u,v,family = 1, method = "mle", se = T, max.df = 10)
stu <- BiCopEst(u,v,family = 2, method = "mle", se = T, max.df = 10)
#Trình bày kết quả
est <- data.frame(mqh = c('VNI-HSI' ,'VNI-HSI'),
Copula = c('Gauss', 'Student'),
Thamso = c(gau$par, stu$par),
Thamso2 = c(gau$par2, stu$par2),
duoi = c(gau$taildep$lower,stu$taildep$lower))
kable(est,
caption = "Bảng : Kết quả ước lượng Copula họ Elip", col.names = c("Chỉ số","Copula", "Par","Par2", "Phụ thuộc đuôi"),
format = 'pandoc') %>% kable_styling(
bootstrap_options = c("striped", "hover", "condensed"),
full_width = F)
## Warning in kable_styling(., bootstrap_options = c("striped", "hover",
## "condensed"), : Please specify format in kable. kableExtra can customize either
## HTML or LaTeX outputs. See https://haozhu233.github.io/kableExtra/ for details.
Bảng : Kết quả ước lượng Copula họ Elip
| VNI-HSI |
Gauss |
0.3162881 |
0 |
0.000000 |
| VNI-HSI |
Student |
0.3103801 |
10 |
0.034858 |
set.seed(123)
#Mô phỏng copula gauss
cop_nor <- normalCopula(param = gau$par, dim = 2)
#Mô phỏng copula student
cop_std <- tCopula(param = stu$par, dim = 2, df = 1)
# Cài đặt các gói
install.packages("copula")
## Warning: package 'copula' is in use and will not be installed
install.packages("gridExtra")
## Warning: package 'gridExtra' is in use and will not be installed
install.packages("ggplot2") # Nếu bạn cần dùng ggplot2
## Warning: package 'ggplot2' is in use and will not be installed
#Lựa chọn và ước lượng
opt_cop <- BiCopSelect(u,v,selectioncrit = "AIC",method = "mle")
est_opt_cop <- BiCopEst(u,v,family = opt_cop$family,method = "mle",max.df = 30)
#Trình bày kết quả
est_opt_cop_dt <- data.frame(mqh = c('VNI-STI'),
Copula = est_opt_cop$familyname,
Thamso = est_opt_cop$par,
Thamso2 = est_opt_cop$par2,
duoiduoi = est_opt_cop$taildep$lower,
duoitren = est_opt_cop$taildep$upper,
tau = est_opt_cop$tau,
aic = est_opt_cop$AIC,
bic = est_opt_cop$BIC)
kable(est_opt_cop_dt,
caption = "Bảng : Kết quả ước lượng mô hình Copula tối ưu", col.names = c("Chỉ số","Copula", "Par","Par2", "Đuôi dưới", "Đuôi trên","Hệ số Kendall", "AIC","BIC"),
format = 'pandoc') %>% kable_styling(
bootstrap_options = c("striped", "hover", "condensed"),
full_width = F)
## Warning in kable_styling(., bootstrap_options = c("striped", "hover",
## "condensed"), : Please specify format in kable. kableExtra can customize either
## HTML or LaTeX outputs. See https://haozhu233.github.io/kableExtra/ for details.
Bảng : Kết quả ước lượng mô hình Copula tối ưu
| VNI-STI |
BB1 |
0.3155665 |
1.065065 |
0.1271572 |
0.082921 |
0.1890453 |
-153.8964 |
-143.353 |
dlt <- merge.xts(vni_1,hsi_1,join = 'inner')
truoccov<- dlt["2018-01-03/2019-12-31"]
cov<- dlt["2020-01-02/2021-12-31"]
saucov<- dlt["2022-01-04/2023-12-29"]
#GIAI ĐOẠN TRƯỚC COVID (1/2018-12/2019) HSI-VNI
### MÔ HÌNH ARMA
autoarfima(truoccov[,1], ar.max = 2, ma.max = 2, criterion = "AIC", method = "full")$fit
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
##
## *----------------------------------*
## * ARFIMA Model Fit *
## *----------------------------------*
## Mean Model : ARFIMA(2,0,0)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 1.000002 0.000618 1618.6545 0.000000
## ar1 0.000000 NA NA NA
## ar2 0.167398 0.045149 3.7076 0.000209
## sigma 0.011244 0.000364 30.8869 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 1.000002 0.000617 1621.0860 0.000000
## ar1 0.000000 NA NA NA
## ar2 0.167398 0.063043 2.6553 0.007924
## sigma 0.011244 0.000634 17.7230 0.000000
##
## LogLikelihood : 1463.888
##
## Information Criteria
## ------------------------------------
##
## Akaike -6.1253
## Bayes -6.0991
## Shibata -6.1254
## Hannan-Quinn -6.1150
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.5892 0.4427
## Lag[2*(p+q)+(p+q)-1][5] 2.9891 0.4788
## Lag[4*(p+q)+(p+q)-1][9] 6.0143 0.2542
##
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 19.61 9.499e-06
## Lag[2*(p+q)+(p+q)-1][2] 25.06 2.089e-07
## Lag[4*(p+q)+(p+q)-1][5] 38.45 1.274e-10
##
##
## ARCH LM Tests
## ------------------------------------
## Statistic DoF P-Value
## ARCH Lag[2] 25.39 2 3.066e-06
## ARCH Lag[5] 34.11 5 2.263e-06
## ARCH Lag[10] 47.82 10 6.692e-07
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 4.7909
## Individual Statistics:
## mu 0.04106
## ar2 0.11156
## sigma 4.15810
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 0.846 1.01 1.35
## Individual Statistic: 0.35 0.47 0.75
##
##
## Elapsed time : 0.0363009
autoarfima(truoccov[,2], ar.max = 2, ma.max = 2, criterion = "AIC", method = "full")$fit
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
##
## *----------------------------------*
## * ARFIMA Model Fit *
## *----------------------------------*
## Mean Model : ARFIMA(2,0,2)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999899 0.000561 1781.5271 0.000000
## ar1 0.661380 0.206706 3.1996 0.001376
## ar2 -0.712922 0.118353 -6.0237 0.000000
## ma1 -0.667408 0.176407 -3.7833 0.000155
## ma2 0.800904 0.098478 8.1328 0.000000
## sigma 0.011374 0.000368 30.8868 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999899 0.000522 1914.0410 0.000000
## ar1 0.661380 0.260756 2.5364 0.011200
## ar2 -0.712922 0.081164 -8.7837 0.000000
## ma1 -0.667408 0.226070 -2.9522 0.003155
## ma2 0.800904 0.069083 11.5934 0.000000
## sigma 0.011374 0.000588 19.3500 0.000000
##
## LogLikelihood : 1458.414
##
## Information Criteria
## ------------------------------------
##
## Akaike -6.0898
## Bayes -6.0374
## Shibata -6.0901
## Hannan-Quinn -6.0692
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.02456 0.8755
## Lag[2*(p+q)+(p+q)-1][11] 5.97583 0.5026
## Lag[4*(p+q)+(p+q)-1][19] 9.32633 0.5828
##
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1196 0.7295
## Lag[2*(p+q)+(p+q)-1][2] 0.6167 0.6413
## Lag[4*(p+q)+(p+q)-1][5] 3.1821 0.3748
##
##
## ARCH LM Tests
## ------------------------------------
## Statistic DoF P-Value
## ARCH Lag[2] 1.107 2 5.749e-01
## ARCH Lag[5] 5.883 5 3.177e-01
## ARCH Lag[10] 36.460 10 7.014e-05
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 1.3309
## Individual Statistics:
## mu 0.06487
## ar1 0.19451
## ar2 0.06455
## ma1 0.14533
## ma2 0.08122
## sigma 0.65715
##
## 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.05434299
# ƯỚC LƯỢNG CÁC DẠNG MÔ HÌNH GJR-GARCH GIAI ĐOẠN TRƯỚC COVID (1/2018-12/2019)
## Các dạng MH GJR-GARCH cho chuỗi lợi suất VNI
### GJR-GARCH(11)VNI
trvni.garch11n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "norm")
trvni.garch11n.fit <- ugarchfit(spec = trvni.garch11n.spec, data= truoccov[,1])
trvni.garch11t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "std")
trvni.garch11t.fit <- ugarchfit(spec = trvni.garch11t.spec, data= truoccov[,1])
trvni.garch11st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "sstd")
trvni.garch11st.fit <- ugarchfit(spec = trvni.garch11st.spec, data= truoccov[,1])
trvni.garch11g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "ged")
trvni.garch11g.fit <- ugarchfit(spec = trvni.garch11g.spec, data= truoccov[,1])
trvni.garch11sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "sged")
trvni.garch11sg.fit <- ugarchfit(spec = trvni.garch11sg.spec, data= truoccov[,1])
## GJR-GARCH(12)VNI
trvni.garch12n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "norm")
trvni.garch12n.fit <- ugarchfit(spec = trvni.garch12n.spec, data= truoccov[,1])
trvni.garch12t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "std")
trvni.garch12t.fit <- ugarchfit(spec = trvni.garch12t.spec, data= truoccov[,1])
trvni.garch12st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "sstd")
trvni.garch12st.fit <- ugarchfit(spec = trvni.garch12st.spec, data= truoccov[,1])
trvni.garch12g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "ged")
trvni.garch12g.fit <- ugarchfit(spec = trvni.garch12g.spec, data= truoccov[,1])
trvni.garch12sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "sged")
trvni.garch12sg.fit <- ugarchfit(spec = trvni.garch12sg.spec, data= truoccov[,1])
## GJR-GARCH(21)VNI
trvni.garch21n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "norm")
trvni.garch21n.fit <- ugarchfit(spec = trvni.garch21n.spec, data= truoccov[,1])
trvni.garch21t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "std")
trvni.garch21t.fit <- ugarchfit(spec = trvni.garch21t.spec, data= truoccov[,1])
trvni.garch21st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "sstd")
trvni.garch21st.fit <- ugarchfit(spec = trvni.garch21st.spec, data= truoccov[,1])
trvni.garch21g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "ged")
trvni.garch21g.fit <- ugarchfit(spec = trvni.garch21g.spec, data= truoccov[,1])
trvni.garch21sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "sged")
trvni.garch21sg.fit <- ugarchfit(spec = trvni.garch21sg.spec, data= truoccov[,1])
## GJR-GARCH(22)VNI
trvni.garch22n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "norm")
trvni.garch22n.fit <- ugarchfit(spec = trvni.garch22n.spec, data= truoccov[,1])
trvni.garch22t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "std")
trvni.garch22t.fit <- ugarchfit(spec = trvni.garch22t.spec, data= truoccov[,1])
trvni.garch22st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "sstd")
trvni.garch22st.fit <- ugarchfit(spec = trvni.garch22st.spec, data= truoccov[,1])
trvni.garch22g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "ged")
trvni.garch22g.fit <- ugarchfit(spec = trvni.garch22g.spec, data= truoccov[,1])
trvni.garch22sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(2, 0), include.mean = TRUE), distribution.model = "sged")
trvni.garch22sg.fit <- ugarchfit(spec = trvni.garch22sg.spec, data= truoccov[,1])
### GJR-GARCH(11)HSI
trhsi.garch11n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
trhsi.garch11n.fit <- ugarchfit(spec = trhsi.garch11n.spec, data = truoccov[,2])
trhsi.garch11t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
trhsi.garch11t.fit <- ugarchfit(spec = trhsi.garch11t.spec, data = truoccov[,2])
trhsi.garch11st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
trhsi.garch11st.fit <- ugarchfit(spec = trhsi.garch11st.spec, data = truoccov[,2])
trhsi.garch11g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
trhsi.garch11g.fit <- ugarchfit(spec = trhsi.garch11g.spec, data = truoccov[,2])
trhsi.garch11sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
trhsi.garch11sg.fit <- ugarchfit(spec = trhsi.garch11sg.spec, data = truoccov[,2])
## GJR-GARCH(12)HSI
trhsi.garch12n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
trhsi.garch12n.fit <- ugarchfit(spec = trhsi.garch12n.spec, data = truoccov[,2])
trhsi.garch12t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
trhsi.garch12t.fit <- ugarchfit(spec = trhsi.garch12t.spec, data = truoccov[,2])
trhsi.garch12st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
trhsi.garch12st.fit <- ugarchfit(spec = trhsi.garch12st.spec, data = truoccov[,2])
trhsi.garch12g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
trhsi.garch12g.fit <- ugarchfit(spec = trhsi.garch12g.spec, data = truoccov[,2])
trhsi.garch12sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
trhsi.garch12sg.fit <- ugarchfit(spec = trhsi.garch12sg.spec, data = truoccov[,2])
## GJR-GARCH(21)HSI
trhsi.garch21n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
trhsi.garch21n.fit <- ugarchfit(spec = trhsi.garch21n.spec, data = truoccov[,2])
trhsi.garch21t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
trhsi.garch21t.fit <- ugarchfit(spec = trhsi.garch21t.spec, data = truoccov[,2])
trhsi.garch21st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
trhsi.garch21st.fit <- ugarchfit(spec = trhsi.garch21st.spec, data = truoccov[,2])
trhsi.garch21g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
trhsi.garch21g.fit <- ugarchfit(spec = trhsi.garch21g.spec, data = truoccov[,2])
trhsi.garch21sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
trhsi.garch21sg.fit <- ugarchfit(spec = trhsi.garch21sg.spec, data = truoccov[,2])
## GJR-GARCH(22)HSI
trhsi.garch22n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
trhsi.garch22n.fit <- ugarchfit(spec = trhsi.garch22n.spec, data = truoccov[,2])
trhsi.garch22t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
trhsi.garch22t.fit <- ugarchfit(spec = trhsi.garch22t.spec, data = truoccov[,2])
trhsi.garch22st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
trhsi.garch22st.fit <- ugarchfit(spec = trhsi.garch22st.spec, data = truoccov[,2])
trhsi.garch22g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
trhsi.garch22g.fit <- ugarchfit(spec = trhsi.garch22g.spec, data = truoccov[,2])
trhsi.garch22sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
trhsi.garch22sg.fit <- ugarchfit(spec = trhsi.garch22sg.spec, data = truoccov[,2])
### LỰA CHỌN MO HINH GJR-GARCH ###
# Lựa chọn mô hình biên phù hợp nhất cho chuỗi VNI
trvni.model.list <- list(trgarch11n = trvni.garch11n.fit, trgarch11t = trvni.garch11t.fit, trgarch11st = trvni.garch11st.fit,
trgarch11g = trvni.garch11g.fit, trgarch11sg = trvni.garch11sg.fit,
trgarch12n = trvni.garch12n.fit, trgarch12t = trvni.garch12t.fit, trgarch12st = trvni.garch12st.fit, trgarch12g =
trvni.garch12g.fit, trgarch12sg = trvni.garch12sg.fit,
trgarch21n = trvni.garch21n.fit, trgarch21t = trvni.garch21t.fit, trgarch21st = trvni.garch21st.fit, trgarch21g =
trvni.garch21g.fit, trgarch21sg = trvni.garch21sg.fit,
trgarch22n = trvni.garch22n.fit, trgarch22t = trvni.garch22t.fit, trgarch22st = trvni.garch22st.fit, garch22g =
trvni.garch22g.fit,trgarch22sg = trvni.garch22sg.fit)
trvni.info.mat <- sapply(trvni.model.list, infocriteria)
rownames(trvni.info.mat) <- rownames(infocriteria(trvni.garch11n.fit))
trvni.info.mat
## trgarch11n trgarch11t trgarch11st trgarch11g trgarch11sg
## Akaike -6.368443 -6.492191 -6.496602 -6.476078 -6.480277
## Bayes -6.307285 -6.422295 -6.417970 -6.406182 -6.401645
## Shibata -6.368866 -6.492741 -6.497297 -6.476628 -6.480972
## Hannan-Quinn -6.344397 -6.464709 -6.465685 -6.448596 -6.449360
## trgarch12n trgarch12t trgarch12st trgarch12g trgarch12sg
## Akaike -6.366118 -6.488618 -6.492847 -6.472125 -6.476341
## Bayes -6.296222 -6.409986 -6.405478 -6.393493 -6.388971
## Shibata -6.366668 -6.489313 -6.493703 -6.472820 -6.477196
## Hannan-Quinn -6.338636 -6.457701 -6.458495 -6.441209 -6.441989
## trgarch21n trgarch21t trgarch21st trgarch21g trgarch21sg
## Akaike -6.382657 -6.487097 -6.490391 -6.470801 -6.474420
## Bayes -6.304025 -6.399728 -6.394285 -6.383431 -6.378314
## Shibata -6.383352 -6.487952 -6.491423 -6.471656 -6.475452
## Hannan-Quinn -6.351740 -6.452745 -6.452604 -6.436448 -6.436633
## trgarch22n trgarch22t trgarch22st garch22g trgarch22sg
## Akaike -6.378389 -6.482904 -6.486199 -6.466608 -6.470227
## Bayes -6.291020 -6.386798 -6.381355 -6.370501 -6.365384
## Shibata -6.379244 -6.483936 -6.487423 -6.467640 -6.471452
## Hannan-Quinn -6.344037 -6.445117 -6.444976 -6.428820 -6.429004
trvni.inds <- which(trvni.info.mat == min(trvni.info.mat), arr.ind=TRUE)
trmodel.vni <- colnames(trvni.info.mat)[vni.inds[,2]]
trmodel.vni
## [1] "trgarch21st"
safe_infocriteria <- function(model) {
tryCatch(
infocriteria(model),
error = function(e) return(rep(NA, 4))
)
}
# Lựa chọn mô hình biên phù hợp nhất cho chuỗi HSI
trhsi.model.list <- list(trgarch11n = trhsi.garch11n.fit, trgarch11t = trhsi.garch11t.fit, trgarch11st = trhsi.garch11st.fit,
trgarch11g = trhsi.garch11g.fit, trgarch11sg = trhsi.garch11sg.fit,
trgarch12n = trhsi.garch12n.fit, trgarch12t = trhsi.garch12t.fit, trgarch12st = trhsi.garch12st.fit, trgarch12g =
trhsi.garch12g.fit, trgarch12sg = trhsi.garch12sg.fit,
trgarch21n = trhsi.garch21n.fit, trgarch21t = trhsi.garch21t.fit, trgarch21st = trhsi.garch21st.fit, trgarch21g =
trhsi.garch21g.fit, trgarch21sg = trhsi.garch21sg.fit,
trgarch22n = trhsi.garch22n.fit, trgarch22t = trhsi.garch22t.fit, trgarch22st = trhsi.garch22st.fit, garch22g =
trhsi.garch22g.fit,trgarch22sg = trhsi.garch22sg.fit)
trhsi.info.mat <- sapply(trhsi.model.list, safe_infocriteria)
rownames(trhsi.info.mat) <- rownames(infocriteria(trhsi.garch11n.fit))
trhsi.info.mat
## trgarch11n trgarch11t trgarch11st trgarch11g trgarch11sg
## Akaike -6.108104 -6.147865 -6.150361 -6.149651 -6.160407
## Bayes -6.029471 -6.060496 -6.054254 -6.062281 -6.064301
## Shibata -6.108798 -6.148720 -6.151393 -6.150506 -6.161439
## Hannan-Quinn -6.077187 -6.113513 -6.112573 -6.115299 -6.122620
## trgarch12n trgarch12t trgarch12st trgarch12g trgarch12sg
## Akaike -6.105392 -6.143672 -6.146161 -6.145459 -6.156218
## Bayes -6.018022 -6.047566 -6.041318 -6.049353 -6.051375
## Shibata -6.106247 -6.144704 -6.147386 -6.146491 -6.157443
## Hannan-Quinn -6.071040 -6.105885 -6.104939 -6.107672 -6.114996
## trgarch21n trgarch21t trgarch21st trgarch21g trgarch21sg
## Akaike -6.102182 -6.143552 -6.145904 -6.144787 -6.154951
## Bayes -6.006076 -6.038709 -6.032323 -6.039944 -6.041371
## Shibata -6.103214 -6.144777 -6.147337 -6.146012 -6.156385
## Hannan-Quinn -6.064395 -6.102330 -6.101246 -6.103565 -6.110293
## trgarch22n trgarch22t trgarch22st garch22g trgarch22sg
## Akaike -6.097040 -6.139359 -6.141708 -6.140595 -6.150759
## Bayes -5.992197 -6.025779 -6.019391 -6.027014 -6.028442
## Shibata -6.098265 -6.140792 -6.143366 -6.142028 -6.152418
## Hannan-Quinn -6.055817 -6.094701 -6.093615 -6.095937 -6.102666
trhsi.inds <- which(trhsi.info.mat == min(trhsi.info.mat), arr.ind=TRUE)
trmodel.hsi <- colnames(trhsi.info.mat)[hsi.inds[,2]]
trmodel.hsi
## [1] "trgarch21t"
### THAM SỐ ƯỚC LƯỢNG MÔ HÌNH BIÊN PHÙ HỢP NHẤT
trvni.garch21st.fit
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(2,1)
## Mean Model : ARFIMA(2,0,0)
## Distribution : sstd
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999865 0.000309 3240.747843 0.000000
## ar1 0.046461 0.044411 1.046160 0.295487
## ar2 0.128259 0.044209 2.901161 0.003718
## omega 0.000004 0.000002 1.933787 0.053139
## alpha1 0.000000 0.040995 0.000003 0.999998
## alpha2 0.009179 0.045554 0.201508 0.840302
## beta1 0.864973 0.023489 36.824991 0.000000
## gamma1 0.330073 0.146875 2.247306 0.024620
## gamma2 -0.142178 0.131469 -1.081454 0.279495
## skew 0.882944 0.053949 16.366327 0.000000
## shape 4.614702 0.825359 5.591147 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999865 0.000563 1776.415215 0.000000
## ar1 0.046461 0.056678 0.819742 0.412363
## ar2 0.128259 0.054098 2.370863 0.017747
## omega 0.000004 0.000004 0.977876 0.328136
## alpha1 0.000000 0.056494 0.000002 0.999999
## alpha2 0.009179 0.051346 0.178775 0.858114
## beta1 0.864973 0.032233 26.835325 0.000000
## gamma1 0.330073 0.104885 3.146995 0.001650
## gamma2 -0.142178 0.088456 -1.607339 0.107980
## skew 0.882944 0.058859 15.000888 0.000000
## shape 4.614702 0.964517 4.784471 0.000002
##
## LogLikelihood : 1558.958
##
## Information Criteria
## ------------------------------------
##
## Akaike -6.4904
## Bayes -6.3943
## Shibata -6.4914
## Hannan-Quinn -6.4526
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.04023 0.8410
## Lag[2*(p+q)+(p+q)-1][5] 1.57127 0.9965
## Lag[4*(p+q)+(p+q)-1][9] 3.82904 0.7304
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.8797 0.3483
## Lag[2*(p+q)+(p+q)-1][8] 1.9294 0.8696
## Lag[4*(p+q)+(p+q)-1][14] 3.7145 0.9058
## d.o.f=3
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[4] 0.01797 0.500 2.000 0.8934
## ARCH Lag[6] 0.22554 1.461 1.711 0.9630
## ARCH Lag[8] 0.50470 2.368 1.583 0.9815
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 3.3852
## Individual Statistics:
## mu 0.4321
## ar1 0.2032
## ar2 0.5268
## omega 0.3893
## alpha1 0.1419
## alpha2 0.2119
## beta1 0.2495
## gamma1 0.2761
## gamma2 0.1962
## skew 0.9131
## shape 0.1594
##
## 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.2841 0.7765
## Negative Sign Bias 1.3605 0.1743
## Positive Sign Bias 1.3305 0.1840
## Joint Effect 3.9376 0.2683
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 12.18 0.8777
## 2 30 21.68 0.8332
## 3 40 34.28 0.6849
## 4 50 37.36 0.8879
##
##
## Elapsed time : 1.819929
trhsi.garch21t.fit
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(2,1)
## Mean Model : ARFIMA(2,0,2)
## Distribution : std
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 1.000139 0.000340 2942.34683 0.000000
## ar1 0.586845 0.239660 2.44866 0.014339
## ar2 -0.691439 0.152573 -4.53186 0.000006
## ma1 -0.593502 0.209355 -2.83491 0.004584
## ma2 0.773563 0.137702 5.61768 0.000000
## omega 0.000005 0.000000 24.11445 0.000000
## alpha1 0.000000 0.074669 0.00000 1.000000
## alpha2 0.000000 0.068331 0.00000 1.000000
## beta1 0.928803 0.014591 63.65724 0.000000
## gamma1 -0.011398 0.080535 -0.14153 0.887449
## gamma2 0.077260 0.071410 1.08192 0.279289
## shape 6.065871 1.704709 3.55830 0.000373
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 1.000139 0.000316 3166.28079 0.000000
## ar1 0.586845 0.312331 1.87892 0.060255
## ar2 -0.691439 0.159520 -4.33450 0.000015
## ma1 -0.593502 0.269346 -2.20350 0.027560
## ma2 0.773563 0.150418 5.14275 0.000000
## omega 0.000005 0.000000 15.45543 0.000000
## alpha1 0.000000 0.086400 0.00000 1.000000
## alpha2 0.000000 0.076247 0.00000 1.000000
## beta1 0.928803 0.007713 120.42212 0.000000
## gamma1 -0.011398 0.090411 -0.12607 0.899674
## gamma2 0.077260 0.077043 1.00281 0.315951
## shape 6.065871 1.667905 3.63682 0.000276
##
## LogLikelihood : 1477.237
##
## Information Criteria
## ------------------------------------
##
## Akaike -6.1436
## Bayes -6.0387
## Shibata -6.1448
## Hannan-Quinn -6.1023
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.304 0.5814
## Lag[2*(p+q)+(p+q)-1][11] 5.377 0.8504
## Lag[4*(p+q)+(p+q)-1][19] 7.873 0.8116
## d.o.f=4
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.02161 0.88313
## Lag[2*(p+q)+(p+q)-1][8] 7.70455 0.10900
## Lag[4*(p+q)+(p+q)-1][14] 12.91054 0.06324
## d.o.f=3
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[4] 2.444 0.500 2.000 0.117991
## ARCH Lag[6] 10.433 1.461 1.711 0.006254
## ARCH Lag[8] 12.045 2.368 1.583 0.007790
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 6.1458
## Individual Statistics:
## mu 0.05403
## ar1 0.09340
## ar2 0.06915
## ma1 0.06762
## ma2 0.07499
## omega 0.77469
## alpha1 0.17339
## alpha2 0.16195
## beta1 0.26260
## gamma1 0.24439
## gamma2 0.23984
## shape 0.22244
##
## 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.15894 0.8738
## Negative Sign Bias 0.25264 0.8007
## Positive Sign Bias 0.04978 0.9603
## Joint Effect 0.06650 0.9955
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 25.26 0.1520
## 2 30 26.46 0.6009
## 3 40 35.79 0.6172
## 4 50 41.55 0.7660
##
##
## Elapsed time : 1.766853
## Trích xuất chuỗi phần dư u của chuỗi lợi suất HSI
trhsi.res <- residuals(trhsi.garch21t.fit)/sigma(trhsi.garch21t.fit)
fitdist(distribution = "std", hsi.res, control = list())$pars
## mu sigma shape
## 0.01276228 0.98573294 6.17652129
u_1 <- pdist(distribution = "std", q = hsi.res, mu =0.01276228 , sigma = 0.98573294, shape = 6.17652129)
## Trích xuat chuoi phan dư v của chuỗi lợi suất VNI
trvni.res <- residuals(trvni.garch21st.fit)/sigma(trvni.garch21st.fit)
fitdist(distribution = "sstd", hsi.res, control = list())$pars
## mu sigma skew shape
## 0.003601717 0.986662662 0.964525992 6.103028224
v_1 <- pdist(distribution = "sstd", q = hsi.res, mu =0.003601717 , sigma = 0.986662662,skew= 0.964525992, shape = 6.103028224)
### Các kiểm định sự phù hợp của mô hình biên:
# Kiem dinh Anderson-Darling
ad.test(u_1, "punif")
##
## Anderson-Darling test of goodness-of-fit
## Null hypothesis: uniform distribution
## Parameters assumed to be fixed
##
## data: u_1
## An = 0.62089, p-value = 0.6284
ad.test(v_1, "punif")
##
## Anderson-Darling test of goodness-of-fit
## Null hypothesis: uniform distribution
## Parameters assumed to be fixed
##
## data: v_1
## An = 0.48035, p-value = 0.7669
cvm.test(u_1, "punif")
##
## Cramer-von Mises test of goodness-of-fit
## Null hypothesis: uniform distribution
## Parameters assumed to be fixed
##
## data: u_1
## omega2 = 0.11699, p-value = 0.5079
cvm.test(v_1, "punif")
##
## Cramer-von Mises test of goodness-of-fit
## Null hypothesis: uniform distribution
## Parameters assumed to be fixed
##
## data: v_1
## omega2 = 0.087168, p-value = 0.6516
# Kiem dinh ks-test
##Null hypothesis: uniform distribution
ks.test(u_1, "punif")
##
## Asymptotic one-sample Kolmogorov-Smirnov test
##
## data: u_1
## D = 0.022039, p-value = 0.4868
## alternative hypothesis: two-sided
ks.test(v_1, "punif")
##
## Asymptotic one-sample Kolmogorov-Smirnov test
##
## data: v_1
## D = 0.019256, p-value = 0.6601
## alternative hypothesis: two-sided
#GIAI ĐOẠN TRong COVID (1/2020-12/2021) HSI-VNI
### MÔ HÌNH ARMA
autoarfima(cov[,1], ar.max = 2, ma.max = 2, criterion = "AIC", method = "full")$fit
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
##
## *----------------------------------*
## * ARFIMA Model Fit *
## *----------------------------------*
## Mean Model : ARFIMA(2,0,2)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 1.001025 0.000678 1476.8617 0.000000
## ar1 0.050148 0.027335 1.8345 0.066573
## ar2 -0.831923 0.062509 -13.3088 0.000000
## ma1 0.000000 NA NA NA
## ma2 0.907086 0.047701 19.0161 0.000000
## sigma 0.013935 0.000448 31.1127 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 1.001025 0.000677 1477.5943 0.000000
## ar1 0.050148 0.030415 1.6488 0.099191
## ar2 -0.831923 0.066218 -12.5635 0.000000
## ma1 0.000000 NA NA NA
## ma2 0.907086 0.045135 20.0970 0.000000
## sigma 0.013935 0.000787 17.7154 0.000000
##
## LogLikelihood : 1381.546
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.6882
## Bayes -5.6450
## Shibata -5.6884
## Hannan-Quinn -5.6712
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.5708 0.4500
## Lag[2*(p+q)+(p+q)-1][11] 6.1419 0.3948
## Lag[4*(p+q)+(p+q)-1][19] 11.2445 0.2808
##
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 16.66 4.482e-05
## Lag[2*(p+q)+(p+q)-1][2] 26.09 1.124e-07
## Lag[4*(p+q)+(p+q)-1][5] 43.43 4.853e-12
##
##
## ARCH LM Tests
## ------------------------------------
## Statistic DoF P-Value
## ARCH Lag[2] 29.64 2 3.660e-07
## ARCH Lag[5] 38.89 5 2.503e-07
## ARCH Lag[10] 70.56 10 3.457e-11
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 1.2967
## Individual Statistics:
## mu 0.2150
## ar1 0.1797
## ar2 0.1712
## ma2 0.1336
## sigma 0.7696
##
## 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.056566
autoarfima(cov[,2], ar.max = 2, ma.max = 2, criterion = "AIC", method = "full")$fit
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
##
## *----------------------------------*
## * ARFIMA Model Fit *
## *----------------------------------*
## Mean Model : ARFIMA(1,0,0)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999712 0.000595 1680.1532 0.000000
## ar1 -0.080461 0.045345 -1.7744 0.075992
## sigma 0.014141 0.000455 31.1127 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999712 0.000582 1718.4542 0.00000
## ar1 -0.080461 0.051358 -1.5667 0.11719
## sigma 0.014141 0.000979 14.4387 0.00000
##
## LogLikelihood : 1374.421
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.6670
## Bayes -5.6411
## Shibata -5.6671
## Hannan-Quinn -5.6568
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.005146 0.9428
## Lag[2*(p+q)+(p+q)-1][2] 0.343665 0.9904
## Lag[4*(p+q)+(p+q)-1][5] 1.037559 0.9411
##
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 8.153 4.298e-03
## Lag[2*(p+q)+(p+q)-1][2] 21.623 1.669e-06
## Lag[4*(p+q)+(p+q)-1][5] 36.458 4.706e-10
##
##
## ARCH LM Tests
## ------------------------------------
## Statistic DoF P-Value
## ARCH Lag[2] 31.43 2 1.496e-07
## ARCH Lag[5] 36.98 5 6.055e-07
## ARCH Lag[10] 38.66 10 2.907e-05
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 1.4272
## Individual Statistics:
## mu 0.1194
## ar1 0.1210
## sigma 1.1760
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 0.846 1.01 1.35
## Individual Statistic: 0.35 0.47 0.75
##
##
## Elapsed time : 0.02133894
### GJR-GARCH(11)VNI
invni.garch11n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
invni.garch11n.fit <- ugarchfit(spec = invni.garch11n.spec, data= cov[,1])
invni.garch11t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
invni.garch11t.fit <- ugarchfit(spec = invni.garch11t.spec, data= cov[,1])
invni.garch11st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
invni.garch11st.fit <- ugarchfit(spec = invni.garch11st.spec, data= cov[,1])
invni.garch11g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
invni.garch11g.fit <- ugarchfit(spec = invni.garch11g.spec, data= cov[,1])
invni.garch11sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
invni.garch11sg.fit <- ugarchfit(spec = invni.garch11sg.spec, data= cov[,1])
## GJR-GARCH(12)VNI
invni.garch12n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
invni.garch12n.fit <- ugarchfit(spec = invni.garch12n.spec, data= cov[,1])
invni.garch12t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
invni.garch12t.fit <- ugarchfit(spec = invni.garch12t.spec, data= cov[,1])
invni.garch12st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
invni.garch12st.fit <- ugarchfit(spec = invni.garch12st.spec, data= cov[,1])
invni.garch12g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
invni.garch12g.fit <- ugarchfit(spec = invni.garch12g.spec, data= cov[,1])
invni.garch12sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
invni.garch12sg.fit <- ugarchfit(spec = invni.garch12sg.spec, data= cov[,1])
## GJR-GARCH(21)VNI
invni.garch21n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
invni.garch21n.fit <- ugarchfit(spec = invni.garch21n.spec, data= cov[,1])
invni.garch21t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
invni.garch21t.fit <- ugarchfit(spec = invni.garch21t.spec, data= cov[,1])
invni.garch21st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
invni.garch21st.fit <- ugarchfit(spec = invni.garch21st.spec, data= cov[,1])
invni.garch21g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
invni.garch21g.fit <- ugarchfit(spec = invni.garch21g.spec, data= cov[,1])
invni.garch21sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
invni.garch21sg.fit <- ugarchfit(spec = invni.garch21sg.spec, data= cov[,1])
## GJR-GARCH(22)VNI
invni.garch22n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
invni.garch22n.fit <- ugarchfit(spec = invni.garch22n.spec, data= cov[,1])
invni.garch22t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
invni.garch22t.fit <- ugarchfit(spec = invni.garch22t.spec, data= cov[,1])
invni.garch22st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
invni.garch22st.fit <- ugarchfit(spec = invni.garch22st.spec, data= cov[,1])
invni.garch22g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
invni.garch22g.fit <- ugarchfit(spec = invni.garch22g.spec, data= cov[,1])
invni.garch22sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
invni.garch22sg.fit <- ugarchfit(spec = invni.garch22sg.spec, data= cov[,1])
### GJR-GARCH(11)HSI
inhsi.garch11n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "norm")
inhsi.garch11n.fit <- ugarchfit(spec = inhsi.garch11n.spec, data = cov[,2])
inhsi.garch11t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "std")
inhsi.garch11t.fit <- ugarchfit(spec = inhsi.garch11t.spec, data = cov[,2])
inhsi.garch11st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sstd")
inhsi.garch11st.fit <- ugarchfit(spec = inhsi.garch11st.spec, data = cov[,2])
inhsi.garch11g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "ged")
inhsi.garch11g.fit <- ugarchfit(spec = inhsi.garch11g.spec, data = cov[,2])
inhsi.garch11sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sged")
inhsi.garch11sg.fit <- ugarchfit(spec = inhsi.garch11sg.spec, data = cov[,2])
## GJR-GARCH(12)HSI
inhsi.garch12n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "norm")
inhsi.garch12n.fit <- ugarchfit(spec = inhsi.garch12n.spec, data = cov[,2])
inhsi.garch12t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "std")
inhsi.garch12t.fit <- ugarchfit(spec = inhsi.garch12t.spec, data = cov[,2])
inhsi.garch12st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sstd")
inhsi.garch12st.fit <- ugarchfit(spec = inhsi.garch12st.spec, data = cov[,2])
inhsi.garch12g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "ged")
inhsi.garch12g.fit <- ugarchfit(spec = inhsi.garch12g.spec, data = cov[,2])
inhsi.garch12sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sged")
inhsi.garch12sg.fit <- ugarchfit(spec = inhsi.garch12sg.spec, data = cov[,2])
## GJR-GARCH(21)HSI
inhsi.garch21n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "norm")
inhsi.garch21n.fit <- ugarchfit(spec = inhsi.garch21n.spec, data = cov[,2])
inhsi.garch21t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "std")
inhsi.garch21t.fit <- ugarchfit(spec = inhsi.garch21t.spec, data = cov[,2])
inhsi.garch21st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sstd")
inhsi.garch21st.fit <- ugarchfit(spec = inhsi.garch21st.spec, data = cov[,2])
inhsi.garch21g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "ged")
inhsi.garch21g.fit <- ugarchfit(spec = inhsi.garch21g.spec, data = cov[,2])
inhsi.garch21sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sged")
inhsi.garch21sg.fit <- ugarchfit(spec = inhsi.garch21sg.spec, data = cov[,2])
## GJR-GARCH(22)HSI
inhsi.garch22n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "norm")
inhsi.garch22n.fit <- ugarchfit(spec = inhsi.garch22n.spec, data = cov[,2])
inhsi.garch22t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "std")
inhsi.garch22t.fit <- ugarchfit(spec = inhsi.garch22t.spec, data = cov[,2])
inhsi.garch22st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sstd")
inhsi.garch22st.fit <- ugarchfit(spec = inhsi.garch22st.spec, data = cov[,2])
inhsi.garch22g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "ged")
inhsi.garch22g.fit <- ugarchfit(spec = inhsi.garch22g.spec, data = cov[,2])
inhsi.garch22sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sged")
inhsi.garch22sg.fit <- ugarchfit(spec = inhsi.garch22sg.spec, data = cov[,2])
### LỰA CHỌN MO HINH GJR-GARCH ###
safe_infocriteria <- function(model) {
tryCatch(
infocriteria(model),
error = function(e) return(rep(NA, length(infocriteria(model))))
)
}
D
## function (expr, name)
## .External(C_doD, expr, name)
## <bytecode: 0x000001b12ff1f110>
## <environment: namespace:stats>
# Lựa chọn mô hình biên phù hợp nhất cho chuỗi VNI
invni.model.list <- list(ingarch11n = invni.garch11n.fit, ingarch11t = invni.garch11t.fit, ingarch11st = invni.garch11st.fit,
ingarch11g = invni.garch11g.fit, ingarch11sg = invni.garch11sg.fit,
ingarch12n = invni.garch12n.fit, ingarch12t = invni.garch12t.fit, ingarch12st = invni.garch12st.fit, ingarch12g =
invni.garch12g.fit, ingarch12sg = invni.garch12sg.fit,
ingarch21n = invni.garch21n.fit, ingarch21t = invni.garch21t.fit, ingarch21st = invni.garch21st.fit, ingarch21g =
invni.garch21g.fit, ingarch21sg = invni.garch21sg.fit,
ingarch22n = invni.garch22n.fit, ingarch22t = invni.garch22t.fit, ingarch22st = invni.garch22st.fit, garch22g =
invni.garch22g.fit)
results15 <- lapply(invni.model.list, function(model) {
tryCatch({
print(infocriteria(model))
}, error = function(e) {
message("Lỗi khi xử lý mô hình: ", e$message)
return(NULL) # Hoặc giá trị mặc định khác
})
})
##
## Akaike -5.903485
## Bayes -5.825719
## Shibata -5.904160
## Hannan-Quinn -5.872928
##
## Akaike -6.094813
## Bayes -6.008406
## Shibata -6.095644
## Hannan-Quinn -6.060860
##
## Akaike -6.121714
## Bayes -6.026667
## Shibata -6.122717
## Hannan-Quinn -6.084366
##
## Akaike -6.086006
## Bayes -5.999600
## Shibata -6.086837
## Hannan-Quinn -6.052054
##
## Akaike -6.088703
## Bayes -5.993656
## Shibata -6.089706
## Hannan-Quinn -6.051355
##
## Akaike -5.897454
## Bayes -5.811047
## Shibata -5.898285
## Hannan-Quinn -5.863501
##
## Akaike -6.090710
## Bayes -5.995662
## Shibata -6.091712
## Hannan-Quinn -6.053362
##
## Akaike -6.117582
## Bayes -6.013894
## Shibata -6.118772
## Hannan-Quinn -6.076839
##
## Akaike -6.073448
## Bayes -5.978400
## Shibata -6.074451
## Hannan-Quinn -6.036100
##
## Akaike -6.092347
## Bayes -5.988659
## Shibata -6.093537
## Hannan-Quinn -6.051603
##
## Akaike -5.906171
## Bayes -5.811124
## Shibata -5.907174
## Hannan-Quinn -5.868823
##
## Akaike -6.086986
## Bayes -5.983298
## Shibata -6.088177
## Hannan-Quinn -6.046243
##
## Akaike -6.113475
## Bayes -6.001147
## Shibata -6.114868
## Hannan-Quinn -6.069337
##
## Akaike -6.067135
## Bayes -5.963447
## Shibata -6.068325
## Hannan-Quinn -6.026391
##
## Akaike -6.089425
## Bayes -5.977096
## Shibata -6.090818
## Hannan-Quinn -6.045287
##
## Akaike -5.902039
## Bayes -5.798351
## Shibata -5.903229
## Hannan-Quinn -5.861296
##
## Akaike -6.082854
## Bayes -5.970525
## Shibata -6.084247
## Hannan-Quinn -6.038716
##
## Akaike -6.109343
## Bayes -5.988374
## Shibata -6.110955
## Hannan-Quinn -6.061809
##
## Akaike -6.057806
## Bayes -5.945478
## Shibata -6.059199
## Hannan-Quinn -6.013668
print(results15)
## $ingarch11n
##
## Akaike -5.903485
## Bayes -5.825719
## Shibata -5.904160
## Hannan-Quinn -5.872928
##
## $ingarch11t
##
## Akaike -6.094813
## Bayes -6.008406
## Shibata -6.095644
## Hannan-Quinn -6.060860
##
## $ingarch11st
##
## Akaike -6.121714
## Bayes -6.026667
## Shibata -6.122717
## Hannan-Quinn -6.084366
##
## $ingarch11g
##
## Akaike -6.086006
## Bayes -5.999600
## Shibata -6.086837
## Hannan-Quinn -6.052054
##
## $ingarch11sg
##
## Akaike -6.088703
## Bayes -5.993656
## Shibata -6.089706
## Hannan-Quinn -6.051355
##
## $ingarch12n
##
## Akaike -5.897454
## Bayes -5.811047
## Shibata -5.898285
## Hannan-Quinn -5.863501
##
## $ingarch12t
##
## Akaike -6.090710
## Bayes -5.995662
## Shibata -6.091712
## Hannan-Quinn -6.053362
##
## $ingarch12st
##
## Akaike -6.117582
## Bayes -6.013894
## Shibata -6.118772
## Hannan-Quinn -6.076839
##
## $ingarch12g
##
## Akaike -6.073448
## Bayes -5.978400
## Shibata -6.074451
## Hannan-Quinn -6.036100
##
## $ingarch12sg
##
## Akaike -6.092347
## Bayes -5.988659
## Shibata -6.093537
## Hannan-Quinn -6.051603
##
## $ingarch21n
##
## Akaike -5.906171
## Bayes -5.811124
## Shibata -5.907174
## Hannan-Quinn -5.868823
##
## $ingarch21t
##
## Akaike -6.086986
## Bayes -5.983298
## Shibata -6.088177
## Hannan-Quinn -6.046243
##
## $ingarch21st
##
## Akaike -6.113475
## Bayes -6.001147
## Shibata -6.114868
## Hannan-Quinn -6.069337
##
## $ingarch21g
##
## Akaike -6.067135
## Bayes -5.963447
## Shibata -6.068325
## Hannan-Quinn -6.026391
##
## $ingarch21sg
##
## Akaike -6.089425
## Bayes -5.977096
## Shibata -6.090818
## Hannan-Quinn -6.045287
##
## $ingarch22n
##
## Akaike -5.902039
## Bayes -5.798351
## Shibata -5.903229
## Hannan-Quinn -5.861296
##
## $ingarch22t
##
## Akaike -6.082854
## Bayes -5.970525
## Shibata -6.084247
## Hannan-Quinn -6.038716
##
## $ingarch22st
##
## Akaike -6.109343
## Bayes -5.988374
## Shibata -6.110955
## Hannan-Quinn -6.061809
##
## $garch22g
##
## Akaike -6.057806
## Bayes -5.945478
## Shibata -6.059199
## Hannan-Quinn -6.013668
invni.info.mat <- sapply(invni.model.list, safe_infocriteria)
rownames(invni.info.mat) <- rownames(infocriteria(invni.garch11n.fit))
invni.info.mat
## ingarch11n ingarch11t ingarch11st ingarch11g ingarch11sg
## Akaike -5.903485 -6.094813 -6.121714 -6.086006 -6.088703
## Bayes -5.825719 -6.008406 -6.026667 -5.999600 -5.993656
## Shibata -5.904160 -6.095644 -6.122717 -6.086837 -6.089706
## Hannan-Quinn -5.872928 -6.060860 -6.084366 -6.052054 -6.051355
## ingarch12n ingarch12t ingarch12st ingarch12g ingarch12sg
## Akaike -5.897454 -6.090710 -6.117582 -6.073448 -6.092347
## Bayes -5.811047 -5.995662 -6.013894 -5.978400 -5.988659
## Shibata -5.898285 -6.091712 -6.118772 -6.074451 -6.093537
## Hannan-Quinn -5.863501 -6.053362 -6.076839 -6.036100 -6.051603
## ingarch21n ingarch21t ingarch21st ingarch21g ingarch21sg
## Akaike -5.906171 -6.086986 -6.113475 -6.067135 -6.089425
## Bayes -5.811124 -5.983298 -6.001147 -5.963447 -5.977096
## Shibata -5.907174 -6.088177 -6.114868 -6.068325 -6.090818
## Hannan-Quinn -5.868823 -6.046243 -6.069337 -6.026391 -6.045287
## ingarch22n ingarch22t ingarch22st garch22g
## Akaike -5.902039 -6.082854 -6.109343 -6.057806
## Bayes -5.798351 -5.970525 -5.988374 -5.945478
## Shibata -5.903229 -6.084247 -6.110955 -6.059199
## Hannan-Quinn -5.861296 -6.038716 -6.061809 -6.013668
invni.inds <- which(invni.info.mat == min(invni.info.mat), arr.ind=TRUE)
inmodel.vni <- colnames(invni.info.mat)[vni.inds[,2]]
inmodel.vni
## [1] "ingarch21st"
# Lựa chọn mô hình biên phù hợp nhất cho chuỗi HSI
inhsi.model.list <- list(ingarch11n = inhsi.garch11n.fit, ingarch11t = inhsi.garch11t.fit, ingarch11st = inhsi.garch11st.fit,
ingarch11g = inhsi.garch11g.fit, ingarch11sg = inhsi.garch11sg.fit,
ingarch12n = inhsi.garch12n.fit, ingarch12t = inhsi.garch12t.fit, ingarch12st = inhsi.garch12st.fit, ingarch12g =
inhsi.garch12g.fit, ingarch12sg = inhsi.garch12sg.fit,
ingarch21n = inhsi.garch21n.fit, ingarch21t = inhsi.garch21t.fit, ingarch21st = inhsi.garch21st.fit, ingarch21g =
inhsi.garch21g.fit, ingarch21sg = inhsi.garch21sg.fit,
ingarch22n = inhsi.garch22n.fit, ingarch22t = inhsi.garch22t.fit, ingarch22st = inhsi.garch22st.fit, garch22g =
inhsi.garch22g.fit)
inhsi.info.mat <- sapply(inhsi.model.list, safe_infocriteria)
rownames(inhsi.info.mat) <- rownames(infocriteria(inhsi.garch11n.fit))
inhsi.info.mat
## ingarch11n ingarch11t ingarch11st ingarch11g ingarch11sg
## Akaike -5.743235 -5.802439 -5.812774 -5.795510 -5.807602
## Bayes -5.691391 -5.741955 -5.743648 -5.735025 -5.738476
## Shibata -5.743538 -5.802850 -5.813308 -5.795920 -5.808137
## Hannan-Quinn -5.722864 -5.778672 -5.785611 -5.771743 -5.780440
## ingarch12n ingarch12t ingarch12st ingarch12g ingarch12sg
## Akaike -5.738821 -5.797984 -5.808338 -5.791123 -5.803205
## Bayes -5.678336 -5.728858 -5.730572 -5.721998 -5.725439
## Shibata -5.739231 -5.798518 -5.809013 -5.791658 -5.803880
## Hannan-Quinn -5.715054 -5.770822 -5.777781 -5.763961 -5.772647
## ingarch21n ingarch21t ingarch21st ingarch21g ingarch21sg
## Akaike -5.752003 -5.807050 -5.816160 -5.797045 -5.808379
## Bayes -5.682878 -5.729284 -5.729753 -5.719279 -5.721972
## Shibata -5.752538 -5.807725 -5.816991 -5.797720 -5.809210
## Hannan-Quinn -5.724841 -5.776493 -5.782207 -5.766488 -5.774426
## ingarch22n ingarch22t ingarch22st garch22g
## Akaike -5.748876 -5.803906 -5.812741 -5.794267
## Bayes -5.671110 -5.717499 -5.717693 -5.707860
## Shibata -5.749551 -5.804737 -5.813744 -5.795098
## Hannan-Quinn -5.718318 -5.769953 -5.775393 -5.760314
inhsi.inds <- which(inhsi.info.mat == min(inhsi.info.mat), arr.ind=TRUE)
inmodel.hsi <- colnames(inhsi.info.mat)[hsi.inds[,2]]
inmodel.hsi
## [1] "ingarch21t"
### THAM SỐ ƯỚC LƯỢNG MÔ HÌNH BIÊN PHÙ HỢP NHẤT
invni.garch21st.fit
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(2,1)
## Mean Model : ARFIMA(2,0,2)
## Distribution : sstd
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 1.001350 0.001105 9.0646e+02 0.000000
## ar1 0.017256 0.012689 1.3600e+00 0.173845
## ar2 -0.971985 0.000497 -1.9556e+03 0.000000
## ma1 -0.018050 0.006413 -2.8144e+00 0.004887
## ma2 0.997041 0.001267 7.8718e+02 0.000000
## omega 0.000032 0.000012 2.7425e+00 0.006097
## alpha1 0.145458 0.066089 2.2009e+00 0.027740
## alpha2 0.013848 0.044248 3.1297e-01 0.754305
## beta1 0.557980 0.112930 4.9409e+00 0.000001
## gamma1 0.302027 0.184628 1.6359e+00 0.101867
## gamma2 -0.001909 0.148896 -1.2822e-02 0.989769
## skew 0.755252 0.043300 1.7442e+01 0.000000
## shape 3.995807 0.716659 5.5756e+00 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 1.001350 0.003263 306.858807 0.000000
## ar1 0.017256 0.015083 1.144044 0.252606
## ar2 -0.971985 0.008968 -108.386419 0.000000
## ma1 -0.018050 0.008037 -2.245770 0.024719
## ma2 0.997041 0.001546 645.062413 0.000000
## omega 0.000032 0.000013 2.411830 0.015873
## alpha1 0.145458 0.306461 0.474637 0.635046
## alpha2 0.013848 0.373356 0.037091 0.970412
## beta1 0.557980 0.183132 3.046875 0.002312
## gamma1 0.302027 0.233594 1.292957 0.196026
## gamma2 -0.001909 0.352151 -0.005422 0.995674
## skew 0.755252 0.123622 6.109382 0.000000
## shape 3.995807 0.931512 4.289594 0.000018
##
## LogLikelihood : 1492.461
##
## Information Criteria
## ------------------------------------
##
## Akaike -6.1135
## Bayes -6.0011
## Shibata -6.1149
## Hannan-Quinn -6.0693
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 2.983 0.08414
## Lag[2*(p+q)+(p+q)-1][11] 4.324 0.99888
## Lag[4*(p+q)+(p+q)-1][19] 8.591 0.70572
## d.o.f=4
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.5642 0.4526
## Lag[2*(p+q)+(p+q)-1][8] 1.3082 0.9480
## Lag[4*(p+q)+(p+q)-1][14] 4.8253 0.7908
## d.o.f=3
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[4] 0.3847 0.500 2.000 0.5351
## ARCH Lag[6] 0.6717 1.461 1.711 0.8430
## ARCH Lag[8] 0.8129 2.368 1.583 0.9498
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 1.941
## Individual Statistics:
## mu 0.16948
## ar1 0.13795
## ar2 0.31433
## ma1 0.10452
## ma2 0.14120
## omega 0.20474
## alpha1 0.18645
## alpha2 0.23501
## beta1 0.21528
## gamma1 0.09111
## gamma2 0.18091
## skew 0.04294
## shape 0.13753
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 2.89 3.15 3.69
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.4908 0.1367
## Negative Sign Bias 1.1196 0.2634
## Positive Sign Bias 0.5005 0.6170
## Joint Effect 4.4204 0.2195
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 22.94 0.2399
## 2 30 33.44 0.2604
## 3 40 44.10 0.2648
## 4 50 49.47 0.4543
##
##
## Elapsed time : 3.605517
inhsi.garch21t.fit
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(2,1)
## Mean Model : ARFIMA(1,0,0)
## Distribution : std
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999999 0.000606 1649.518667 0.000000
## ar1 -0.061984 0.041751 -1.484606 0.137648
## omega 0.000055 0.000026 2.077057 0.037796
## alpha1 0.002459 0.041394 0.059414 0.952622
## alpha2 0.039400 0.085358 0.461587 0.644377
## beta1 0.532777 0.175026 3.043981 0.002335
## gamma1 -0.009583 0.090472 -0.105919 0.915647
## gamma2 0.306926 0.157334 1.950789 0.051082
## shape 5.772083 1.465273 3.939253 0.000082
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999999 0.000806 1240.064792 0.000000
## ar1 -0.061984 0.041527 -1.492602 0.135541
## omega 0.000055 0.000034 1.596038 0.110480
## alpha1 0.002459 0.018879 0.130271 0.896352
## alpha2 0.039400 0.095690 0.411748 0.680524
## beta1 0.532777 0.219096 2.431701 0.015028
## gamma1 -0.009583 0.166960 -0.057395 0.954231
## gamma2 0.306926 0.187663 1.635515 0.101941
## shape 5.772083 1.562428 3.694303 0.000220
##
## LogLikelihood : 1414.306
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.8071
## Bayes -5.7293
## Shibata -5.8077
## Hannan-Quinn -5.7765
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1907 0.6623
## Lag[2*(p+q)+(p+q)-1][2] 0.3806 0.9861
## Lag[4*(p+q)+(p+q)-1][5] 2.1186 0.6769
## d.o.f=1
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1358 0.7125
## Lag[2*(p+q)+(p+q)-1][8] 1.1442 0.9631
## Lag[4*(p+q)+(p+q)-1][14] 2.2777 0.9848
## d.o.f=3
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[4] 1.171 0.500 2.000 0.2792
## ARCH Lag[6] 1.470 1.461 1.711 0.6185
## ARCH Lag[8] 1.537 2.368 1.583 0.8327
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 1.6301
## Individual Statistics:
## mu 0.26720
## ar1 0.20752
## omega 0.21002
## alpha1 0.04717
## alpha2 0.32179
## beta1 0.29752
## gamma1 0.10101
## gamma2 0.38067
## shape 0.04597
##
## 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 0.2131 0.8313
## Negative Sign Bias 0.2921 0.7703
## Positive Sign Bias 0.3227 0.7471
## Joint Effect 0.8022 0.8489
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 16.41 0.6296
## 2 30 26.37 0.6056
## 3 40 40.96 0.3846
## 4 50 40.59 0.7983
##
##
## Elapsed time : 2.522294
## Trích xuất chuỗi phần dư u của chuỗi lợi suất HSI
inhsi.res <- residuals(inhsi.garch21t.fit)/sigma(inhsi.garch21t.fit)
fitdist(distribution = "std", hsi.res, control = list())$pars
## mu sigma shape
## 0.01276228 0.98573294 6.17652129
u_2 <- pdist(distribution = "std", q = hsi.res, mu =0.01276228 , sigma = 0.98573294, shape = 6.17652129)
## Trích xuat chuoi phan dư v của chuỗi lợi suất VNI
invni.res <- residuals(invni.garch21st.fit)/sigma(invni.garch21st.fit)
fitdist(distribution = "sstd", hsi.res, control = list())$pars
## mu sigma skew shape
## 0.003601717 0.986662662 0.964525992 6.103028224
v_2 <- pdist(distribution = "sstd", q = hsi.res, mu =0.003601717 , sigma = 0.986662662,skew= 0.964525992, shape = 6.103028224)
par(mar = c(2, 2, 2, 2))
persp(VC2copula::BB1Copula(param = c(est_opt_cop$par, est_opt_cop$par2)),dCopula,
xlab = 'u', ylab = 'v', col = 'lightblue', ltheta = 120,
ticktype = "detailed", cex.axis = 0.8, main = 'Phối cảnh PDF của mô hình BB1 Copula')

# ƯỚC LƯỢNG CÁC DẠNG MÔ HÌNH GJR-GARCH GIAI ĐOẠN SAU COVID (1/2022-12/2023)
### MÔ HÌNH ARMA
autoarfima(saucov[,1], ar.max = 2, ma.max = 2, criterion = "AIC", method = "full")$fit
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
##
## *----------------------------------*
## * ARFIMA Model Fit *
## *----------------------------------*
## Mean Model : ARFIMA(1,0,0)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999505 0.000654 1527.2618 0.00000
## ar1 0.059422 0.045670 1.3011 0.19322
## sigma 0.013460 0.000435 30.9077 0.00000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999505 0.000651 1536.0117 0.00000
## ar1 0.059422 0.044202 1.3443 0.17885
## sigma 0.013460 0.000902 14.9175 0.00000
##
## LogLikelihood : 1381.116
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.7662
## Bayes -5.7400
## Shibata -5.7663
## Hannan-Quinn -5.7559
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 5.277e-06 0.9982
## Lag[2*(p+q)+(p+q)-1][2] 6.700e-04 1.0000
## Lag[4*(p+q)+(p+q)-1][5] 7.497e-02 1.0000
##
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 5.792 1.610e-02
## Lag[2*(p+q)+(p+q)-1][2] 10.142 1.753e-03
## Lag[4*(p+q)+(p+q)-1][5] 28.282 9.627e-08
##
##
## ARCH LM Tests
## ------------------------------------
## Statistic DoF P-Value
## ARCH Lag[2] 13.01 2 1.497e-03
## ARCH Lag[5] 32.70 5 4.317e-06
## ARCH Lag[10] 38.26 10 3.423e-05
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 1.0228
## Individual Statistics:
## mu 0.19406
## ar1 0.01774
## sigma 0.93712
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 0.846 1.01 1.35
## Individual Statistic: 0.35 0.47 0.75
##
##
## Elapsed time : 0.02565503
autoarfima(saucov[,2], ar.max = 2, ma.max = 2, criterion = "AIC", method = "full")$fit
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
## Warning in .makearfimafitmodel(f = .arfimaLLH, T = T, m = m, timer = timer, :
## rugarch-->warning: failed to invert hessian
##
## *----------------------------------*
## * ARFIMA Model Fit *
## *----------------------------------*
## Mean Model : ARFIMA(2,0,2)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999500 0.000789 1266.734 0
## ar1 0.000000 NA NA NA
## ar2 -0.946294 0.043264 -21.873 0
## ma1 0.000000 NA NA NA
## ma2 0.894187 0.059726 14.972 0
## sigma 0.017724 0.000573 30.919 0
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999500 0.000790 1265.193 0
## ar1 0.000000 NA NA NA
## ar2 -0.946294 0.042840 -22.089 0
## ma1 0.000000 NA NA NA
## ma2 0.894187 0.066172 13.513 0
## sigma 0.017724 0.000861 20.583 0
##
## LogLikelihood : 1249.432
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.2110
## Bayes -5.1761
## Shibata -5.2112
## Hannan-Quinn -5.1973
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.04901 0.8248
## Lag[2*(p+q)+(p+q)-1][11] 2.58570 1.0000
## Lag[4*(p+q)+(p+q)-1][19] 6.41234 0.9509
##
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 29.45 5.735e-08
## Lag[2*(p+q)+(p+q)-1][2] 34.86 5.668e-10
## Lag[4*(p+q)+(p+q)-1][5] 39.19 7.876e-11
##
##
## ARCH LM Tests
## ------------------------------------
## Statistic DoF P-Value
## ARCH Lag[2] 33.13 2 6.380e-08
## ARCH Lag[5] 33.18 5 3.460e-06
## ARCH Lag[10] 36.94 10 5.807e-05
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 1.5769
## Individual Statistics:
## mu 0.04764
## ar2 0.02270
## ma2 0.02398
## sigma 1.23283
##
## 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.07724094
### GJR-GARCH(11)VNI
sauvni.garch11n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "norm")
sauvni.garch11n.fit <- ugarchfit(spec = sauvni.garch11n.spec, data= saucov[,1])
sauvni.garch11t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "std")
sauvni.garch11t.fit <- ugarchfit(spec = sauvni.garch11t.spec, data= saucov[,1])
sauvni.garch11st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sstd")
sauvni.garch11st.fit <- ugarchfit(spec = sauvni.garch11st.spec, data= saucov[,1])
sauvni.garch11g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "ged")
sauvni.garch11g.fit <- ugarchfit(spec = sauvni.garch11g.spec, data= saucov[,1])
sauvni.garch11sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sged")
sauvni.garch11sg.fit <- ugarchfit(spec = sauvni.garch11sg.spec, data= saucov[,1])
### GJR-GARCH(12)VNI
sauvni.garch12n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "norm")
sauvni.garch12n.fit <- ugarchfit(spec = sauvni.garch12n.spec, data= saucov[,1])
sauvni.garch12t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "std")
sauvni.garch12t.fit <- ugarchfit(spec = sauvni.garch12t.spec, data= saucov[,1])
sauvni.garch12st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sstd")
sauvni.garch12st.fit <- ugarchfit(spec = sauvni.garch12st.spec, data= saucov[,1])
sauvni.garch12g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "ged")
sauvni.garch12g.fit <- ugarchfit(spec = sauvni.garch12g.spec, data= saucov[,1])
sauvni.garch12sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sged")
sauvni.garch12sg.fit <- ugarchfit(spec = sauvni.garch12sg.spec, data= saucov[,1])
### GJR-GARCH(21)VNI
sauvni.garch21n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "norm")
sauvni.garch21n.fit <- ugarchfit(spec = sauvni.garch21n.spec, data= saucov[,1])
sauvni.garch21t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "std")
sauvni.garch21t.fit <- ugarchfit(spec = sauvni.garch21t.spec, data= saucov[,1])
sauvni.garch21st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sstd")
sauvni.garch21st.fit <- ugarchfit(spec = sauvni.garch21st.spec, data= saucov[,1])
sauvni.garch21g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "ged")
sauvni.garch21g.fit <- ugarchfit(spec = sauvni.garch21g.spec, data= saucov[,1])
sauvni.garch21sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sged")
sauvni.garch21sg.fit <- ugarchfit(spec = sauvni.garch21sg.spec, data= saucov[,1])
### GJR-GARCH(22)VNI
sauvni.garch22n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "norm")
sauvni.garch22n.fit <- ugarchfit(spec = sauvni.garch22n.spec, data= saucov[,1])
sauvni.garch22t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "std")
sauvni.garch22t.fit <- ugarchfit(spec = sauvni.garch22t.spec, data= saucov[,1])
sauvni.garch22st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sstd")
sauvni.garch22st.fit <- ugarchfit(spec = sauvni.garch22st.spec, data= saucov[,1])
sauvni.garch22g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "ged")
sauvni.garch22g.fit <- ugarchfit(spec = sauvni.garch22g.spec, data= saucov[,1])
sauvni.garch22sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(1, 0), include.mean = TRUE), distribution.model = "sged")
sauvni.garch22sg.fit <- ugarchfit(spec = sauvni.garch22sg.spec, data= saucov[,1])
## GJR-GARCH(11)HSI
sauhsi.garch11n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
sauhsi.garch11n.fit <- ugarchfit(spec = sauhsi.garch11n.spec, data = saucov[,2])
sauhsi.garch11t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
sauhsi.garch11t.fit <- ugarchfit(spec = sauhsi.garch11t.spec, data = saucov[,2])
sauhsi.garch11st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
sauhsi.garch11st.fit <- ugarchfit(spec = sauhsi.garch11st.spec, data = saucov[,2])
sauhsi.garch11g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
sauhsi.garch11g.fit <- ugarchfit(spec = sauhsi.garch11g.spec, data = saucov[,2])
sauhsi.garch11sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
sauhsi.garch11sg.fit <- ugarchfit(spec = sauhsi.garch11sg.spec, data = saucov[,2])
### GJR-GARCH(12)HSI
sauhsi.garch12n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
sauhsi.garch12n.fit <- ugarchfit(spec = sauhsi.garch12n.spec, data = saucov[,2])
sauhsi.garch12t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
sauhsi.garch12t.fit <- ugarchfit(spec = sauhsi.garch12t.spec, data = saucov[,2])
sauhsi.garch12st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
sauhsi.garch12st.fit <- ugarchfit(spec = sauhsi.garch12st.spec, data = saucov[,2])
sauhsi.garch12g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
sauhsi.garch12g.fit <- ugarchfit(spec = sauhsi.garch12g.spec, data = saucov[,2])
sauhsi.garch12sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
sauhsi.garch12sg.fit <- ugarchfit(spec = sauhsi.garch12sg.spec, data = saucov[,2])
### GJR-GARCH(21)HSI
sauhsi.garch21n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
sauhsi.garch21n.fit <- ugarchfit(spec = sauhsi.garch21n.spec, data = saucov[,2])
sauhsi.garch21t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
sauhsi.garch21t.fit <- ugarchfit(spec = sauhsi.garch21t.spec, data = saucov[,2])
sauhsi.garch21st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
sauhsi.garch21st.fit <- ugarchfit(spec = sauhsi.garch21st.spec, data = saucov[,2])
sauhsi.garch21g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
sauhsi.garch21g.fit <- ugarchfit(spec = sauhsi.garch21g.spec, data = saucov[,2])
sauhsi.garch21sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
sauhsi.garch21sg.fit <- ugarchfit(spec = sauhsi.garch21sg.spec, data = saucov[,2])
### GJR-GARCH(22)HSI
sauhsi.garch22n.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "norm")
sauhsi.garch22n.fit <- ugarchfit(spec = sauhsi.garch22n.spec, data = saucov[,2])
sauhsi.garch22t.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "std")
sauhsi.garch22t.fit <- ugarchfit(spec = sauhsi.garch22t.spec, data = saucov[,2])
sauhsi.garch22st.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sstd")
sauhsi.garch22st.fit <- ugarchfit(spec = sauhsi.garch22st.spec, data = saucov[,2])
sauhsi.garch22g.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)), mean.model
= list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "ged")
sauhsi.garch22g.fit <- ugarchfit(spec = sauhsi.garch22g.spec, data = saucov[,2])
sauhsi.garch22sg.spec <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(2, 2)),
mean.model = list(armaOrder = c(2, 2), include.mean = TRUE), distribution.model = "sged")
sauhsi.garch22sg.fit <- ugarchfit(spec = sauhsi.garch22sg.spec, data = saucov[,2])
### LỰA CHỌN MO HINH GJR-GARCH ###
# Lựa chọn mô hình biên phù hợp nhất cho chuỗi VNI
sauvni.model.list <- list(saugarch11n = sauvni.garch11n.fit, saugarch11t = sauvni.garch11t.fit, saugarch11st = sauvni.garch11st.fit,
saugarch11g = sauvni.garch11g.fit, saugarch11sg = sauvni.garch11sg.fit,
saugarch12n = sauvni.garch12n.fit, saugarch12t = sauvni.garch12t.fit, saugarch12st = sauvni.garch12st.fit, saugarch12g =
sauvni.garch12g.fit, saugarch12sg = sauvni.garch12sg.fit,
saugarch21n = sauvni.garch21n.fit, saugarch21t = sauvni.garch21t.fit, saugarch21st = sauvni.garch21st.fit, saugarch21g =
sauvni.garch21g.fit, saugarch21sg = sauvni.garch21sg.fit,
saugarch22n = sauvni.garch22n.fit, saugarch22t = sauvni.garch22t.fit, saugarch22st = sauvni.garch22st.fit, garch22g =
sauvni.garch22g.fit,saugarch22sg = sauvni.garch22sg.fit)
sauvni.info.mat <- sapply(sauvni.model.list, infocriteria)
rownames(sauvni.info.mat) <- rownames(infocriteria(sauvni.garch11n.fit))
sauvni.info.mat
## saugarch11n saugarch11t saugarch11st saugarch11g saugarch11sg
## Akaike -5.940926 -6.010592 -6.022842 -6.011726 -6.027440
## Bayes -5.888588 -5.949530 -5.953058 -5.950665 -5.957655
## Shibata -5.941236 -6.011012 -6.023390 -6.012146 -6.027988
## Hannan-Quinn -5.920350 -5.986586 -5.995407 -5.987720 -6.000004
## saugarch12n saugarch12t saugarch12st saugarch12g saugarch12sg
## Akaike -5.936654 -6.008066 -6.022555 -6.008289 -6.026008
## Bayes -5.875593 -5.938282 -5.944048 -5.938505 -5.947501
## Shibata -5.937075 -6.008614 -6.023247 -6.008837 -6.026700
## Hannan-Quinn -5.912648 -5.980631 -5.991690 -5.980854 -5.995143
## saugarch21n saugarch21t saugarch21st saugarch21g saugarch21sg
## Akaike -5.941194 -6.005093 -6.016562 -6.007162 -6.021221
## Bayes -5.871410 -5.926585 -5.929332 -5.928655 -5.933990
## Shibata -5.941742 -6.005784 -6.017414 -6.007854 -6.022072
## Hannan-Quinn -5.913759 -5.974228 -5.982268 -5.976297 -5.986926
## saugarch22n saugarch22t saugarch22st garch22g saugarch22sg
## Akaike -5.943744 -6.004774 -6.018467 -6.006993 -6.023267
## Bayes -5.865237 -5.917544 -5.922514 -5.919763 -5.927314
## Shibata -5.944436 -6.005626 -6.019495 -6.007845 -6.024295
## Hannan-Quinn -5.912879 -5.970480 -5.980744 -5.972699 -5.985543
sauvni.inds <- which(sauvni.info.mat == min(sauvni.info.mat), arr.ind=TRUE)
saumodel.vni <- colnames(sauvni.info.mat)[vni.inds[,2]]
saumodel.vni
## [1] "saugarch21st"
safe_infocriteria <- function(model) {
tryCatch(
infocriteria(model),
error = function(e) return(rep(NA, 4))
)
}
# Lựa chọn mô hình biên phù hợp nhất cho chuỗi HSI
sauhsi.model.list <- list(saugarch11n = sauhsi.garch11n.fit, saugarch11t = sauhsi.garch11t.fit, saugarch11st = sauhsi.garch11st.fit,
saugarch11g = sauhsi.garch11g.fit, saugarch11sg = sauhsi.garch11sg.fit,
saugarch12n = sauhsi.garch12n.fit, saugarch12t = sauhsi.garch12t.fit, saugarch12st = sauhsi.garch12st.fit, saugarch12g =
sauhsi.garch12g.fit, saugarch12sg = sauhsi.garch12sg.fit,
saugarch21n = sauhsi.garch21n.fit, saugarch21t = sauhsi.garch21t.fit, saugarch21st = sauhsi.garch21st.fit, saugarch21g =
sauhsi.garch21g.fit, saugarch21sg = sauhsi.garch21sg.fit,
saugarch22n = sauhsi.garch22n.fit, saugarch22t = sauhsi.garch22t.fit, saugarch22st = sauhsi.garch22st.fit, garch22g =
sauhsi.garch22g.fit,saugarch22sg = sauhsi.garch22sg.fit)
sauhsi.info.mat <- sapply(sauhsi.model.list, safe_infocriteria)
## Warning in log(log(nObs)): NaNs produced
## Warning in log(log(nObs)): NaNs produced
rownames(sauhsi.info.mat) <- rownames(infocriteria(sauhsi.garch11n.fit))
sauhsi.info.mat
## saugarch11n saugarch11t saugarch11st saugarch11g saugarch11sg
## Akaike -5.308212 NA -5.334160 -5.325754 -5.336342
## Bayes -5.229705 NA -5.238206 -5.238524 -5.240389
## Shibata -5.308904 NA -5.335187 -5.326606 -5.337370
## Hannan-Quinn -5.277347 NA -5.296436 -5.291460 -5.298619
## saugarch12n saugarch12t saugarch12st saugarch12g saugarch12sg
## Akaike -5.304028 -5.318837 -5.329975 -5.330488 -5.332158
## Bayes -5.216798 -5.222883 -5.225299 -5.234534 -5.227482
## Shibata -5.304880 -5.319864 -5.331195 -5.331515 -5.333378
## Hannan-Quinn -5.269734 -5.281113 -5.288822 -5.292764 -5.291005
## saugarch21n saugarch21t saugarch21st saugarch21g saugarch21sg
## Akaike -5.299866 -5.287092 -5.304394 -5.318042 NA
## Bayes -5.203913 -5.182416 -5.190995 -5.213365 NA
## Shibata -5.300894 -5.288312 -5.305822 -5.319261 NA
## Hannan-Quinn -5.262143 -5.245939 -5.259811 -5.276888 NA
## saugarch22n saugarch22t saugarch22st garch22g saugarch22sg
## Akaike -5.299539 -5.317455 -5.331201 -5.325797 -5.327819
## Bayes -5.194862 -5.204055 -5.209079 -5.212398 -5.205697
## Shibata -5.300759 -5.318883 -5.332853 -5.327225 -5.329471
## Hannan-Quinn -5.258386 -5.272872 -5.283189 -5.281214 -5.279807
sauhsi.inds <- which(sauhsi.info.mat == min(sauhsi.info.mat), arr.ind=TRUE)
saumodel.hsi <- colnames(sauhsi.info.mat)[hsi.inds[,2]]
saumodel.hsi
## [1] "saugarch21t"
### THAM SỐ ƯỚC LƯỢNG MÔ HÌNH BIÊN PHÙ HỢP NHẤT
sauvni.garch21st.fit
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(2,1)
## Mean Model : ARFIMA(1,0,0)
## Distribution : sstd
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 1.000121 0.000471 2124.481915 0.000000
## ar1 0.045843 0.053797 0.852143 0.394135
## omega 0.000005 0.000002 2.318699 0.020411
## alpha1 0.000000 0.127747 0.000002 0.999998
## alpha2 0.019895 0.130559 0.152385 0.878883
## beta1 0.886811 0.022692 39.080867 0.000000
## gamma1 0.241132 0.195215 1.235214 0.216751
## gamma2 -0.126573 0.185699 -0.681603 0.495490
## skew 0.842022 0.052146 16.147481 0.000000
## shape 5.368091 1.501734 3.574595 0.000351
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 1.000121 0.000916 1091.829789 0.000000
## ar1 0.045843 0.056039 0.818054 0.413326
## omega 0.000005 0.000004 1.228508 0.219256
## alpha1 0.000000 0.192356 0.000001 0.999999
## alpha2 0.019895 0.199455 0.099748 0.920544
## beta1 0.886811 0.018299 48.461465 0.000000
## gamma1 0.241132 0.236330 1.020316 0.307578
## gamma2 -0.126573 0.233614 -0.541804 0.587954
## skew 0.842022 0.062612 13.448286 0.000000
## shape 5.368091 1.783563 3.009758 0.002615
##
## LogLikelihood : 1447.958
##
## Information Criteria
## ------------------------------------
##
## Akaike -6.0166
## Bayes -5.9293
## Shibata -6.0174
## Hannan-Quinn -5.9823
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.6205 0.4309
## Lag[2*(p+q)+(p+q)-1][2] 0.6736 0.9087
## Lag[4*(p+q)+(p+q)-1][5] 1.0312 0.9421
## d.o.f=1
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 2.170 0.1407
## Lag[2*(p+q)+(p+q)-1][8] 3.895 0.5243
## Lag[4*(p+q)+(p+q)-1][14] 5.407 0.7177
## d.o.f=3
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[4] 1.139 0.500 2.000 0.2859
## ARCH Lag[6] 2.099 1.461 1.711 0.4693
## ARCH Lag[8] 3.051 2.368 1.583 0.5340
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 3.4061
## Individual Statistics:
## mu 0.19971
## ar1 0.09037
## omega 0.41891
## alpha1 0.07712
## alpha2 0.07464
## beta1 0.06119
## gamma1 0.05847
## gamma2 0.05764
## skew 0.09691
## shape 0.03045
##
## 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.8417 0.4004
## Negative Sign Bias 1.0536 0.2926
## Positive Sign Bias 1.1680 0.2434
## Joint Effect 4.1857 0.2421
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 11.29 0.9137
## 2 30 16.18 0.9734
## 3 40 19.91 0.9952
## 4 50 31.21 0.9777
##
##
## Elapsed time : 1.677433
sauhsi.garch21t.fit
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(2,1)
## Mean Model : ARFIMA(2,0,2)
## Distribution : std
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999549 0.000658 1519.02392 0.00000
## ar1 -0.032045 0.000084 -383.38348 0.00000
## ar2 -0.999266 0.001793 -557.39986 0.00000
## ma1 0.032127 0.000083 385.40386 0.00000
## ma2 0.996641 0.001256 793.28229 0.00000
## omega 0.000000 0.000003 0.11128 0.91139
## alpha1 0.024297 0.000073 333.96326 0.00000
## alpha2 0.024910 0.000074 335.51927 0.00000
## beta1 0.892100 0.002062 432.70260 0.00000
## gamma1 -0.111884 0.000277 -403.84281 0.00000
## gamma2 0.208914 0.000558 374.26219 0.00000
## shape 6.036820 0.877578 6.87896 0.00000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.999549 0.002676 373.512477 0.000000
## ar1 -0.032045 0.003817 -8.396410 0.000000
## ar2 -0.999266 0.010247 -97.520391 0.000000
## ma1 0.032127 0.004092 7.850873 0.000000
## ma2 0.996641 0.000560 1781.243456 0.000000
## omega 0.000000 0.000060 0.005862 0.995323
## alpha1 0.024297 0.001056 23.016538 0.000000
## alpha2 0.024910 0.003797 6.560304 0.000000
## beta1 0.892100 0.027090 32.930567 0.000000
## gamma1 -0.111884 0.002679 -41.768377 0.000000
## gamma2 0.208914 0.004459 46.853505 0.000000
## shape 6.036820 3.536766 1.706876 0.087845
##
## LogLikelihood : 1275.615
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.2871
## Bayes -5.1824
## Shibata -5.2883
## Hannan-Quinn -5.2459
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.541 0.4620
## Lag[2*(p+q)+(p+q)-1][11] 2.781 1.0000
## Lag[4*(p+q)+(p+q)-1][19] 6.421 0.9503
## d.o.f=4
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 6.743 0.009413
## Lag[2*(p+q)+(p+q)-1][8] 9.555 0.043705
## Lag[4*(p+q)+(p+q)-1][14] 12.418 0.077802
## d.o.f=3
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[4] 0.8234 0.500 2.000 0.3642
## ARCH Lag[6] 0.8369 1.461 1.711 0.7950
## ARCH Lag[8] 1.7005 2.368 1.583 0.8013
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 15.331
## Individual Statistics:
## mu 0.2253
## ar1 0.5861
## ar2 0.7841
## ma1 0.5892
## ma2 0.8233
## omega 0.3304
## alpha1 0.5867
## alpha2 0.5955
## beta1 0.1332
## gamma1 0.4758
## gamma2 0.5861
## shape 0.3518
##
## 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.8938 0.371859
## Negative Sign Bias 2.9612 0.003219 ***
## Positive Sign Bias 1.1114 0.266969
## Joint Effect 14.1256 0.002739 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 46.77 0.0003853
## 2 30 46.56 0.0206223
## 3 40 58.23 0.0244248
## 4 50 64.05 0.0730377
##
##
## Elapsed time : 1.254685
## Trích xuất chuỗi phần dư u của chuỗi lợi suất HSI
inhsi.res <- residuals(sauhsi.garch21t.fit)/sigma(sauhsi.garch21t.fit)
fitdist(distribution = "std", hsi.res, control = list())$pars
## mu sigma shape
## 0.01276228 0.98573294 6.17652129
u_3 <- pdist(distribution = "std", q = hsi.res, mu =0.01276228 , sigma = 0.98573294, shape = 6.17652129)
## Trích xuat chuoi phan dư v của chuỗi lợi suất VNI
sauvni.res <- residuals(sauvni.garch21st.fit)/sigma(sauvni.garch21st.fit)
fitdist(distribution = "sstd", hsi.res, control = list())$pars
## mu sigma skew shape
## 0.003601717 0.986662662 0.964525992 6.103028224
v_3 <- pdist(distribution = "sstd", q = hsi.res, mu =0.003601717 , sigma = 0.986662662,skew= 0.964525992, shape = 6.103028224)