Este estudo analisa graficamente a volatilidade de 5 criptoativos por meio da aplicação de modelos GARCH.
retornos_d <- data %>%
select(ticker, ref.date, ret.closing.prices) %>%
drop_na() %>%
group_split(ticker)
ARCH_teste <- lapply(retornos_d, function(df) {
ARCH_lag1 <- ArchTest(df$ret.closing.prices, lags = 1, demean = TRUE)
ARCH_lag2 <- ArchTest(df$ret.closing.prices, lags = 2, demean = TRUE)
ARCH_lag5 <- ArchTest(df$ret.closing.prices, lags = 5, demean = TRUE)
results <- tibble(
ticker = unique(df$ticker),
lag_1_p_value = ARCH_lag1$p.value,
lag_2_p_value = ARCH_lag2$p.value,
lag_5_p_value = ARCH_lag5$p.value)
return(results)})
ARCH_results_df <- bind_rows(ARCH_teste)
ARCH_results_df # P-valores = 0 --> Há heterocedasticia condicional p/ todos os ativos
# A tibble: 5 × 4
ticker lag_1_p_value lag_2_p_value lag_5_p_value
<chr> <dbl> <dbl> <dbl>
1 ADA-USD 1.83e-15 1.29e-14 6.80e-15
2 BNB-USD 4.32e-16 1.48e-20 1.29e-22
3 BTC-USD 1.40e- 2 4.09e- 2 1.28e- 2
4 ETH-USD 3.15e- 5 4.74e- 5 3.05e- 9
5 SOL-USD 4.97e-24 1.51e-23 7.12e-29
ARMA_pq <- lapply(retornos_d, function(df) {
arima_fit <- auto.arima(df$ret.closing.prices)
c(p = arima_fit$arma[1], q = arima_fit$arma[2])})
ARMA_pq
[[1]]
p q
3 5
[[2]]
p q
3 3
[[3]]
p q
1 1
[[4]]
p q
1 0
[[5]]
p q
4 4
# Como os criptoativos tendem a apresentar caudas pesadas em sua distribuição, será utilizada a distribuição t de Student
sgarch_pq <- mapply(function(df, order) {
sgarch_spec <- ugarchspec(
variance.model = list(model = "sGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(order["p"], order["q"]), include.mean = FALSE),
distribution.model = "std")
ugarchfit(spec = sgarch_spec, data = df$ret.closing.prices)
}, retornos_d, ARMA_pq, SIMPLIFY = FALSE)
sgarch_pq
[[1]]
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : sGARCH(1,1)
Mean Model : ARFIMA(3,0,5)
Distribution : std
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
ar1 0.602666 0.000046 13166.6262 0.000000
ar2 -0.566651 0.000043 -13098.1894 0.000000
ar3 0.972768 0.000069 14110.6464 0.000000
ma1 -0.668602 0.000053 -12545.0795 0.000000
ma2 0.616902 0.000050 12420.4162 0.000000
ma3 -1.014034 0.000074 -13642.2497 0.000000
ma4 0.056972 0.000008 7361.3207 0.000000
ma5 -0.001594 0.000001 -1176.5543 0.000000
omega 0.000182 0.000049 3.6982 0.000217
alpha1 0.202914 0.036243 5.5988 0.000000
beta1 0.766765 0.034328 22.3364 0.000000
shape 3.691637 0.321753 11.4735 0.000000
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
ar1 0.602666 0.002589 232.79330 0.00000
ar2 -0.566651 0.002492 -227.35063 0.00000
ar3 0.972768 0.002180 446.27494 0.00000
ma1 -0.668602 0.003085 -216.71552 0.00000
ma2 0.616902 0.002903 212.47626 0.00000
ma3 -1.014034 0.002729 -371.59775 0.00000
ma4 0.056972 0.000576 98.84982 0.00000
ma5 -0.001594 0.000023 -68.29287 0.00000
omega 0.000182 0.000140 1.29471 0.19542
alpha1 0.202914 1.382775 0.14674 0.88333
beta1 0.766765 0.892731 0.85890 0.39040
shape 3.691637 4.918486 0.75056 0.45292
LogLikelihood : 3248.098
Information Criteria
------------------------------------
Akaike -3.3797
Bayes -3.3449
Shibata -3.3798
Hannan-Quinn -3.3669
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 5.236 0.02213
Lag[2*(p+q)+(p+q)-1][23] 18.640 0.00000
Lag[4*(p+q)+(p+q)-1][39] 23.188 0.16633
d.o.f=8
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.1312 0.7172
Lag[2*(p+q)+(p+q)-1][5] 1.0801 0.8413
Lag[4*(p+q)+(p+q)-1][9] 1.6768 0.9399
d.o.f=2
Weighted ARCH LM Tests
------------------------------------
Statistic Shape Scale P-Value
ARCH Lag[3] 0.6237 0.500 2.000 0.4297
ARCH Lag[5] 0.8502 1.440 1.667 0.7779
ARCH Lag[7] 1.1638 2.315 1.543 0.8855
Nyblom stability test
------------------------------------
Joint Statistic: 3.2906
Individual Statistics:
ar1 0.02397
ar2 0.02382
ar3 0.02816
ma1 0.02393
ma2 0.02371
ma3 0.02802
ma4 0.02243
ma5 0.02243
omega 1.37289
alpha1 0.69493
beta1 1.14799
shape 0.56307
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.635662 0.5251
Negative Sign Bias 0.598036 0.5499
Positive Sign Bias 0.004729 0.9962
Joint Effect 0.575369 0.9020
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 14.28 0.7669
2 30 23.00 0.7765
3 40 28.67 0.8880
4 50 42.89 0.7181
Elapsed time : 5.281551
[[2]]
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : sGARCH(1,1)
Mean Model : ARFIMA(3,0,3)
Distribution : std
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
ar1 0.936121 0.000410 2282.9878 0.000000
ar2 -0.374337 0.000634 -590.1367 0.000000
ar3 -0.441185 0.000269 -1641.2036 0.000000
ma1 -0.992238 0.000215 -4621.5333 0.000000
ma2 0.454936 0.000109 4159.7778 0.000000
ma3 0.395172 0.000072 5497.6203 0.000000
omega 0.000051 0.000018 2.7651 0.005690
alpha1 0.155331 0.035793 4.3397 0.000014
beta1 0.840293 0.032002 26.2576 0.000000
shape 3.555620 0.318541 11.1622 0.000000
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
ar1 0.936121 0.000545 1716.9666 0.000000
ar2 -0.374337 0.000371 -1008.9655 0.000000
ar3 -0.441185 0.000637 -692.6545 0.000000
ma1 -0.992238 0.000225 -4411.8987 0.000000
ma2 0.454936 0.000151 3018.6889 0.000000
ma3 0.395172 0.000055 7124.2401 0.000000
omega 0.000051 0.000025 1.9962 0.045909
alpha1 0.155331 0.044007 3.5297 0.000416
beta1 0.840293 0.042991 19.5456 0.000000
shape 3.555620 0.329560 10.7890 0.000000
LogLikelihood : 3782.596
Information Criteria
------------------------------------
Akaike -3.9400
Bayes -3.9110
Shibata -3.9401
Hannan-Quinn -3.9294
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 2.142 1.433e-01
Lag[2*(p+q)+(p+q)-1][17] 12.097 1.104e-06
Lag[4*(p+q)+(p+q)-1][29] 16.879 2.455e-01
d.o.f=6
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.2353 0.6276
Lag[2*(p+q)+(p+q)-1][5] 4.5848 0.1896
Lag[4*(p+q)+(p+q)-1][9] 7.4576 0.1638
d.o.f=2
Weighted ARCH LM Tests
------------------------------------
Statistic Shape Scale P-Value
ARCH Lag[3] 0.8697 0.500 2.000 0.35104
ARCH Lag[5] 8.3631 1.440 1.667 0.01641
ARCH Lag[7] 8.9544 2.315 1.543 0.03201
Nyblom stability test
------------------------------------
Joint Statistic: 2.2607
Individual Statistics:
ar1 0.03752
ar2 0.03956
ar3 0.07097
ma1 0.09688
ma2 0.04017
ma3 0.06783
omega 1.27466
alpha1 1.22579
beta1 1.22963
shape 1.29996
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 2.9590 0.003124 ***
Negative Sign Bias 1.0997 0.271619
Positive Sign Bias 0.9054 0.365385
Joint Effect 9.0453 0.028695 **
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 21.37 0.3170
2 30 34.03 0.2382
3 40 43.50 0.2858
4 50 47.69 0.5263
Elapsed time : 1.116556
[[3]]
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : sGARCH(1,1)
Mean Model : ARFIMA(1,0,1)
Distribution : std
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
ar1 -0.287649 0.291967 -0.98521 0.324519
ma1 0.230554 0.296514 0.77755 0.436836
omega 0.000019 0.000010 1.86523 0.062150
alpha1 0.071087 0.017945 3.96132 0.000075
beta1 0.927913 0.018421 50.37346 0.000000
shape 3.045343 0.229536 13.26738 0.000000
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
ar1 -0.287649 0.256889 -1.11974 0.262825
ma1 0.230554 0.259757 0.88758 0.374770
omega 0.000019 0.000015 1.29810 0.194254
alpha1 0.071087 0.022637 3.14028 0.001688
beta1 0.927913 0.026184 35.43883 0.000000
shape 3.045343 0.208289 14.62075 0.000000
LogLikelihood : 4095.974
Information Criteria
------------------------------------
Akaike -4.2715
Bayes -4.2541
Shibata -4.2715
Hannan-Quinn -4.2651
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 5.975 1.451e-02
Lag[2*(p+q)+(p+q)-1][5] 8.581 5.371e-10
Lag[4*(p+q)+(p+q)-1][9] 11.241 2.611e-03
d.o.f=2
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.07163 0.7890
Lag[2*(p+q)+(p+q)-1][5] 2.02406 0.6128
Lag[4*(p+q)+(p+q)-1][9] 3.36178 0.6980
d.o.f=2
Weighted ARCH LM Tests
------------------------------------
Statistic Shape Scale P-Value
ARCH Lag[3] 0.3185 0.500 2.000 0.5725
ARCH Lag[5] 3.4296 1.440 1.667 0.2332
ARCH Lag[7] 3.8155 2.315 1.543 0.3740
Nyblom stability test
------------------------------------
Joint Statistic: 1.4343
Individual Statistics:
ar1 0.10357
ma1 0.09493
omega 0.32285
alpha1 0.45193
beta1 0.41258
shape 0.45757
Asymptotic Critical Values (10% 5% 1%)
Joint Statistic: 1.49 1.68 2.12
Individual Statistic: 0.35 0.47 0.75
Sign Bias Test
------------------------------------
t-value prob sig
Sign Bias 1.6033 0.1090
Negative Sign Bias 0.9263 0.3544
Positive Sign Bias 1.4837 0.1381
Joint Effect 3.4240 0.3308
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 49.81 0.0001396
2 30 58.12 0.0010513
3 40 66.93 0.0035464
4 50 75.05 0.0097330
Elapsed time : 0.2247472
[[4]]
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : sGARCH(1,1)
Mean Model : ARFIMA(1,0,0)
Distribution : std
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
ar1 -0.065319 0.021392 -3.0535 0.002262
omega 0.000024 0.000015 1.6561 0.097695
alpha1 0.080671 0.020637 3.9091 0.000093
beta1 0.918329 0.021616 42.4839 0.000000
shape 3.564286 0.317045 11.2422 0.000000
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
ar1 -0.065319 0.021818 -2.99384 0.002755
omega 0.000024 0.000027 0.90094 0.367619
alpha1 0.080671 0.030346 2.65841 0.007851
beta1 0.918329 0.037274 24.63701 0.000000
shape 3.564286 0.318499 11.19088 0.000000
LogLikelihood : 3593.937
Information Criteria
------------------------------------
Akaike -3.7482
Bayes -3.7337
Shibata -3.7483
Hannan-Quinn -3.7429
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 5.319 2.109e-02
Lag[2*(p+q)+(p+q)-1][2] 7.518 8.814e-07
Lag[4*(p+q)+(p+q)-1][5] 11.814 1.733e-04
d.o.f=1
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.08766 0.7672
Lag[2*(p+q)+(p+q)-1][5] 3.49418 0.3242
Lag[4*(p+q)+(p+q)-1][9] 6.23414 0.2722
d.o.f=2
Weighted ARCH LM Tests
------------------------------------
Statistic Shape Scale P-Value
ARCH Lag[3] 0.496 0.500 2.000 0.48128
ARCH Lag[5] 6.675 1.440 1.667 0.04161
ARCH Lag[7] 7.224 2.315 1.543 0.07768
Nyblom stability test
------------------------------------
Joint Statistic: 1.6271
Individual Statistics:
ar1 0.06175
omega 0.73863
alpha1 0.71142
beta1 0.56227
shape 0.81687
Asymptotic Critical Values (10% 5% 1%)
Joint Statistic: 1.28 1.47 1.88
Individual Statistic: 0.35 0.47 0.75
Sign Bias Test
------------------------------------
t-value prob sig
Sign Bias 0.8623 0.3886
Negative Sign Bias 0.3709 0.7108
Positive Sign Bias 0.5347 0.5929
Joint Effect 3.5330 0.3165
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 26.25 0.12329
2 30 43.18 0.04384
3 40 42.87 0.30875
4 50 54.11 0.28559
Elapsed time : 0.1871891
[[5]]
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : sGARCH(1,1)
Mean Model : ARFIMA(4,0,4)
Distribution : std
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
ar1 -0.337323 0.278749 -1.21013 0.226227
ar2 0.015442 0.080674 0.19141 0.848207
ar3 0.879267 0.071850 12.23753 0.000000
ar4 0.339845 0.264160 1.28652 0.198263
ma1 0.302544 0.284260 1.06432 0.287183
ma2 -0.024140 0.085873 -0.28111 0.778623
ma3 -0.871186 0.076260 -11.42383 0.000000
ma4 -0.284041 0.267748 -1.06085 0.288756
omega 0.000175 0.000060 2.92574 0.003436
alpha1 0.117566 0.025342 4.63913 0.000003
beta1 0.844945 0.032464 26.02743 0.000000
shape 5.039649 0.577258 8.73033 0.000000
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
ar1 -0.337323 0.201797 -1.67160 0.094603
ar2 0.015442 0.087550 0.17637 0.860000
ar3 0.879267 0.067636 12.99989 0.000000
ar4 0.339845 0.199996 1.69926 0.089270
ma1 0.302544 0.207064 1.46111 0.143984
ma2 -0.024140 0.092345 -0.26141 0.793775
ma3 -0.871186 0.070955 -12.27808 0.000000
ma4 -0.284041 0.205113 -1.38480 0.166114
omega 0.000175 0.000090 1.94679 0.051560
alpha1 0.117566 0.037100 3.16891 0.001530
beta1 0.844945 0.050736 16.65380 0.000000
shape 5.039649 0.578270 8.71504 0.000000
LogLikelihood : 2605.932
Information Criteria
------------------------------------
Akaike -2.8583
Bayes -2.8219
Shibata -2.8584
Hannan-Quinn -2.8449
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 1.375 0.2410
Lag[2*(p+q)+(p+q)-1][23] 12.066 0.4493
Lag[4*(p+q)+(p+q)-1][39] 19.625 0.5232
d.o.f=8
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 7.037 0.007985
Lag[2*(p+q)+(p+q)-1][5] 7.169 0.047180
Lag[4*(p+q)+(p+q)-1][9] 8.710 0.093151
d.o.f=2
Weighted ARCH LM Tests
------------------------------------
Statistic Shape Scale P-Value
ARCH Lag[3] 0.1463 0.500 2.000 0.7021
ARCH Lag[5] 0.2434 1.440 1.667 0.9549
ARCH Lag[7] 1.2559 2.315 1.543 0.8687
Nyblom stability test
------------------------------------
Joint Statistic: 3.3919
Individual Statistics:
ar1 0.1847
ar2 0.1177
ar3 0.1415
ar4 0.2413
ma1 0.1962
ma2 0.1097
ma3 0.1520
ma4 0.2798
omega 1.2302
alpha1 1.3429
beta1 1.4733
shape 0.4885
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 1.0413 0.29786
Negative Sign Bias 0.6888 0.49106
Positive Sign Bias 2.2588 0.02401 **
Joint Effect 5.6409 0.13045
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 28.78 0.06953
2 30 32.42 0.30168
3 40 45.52 0.21915
4 50 57.70 0.18458
Elapsed time : 0.8414361
## Para alfa = 5% = 0.05
#BTC --> P-valores não indicam assimetria --> sGARCH serve
#ETH --> P-valores indicam viés de sinal --> sGARCH não serve
#BNB --> P-valores não indicam assimetria --> sGARCH serve
#ADA --> P-valores não indicam assimetria --> sGARCH serve
#SOL --> P-valores não indicam assimetria --> sGARCH serve
eth_data <- retornos_d[[2]]
p <- ARMA_pq[[2]]["p"]
q <- ARMA_pq[[2]]["q"]
egarch_spec <- ugarchspec(
variance.model = list(model = "eGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(p, q), include.mean = FALSE),
distribution.model = "std")
egarch_fit <- ugarchfit(spec = egarch_spec, data = eth_data$ret.closing.prices)
egarch_fit
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : eGARCH(1,1)
Mean Model : ARFIMA(3,0,3)
Distribution : std
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
ar1 0.961219 0.000473 2032.81857 0.000000
ar2 -0.409163 0.000645 -633.96938 0.000000
ar3 -0.416189 0.000506 -822.84363 0.000000
ma1 -1.017864 0.000226 -4510.86879 0.000000
ma2 0.490602 0.000085 5805.59570 0.000000
ma3 0.369113 0.000043 8527.49544 0.000000
omega -0.170108 0.042144 -4.03632 0.000054
alpha1 0.017096 0.018106 0.94421 0.345064
beta1 0.974107 0.006456 150.88282 0.000000
gamma1 0.246861 0.044801 5.51016 0.000000
shape 3.554041 0.315951 11.24871 0.000000
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
ar1 0.961219 0.000514 1871.14480 0.000000
ar2 -0.409163 0.000326 -1254.89333 0.000000
ar3 -0.416189 0.000632 -658.76474 0.000000
ma1 -1.017864 0.000255 -3986.27437 0.000000
ma2 0.490602 0.000130 3770.10017 0.000000
ma3 0.369113 0.000033 11208.37221 0.000000
omega -0.170108 0.045314 -3.75396 0.000174
alpha1 0.017096 0.020414 0.83747 0.402328
beta1 0.974107 0.007157 136.11091 0.000000
gamma1 0.246861 0.059987 4.11524 0.000039
shape 3.554041 0.329211 10.79563 0.000000
LogLikelihood : 3786.209
Information Criteria
------------------------------------
Akaike -3.9428
Bayes -3.9109
Shibata -3.9428
Hannan-Quinn -3.9310
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 1.861 1.726e-01
Lag[2*(p+q)+(p+q)-1][17] 12.375 1.564e-07
Lag[4*(p+q)+(p+q)-1][29] 16.919 2.415e-01
d.o.f=6
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.004497 0.9465
Lag[2*(p+q)+(p+q)-1][5] 3.698020 0.2942
Lag[4*(p+q)+(p+q)-1][9] 6.084940 0.2885
d.o.f=2
Weighted ARCH LM Tests
------------------------------------
Statistic Shape Scale P-Value
ARCH Lag[3] 0.1918 0.500 2.000 0.66142
ARCH Lag[5] 6.4559 1.440 1.667 0.04689
ARCH Lag[7] 7.0019 2.315 1.543 0.08676
Nyblom stability test
------------------------------------
Joint Statistic: 2.0149
Individual Statistics:
ar1 0.02805
ar2 0.04991
ar3 0.08769
ma1 0.08668
ma2 0.03963
ma3 0.08134
omega 0.83363
alpha1 0.35877
beta1 0.80347
gamma1 0.09218
shape 0.69440
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 2.829 0.004714 ***
Negative Sign Bias 0.645 0.519014
Positive Sign Bias 1.311 0.189944
Joint Effect 8.408 0.038294 **
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 22.70 0.2507
2 30 37.48 0.1345
3 40 37.77 0.5258
4 50 53.02 0.3220
Elapsed time : 1.325032
## Para alfa = 5% = 0.05
#ETH --> P-valores indicam viés de sinal e assimetria conjunta
gjrgarch_spec <- ugarchspec(
variance.model = list(model = "gjrGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(p, q), include.mean = FALSE),
distribution.model = "std")
gjrgarch_fit <- ugarchfit(spec = gjrgarch_spec, data = eth_data$ret.closing.prices)
gjrgarch_fit
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : gjrGARCH(1,1)
Mean Model : ARFIMA(3,0,3)
Distribution : std
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
ar1 0.957977 0.000413 2316.9645 0.000000
ar2 -0.404560 0.000602 -671.9573 0.000000
ar3 -0.419405 0.000375 -1118.1704 0.000000
ma1 -1.014821 0.000213 -4759.6786 0.000000
ma2 0.486358 0.000108 4508.7605 0.000000
ma3 0.372345 0.000056 6644.7800 0.000000
omega 0.000045 0.000018 2.5130 0.011970
alpha1 0.163873 0.039228 4.1775 0.000029
beta1 0.850779 0.032962 25.8110 0.000000
gamma1 -0.036507 0.032393 -1.1270 0.259744
shape 3.556813 0.317819 11.1913 0.000000
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
ar1 0.957977 0.000528 1812.7963 0.000000
ar2 -0.404560 0.000284 -1422.4761 0.000000
ar3 -0.419405 0.000605 -693.1459 0.000000
ma1 -1.014821 0.000218 -4648.4328 0.000000
ma2 0.486358 0.000164 2957.7579 0.000000
ma3 0.372345 0.000040 9298.9220 0.000000
omega 0.000045 0.000028 1.5827 0.113485
alpha1 0.163873 0.047823 3.4267 0.000611
beta1 0.850779 0.051510 16.5168 0.000000
gamma1 -0.036507 0.036383 -1.0034 0.315671
shape 3.556813 0.329725 10.7872 0.000000
LogLikelihood : 3783.187
Information Criteria
------------------------------------
Akaike -3.9396
Bayes -3.9077
Shibata -3.9397
Hannan-Quinn -3.9279
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 1.923 1.655e-01
Lag[2*(p+q)+(p+q)-1][17] 12.110 1.006e-06
Lag[4*(p+q)+(p+q)-1][29] 16.932 2.402e-01
d.o.f=6
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.1501 0.6985
Lag[2*(p+q)+(p+q)-1][5] 4.9677 0.1557
Lag[4*(p+q)+(p+q)-1][9] 8.2019 0.1177
d.o.f=2
Weighted ARCH LM Tests
------------------------------------
Statistic Shape Scale P-Value
ARCH Lag[3] 0.6822 0.500 2.000 0.40884
ARCH Lag[5] 9.1960 1.440 1.667 0.01032
ARCH Lag[7] 9.8819 2.315 1.543 0.01960
Nyblom stability test
------------------------------------
Joint Statistic: 2.5485
Individual Statistics:
ar1 0.03751
ar2 0.04120
ar3 0.06860
ma1 0.09045
ma2 0.04034
ma3 0.07120
omega 1.14423
alpha1 1.06064
beta1 1.07793
gamma1 0.58929
shape 1.20164
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 2.8837 0.003974 ***
Negative Sign Bias 0.8871 0.375120
Positive Sign Bias 0.7192 0.472107
Joint Effect 8.9963 0.029341 **
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 21.11 0.3305
2 30 35.38 0.1925
3 40 36.44 0.5874
4 50 43.36 0.7004
Elapsed time : 2.220713
## Para alfa = 5% = 0.05
#ETH --> P-valores indicam viés de sinal e assimetria conjunta
Comp_mod <- tibble(
Model = c("eGARCH", "gjrGARCH"),
AIC = c(infocriteria(egarch_fit)[1], infocriteria(gjrgarch_fit)[1]),
BIC = c(infocriteria(egarch_fit)[2], infocriteria(gjrgarch_fit)[2]),
Residuos = c(mean(abs(residuals(egarch_fit))), mean(abs(residuals(gjrgarch_fit)))))
Comp_mod # Modelo eGARCH é melhor, mas com pouca diferença
# A tibble: 2 × 4
Model AIC BIC Residuos
<chr> <dbl> <dbl> <dbl>
1 eGARCH -3.94 -3.91 0.0281
2 gjrGARCH -3.94 -3.91 0.0281