Considere o modelo ARCH(1) dado por:
\[\begin{eqnarray} r_t &=& δ + \epsilon_t \\ \epsilon_t &=& \sigma_t\,z_t, z_t ∼ N(0, 1) \\ \sigma_{t}^2 &=& \bar{\omega}+ \alpha\,\epsilon_{t−1}^2 \\ \end{eqnarray}\]
onde \(\bar{\omega}> 0\) e \(\alpha \ge 0\). Seja o conjunto de informação \(I_{t−1} = \{r_1, r_2, \dots ,r_{t−1} \}\). (a) Explique em palavras por que os parâmetros \(\bar{\omega}\) e \(\alpha\) são restritos ser positivo e não negativo, respectivamente. (b) Explique em palavras como o modelo acima permite clusters de volatilidade, que é um fato empı́rico estilizado de séries financeira. (c) Cite dois fatos estilizados de séries temporais financeiras que não são capturados pelo modelo acima. (d) Explique em palavras a diferença entre variância condicional e incondicional.
(a) Na equação \(\sigma_{t}^2 = \bar{\omega}+ \alpha\,\epsilon_{t−1}^2\) acima, como a variância \(\sigma_{t}^2\) tem que ser positiva, então o coeficiente \(\alpha\) e \(\bar{\omega}\) são tais que \(\alpha\ge 0\) e \(\bar{\omega} > 0\).
(b) O modelo ARCH(1), permite modelarmos tanto a média quanto a variância condicional (volatilidade). Com os modelos ARCH, além de modelarmos a variância que é constante no tempo, é modelado a variância que depende do tempo, i..e, a volatilidade. Dessa maneira, quando estimarmos um modelo para uma série temporal com o ARCH de forma adequada, é esperado que os efeitos de cluster sejam capturados pelo modelo. Neste modelo, grandes choques tendem a ser seguidos por outros grandes choques.
(c) O modelo ARCH não captura o efeito de bad news e nem o efeito de alavancagem.
(d) Na variância condicional, a variância depende explicitamente do tempo (dos erros \(\epsilon_t\)). Na variância incodicional a variância não depende do tempo (ou seja, é constante).
Descreva como as FAC e FACP são utilizadas no contexto de modelos da famı́lia ARCH. Em quais etapas do ajuste do modelo elas são úteis?
Para testar a heterocedasticidade condicional de uma série temporal \(y_t\), podemos definir a série dos resíduos \(a_t = y_t - \mu\), onde \(\mu\) é a média \(E(y_t)\) de \(y_t\), e analisar o gráfico da FAC e FACP dos resíduos ao quadrado \(a_t ^2\). Se houver correlação significativa em \(a_t^2\), será notada autocorrelações siginitivas nos gráficos em questão. Se os primeiros m lags da FAC de \(a_t^2\) são iguais a zero, então a heterocedasticidade é incondicional.
Ajuste os modelos da família ARCH vistos em aula, considerando a ordem (1, 1) com as distribuições normal e t-Student para as seguintes séries, iniciando em 2019: (a) log-retornos diários das ações da PETROBRAS; (b) log-retornos diários do IBOVESPA.
Para este exercício, usaremos a série de retornos do IBOVESPA de
01/01/2019
até o dia de hoje (2023-07-16
). O
código abaixo coleta esses dados do Yahoo Finance.
# https://blog.devgenius.io/volatility-modeling-with-r-arch-and-garch-models-11fde2d7ac38
library(rugarch)
library(BatchGetSymbols)
# define datas de início e fim
date_init <- "2019-01-01"
date_end <- "2023-07-16"
#date_end <- Sys.Date()
# coleta dados do IBOVESPA
tickers <- c("^BVSP", "PETR3.SA")
assets <- BatchGetSymbols(tickers=tickers,
first.date=date_init,
last.date=date_end,
type.return="log", # log retorno
freq.data="daily")
assets <- assets[[2]]
Após coletarmos os dados, com frequência diária, realizamos os ajustes necessários para termos a série temporal de interesse:
ibovespa <- assets %>%
filter(ticker=="^BVSP")
pretobras <- assets %>%
filter(ticker=="PETR3.SA")
library(fBasics)
daily_returns_ibovespa <- ibovespa %>%
select(ref.date, ret.closing.prices)
daily_returns_petro <- pretobras %>%
select(ref.date, ret.closing.prices)
# computa resumo estatístico
basicStats(daily_returns_ibovespa$ret.closing.prices)
## X..daily_returns_ibovespa.ret.closing.prices
## nobs 1127.000000
## NAs 1.000000
## Minimum -0.159930
## Maximum 0.130223
## 1. Quartile -0.007560
## 3. Quartile 0.009230
## Mean 0.000228
## Median 0.000613
## Sum 0.257241
## SE Mean 0.000518
## LCL Mean -0.000787
## UCL Mean 0.001244
## Variance 0.000302
## Stdev 0.017371
## Skewness -1.477255
## Kurtosis 18.960888
basicStats(daily_returns_petro$ret.closing.prices)
## X..daily_returns_petro.ret.closing.prices
## nobs 1127.000000
## NAs 1.000000
## Minimum -0.352054
## Maximum 0.205024
## 1. Quartile -0.012843
## 3. Quartile 0.015328
## Mean 0.000178
## Median 0.001008
## Sum 0.199988
## SE Mean 0.000940
## LCL Mean -0.001666
## UCL Mean 0.002021
## Variance 0.000994
## Stdev 0.031529
## Skewness -2.158211
## Kurtosis 22.945397
date <- daily_returns_ibovespa %>%
select(ref.date) %>%
rename(date=ref.date) %>%
slice(-1)
daily_returns_ibovespa <- daily_returns_ibovespa %>%
select(ret.closing.prices) %>%
slice(-1)
daily_returns_petro <- daily_returns_petro %>%
select(ret.closing.prices) %>%
slice(-1)
daily_returns_ibovespa <- as.ts(daily_returns_ibovespa)
daily_returns_petro <- as.ts(daily_returns_petro)
(a)
Vamos estimar um modelo ARCH(1) para a série de retornos do PETROBRAS:
arch.spec.student <- ugarchspec(variance.model=list(model="sGARCH",
garchOrder=c(1, 1)),
mean.model=list(armaOrder=c(0, 0),
include.mean=FALSE),
distribution.model="std")
arch.fit.petro.student <- ugarchfit(spec=arch.spec.student,
data=daily_returns_petro)
arch.spec.normal <- ugarchspec(variance.model=list(model="sGARCH",
garchOrder=c(1, 1)),
mean.model=list(armaOrder=c(0, 0),
include.mean=FALSE),
distribution.model="norm")
arch.fit.petro.normal <- ugarchfit(spec=arch.spec.normal,
data=daily_returns_petro)
#infocriteria(arch.fit.petro.normal)
#infocriteria(arch.fit.petro.student)
#various plots for fitted values
options(repr.plot.width=15, repr.plot.height=15)
plot(arch.fit.petro.student, which="all")
##
## please wait...calculating quantiles...
plot(arch.fit.petro.normal, which="all")
##
## please wait...calculating quantiles...
Agora vamos estimar um modelo GARCH(1, 1) para a mesma série de retornos:
?ugarchspec
garch.spec.student <- ugarchspec(variance.model=list(model="sGARCH",
garchOrder=c(1, 1)),
mean.model=list(armaOrder=c(1, 1),
include.mean=TRUE),
distribution.model="std")
garch.fit.petro.student <- ugarchfit(spec=garch.spec.student,
data=daily_returns_petro)
garch.spec.normal <- ugarchspec(variance.model=list(model="sGARCH",
garchOrder=c(1, 1)),
mean.model=list(armaOrder=c(1, 1),
include.mean=TRUE),
distribution.model="norm")
garch.fit.petro.normal <- ugarchfit(spec=garch.spec.normal,
data=daily_returns_petro)
garch.fit.petro.student
##
## *---------------------------------*
## * 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|)
## mu 0.001311 0.000586 2.23763 0.025245
## ar1 0.292920 0.343688 0.85228 0.394056
## ma1 -0.357063 0.335164 -1.06534 0.286724
## omega 0.000044 0.000017 2.66297 0.007745
## alpha1 0.056249 0.018361 3.06341 0.002188
## beta1 0.884570 0.034329 25.76710 0.000000
## shape 4.030480 0.485341 8.30443 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.001311 0.000588 2.22840 0.025854
## ar1 0.292920 0.312020 0.93879 0.347840
## ma1 -0.357063 0.299420 -1.19251 0.233060
## omega 0.000044 0.000022 1.99616 0.045917
## alpha1 0.056249 0.032565 1.72727 0.084119
## beta1 0.884570 0.051421 17.20243 0.000000
## shape 4.030480 0.518797 7.76889 0.000000
##
## LogLikelihood : 2579.913
##
## Information Criteria
## ------------------------------------
##
## Akaike -4.5700
## Bayes -4.5388
## Shibata -4.5701
## Hannan-Quinn -4.5582
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 2.860 0.0908
## Lag[2*(p+q)+(p+q)-1][5] 3.226 0.3375
## Lag[4*(p+q)+(p+q)-1][9] 5.521 0.3429
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 11.36 0.0007516
## Lag[2*(p+q)+(p+q)-1][5] 11.94 0.0028803
## Lag[4*(p+q)+(p+q)-1][9] 16.26 0.0017624
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.8741 0.500 2.000 0.3498
## ARCH Lag[5] 0.9358 1.440 1.667 0.7521
## ARCH Lag[7] 1.4743 2.315 1.543 0.8265
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 2.4588
## Individual Statistics:
## mu 0.06184
## ar1 0.31610
## ma1 0.31821
## omega 0.40339
## alpha1 0.13289
## beta1 0.24155
## shape 0.08329
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.69 1.9 2.35
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 0.02844 9.773e-01
## Negative Sign Bias 4.62833 4.116e-06 ***
## Positive Sign Bias 0.42395 6.717e-01
## Joint Effect 25.50823 1.209e-05 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 14.67 0.7430
## 2 30 25.62 0.6459
## 3 40 39.19 0.4615
## 4 50 57.04 0.2011
##
##
## Elapsed time : 0.1909289
garch.fit.petro.normal
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(1,0,1)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000316 0.000040 7.9634 0.000000
## ar1 0.974334 0.004101 237.5989 0.000000
## ma1 -0.996989 0.000084 -11867.1602 0.000000
## omega 0.000161 0.000057 2.8472 0.004411
## alpha1 0.221226 0.047444 4.6629 0.000003
## beta1 0.585829 0.106961 5.4770 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000316 0.000077 4.09073 0.000043
## ar1 0.974334 0.005387 180.85143 0.000000
## ma1 -0.996989 0.000108 -9190.57386 0.000000
## omega 0.000161 0.000162 0.99395 0.320248
## alpha1 0.221226 0.175305 1.26195 0.206966
## beta1 0.585829 0.334184 1.75301 0.079599
##
## LogLikelihood : 2497.734
##
## Information Criteria
## ------------------------------------
##
## Akaike -4.4258
## Bayes -4.3990
## Shibata -4.4259
## Hannan-Quinn -4.4157
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1257 0.7229
## Lag[2*(p+q)+(p+q)-1][5] 0.3379 1.0000
## Lag[4*(p+q)+(p+q)-1][9] 2.3729 0.9625
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 1.645 0.1996
## Lag[2*(p+q)+(p+q)-1][5] 2.884 0.4287
## Lag[4*(p+q)+(p+q)-1][9] 5.270 0.3909
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.2652 0.500 2.000 0.6065
## ARCH Lag[5] 0.5016 1.440 1.667 0.8832
## ARCH Lag[7] 1.3185 2.315 1.543 0.8569
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 2.6408
## Individual Statistics:
## mu 0.07510
## ar1 0.13897
## ma1 0.21685
## omega 0.86266
## alpha1 0.09378
## beta1 0.40201
##
## 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.24125 0.21477
## Negative Sign Bias 1.47748 0.13983
## Positive Sign Bias 0.04178 0.96668
## Joint Effect 8.28416 0.04049 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 57.80 8.575e-06
## 2 30 72.35 1.437e-05
## 3 40 91.83 3.773e-06
## 4 50 99.31 2.852e-05
##
##
## Elapsed time : 0.1298473
#infocriteria(garch.fit.petro.normal)
#infocriteria(garch.fit.petro.student)
options(repr.plot.width=15, repr.plot.height=15)
plot(garch.fit.petro.student, which="all")
##
## please wait...calculating quantiles...
plot(garch.fit.petro.normal, which="all")
##
## please wait...calculating quantiles...
Agora vamos estimar um modelo GARCH(1, 1) na média para a mesma série de retornos:
#https://search.r-project.org/CRAN/refmans/rugarch/html/ugarchspec-methods.html
#?ugarchspec
garch_mean.spec.student <- ugarchspec(variance.model=list(model="sGARCH",
garchOrder=c(1, 1)),
mean.model=list(armaOrder=c(1, 1),
include.mean=TRUE,
archm=TRUE),
distribution.model="std")
garch_mean.fit.petro.student <- ugarchfit(spec=garch_mean.spec.student,
data=daily_returns_petro)
garch_mean.spec.normal <- ugarchspec(variance.model=list(model="sGARCH",
garchOrder=c(1, 1)),
mean.model=list(armaOrder=c(1, 1), archm=TRUE,
include.mean=TRUE),
distribution.model="norm")
garch_mean.fit.petro.normal <- ugarchfit(spec=garch_mean.spec.normal,
data=daily_returns_petro)
garch_mean.fit.petro.student
##
## *---------------------------------*
## * 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|)
## mu -0.004075 0.003645 -1.11796 0.263586
## ar1 0.259123 0.348814 0.74287 0.457561
## ma1 -0.324036 0.341256 -0.94954 0.342347
## archm 0.212071 0.141680 1.49683 0.134437
## omega 0.000043 0.000017 2.61664 0.008880
## alpha1 0.053885 0.018174 2.96502 0.003027
## beta1 0.887367 0.034600 25.64669 0.000000
## shape 4.018916 0.479258 8.38571 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu -0.004075 0.003652 -1.11576 0.264524
## ar1 0.259123 0.315947 0.82015 0.412132
## ma1 -0.324036 0.304790 -1.06314 0.287717
## archm 0.212071 0.144380 1.46884 0.141877
## omega 0.000043 0.000023 1.87268 0.061112
## alpha1 0.053885 0.033349 1.61580 0.106138
## beta1 0.887367 0.053904 16.46204 0.000000
## shape 4.018916 0.503986 7.97426 0.000000
##
## LogLikelihood : 2581.111
##
## Information Criteria
## ------------------------------------
##
## Akaike -4.5704
## Bayes -4.5346
## Shibata -4.5705
## Hannan-Quinn -4.5569
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 3.405 0.06501
## Lag[2*(p+q)+(p+q)-1][5] 3.819 0.10348
## Lag[4*(p+q)+(p+q)-1][9] 6.257 0.21694
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 11.52 0.0006901
## Lag[2*(p+q)+(p+q)-1][5] 12.37 0.0022275
## Lag[4*(p+q)+(p+q)-1][9] 16.66 0.0014044
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 1.370 0.500 2.000 0.2419
## ARCH Lag[5] 1.425 1.440 1.667 0.6123
## ARCH Lag[7] 2.128 2.315 1.543 0.6902
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 2.4703
## Individual Statistics:
## mu 0.02574
## ar1 0.38442
## ma1 0.39261
## archm 0.02052
## omega 0.43834
## alpha1 0.11457
## beta1 0.25353
## shape 0.08474
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.89 2.11 2.59
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 0.05121 9.592e-01
## Negative Sign Bias 4.52965 6.540e-06 ***
## Positive Sign Bias 0.49878 6.180e-01
## Joint Effect 24.50960 1.955e-05 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 17.48 0.5573
## 2 30 29.93 0.4174
## 3 40 32.93 0.7420
## 4 50 51.98 0.3588
##
##
## Elapsed time : 0.4094653
garch_mean.fit.petro.normal
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(1,0,1)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.002769 0.000487 5.6833 0.000000
## ar1 0.971027 0.005059 191.9483 0.000000
## ma1 -0.998234 0.000011 -94681.3615 0.000000
## archm -0.091826 0.017424 -5.2700 0.000000
## omega 0.000168 0.000059 2.8542 0.004315
## alpha1 0.230121 0.048705 4.7248 0.000002
## beta1 0.569050 0.110407 5.1541 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.002769 0.001014 2.7311e+00 0.006313
## ar1 0.971027 0.006241 1.5558e+02 0.000000
## ma1 -0.998234 0.000013 -7.9130e+04 0.000000
## archm -0.091826 0.034397 -2.6696e+00 0.007595
## omega 0.000168 0.000171 9.8019e-01 0.326993
## alpha1 0.230121 0.179488 1.2821e+00 0.199808
## beta1 0.569050 0.348618 1.6323e+00 0.102616
##
## LogLikelihood : 2499.047
##
## Information Criteria
## ------------------------------------
##
## Akaike -4.4264
## Bayes -4.3951
## Shibata -4.4264
## Hannan-Quinn -4.4146
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1326 0.7158
## Lag[2*(p+q)+(p+q)-1][5] 0.3451 1.0000
## Lag[4*(p+q)+(p+q)-1][9] 2.4923 0.9524
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 1.461 0.2268
## Lag[2*(p+q)+(p+q)-1][5] 2.679 0.4689
## Lag[4*(p+q)+(p+q)-1][9] 5.092 0.4160
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.3282 0.500 2.000 0.5667
## ARCH Lag[5] 0.5624 1.440 1.667 0.8651
## ARCH Lag[7] 1.4646 2.315 1.543 0.8285
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 3.4351
## Individual Statistics:
## mu 0.06456
## ar1 0.15071
## ma1 0.33247
## archm 0.06522
## omega 0.66292
## alpha1 0.10889
## beta1 0.31619
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.69 1.9 2.35
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.270 0.20432
## Negative Sign Bias 1.441 0.14990
## Positive Sign Bias 0.094 0.92513
## Joint Effect 8.461 0.03739 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 58.37 6.988e-06
## 2 30 69.52 3.522e-05
## 3 40 80.82 9.523e-05
## 4 50 97.36 4.827e-05
##
##
## Elapsed time : 0.4623718
#infocriteria(garch_mean.fit.petro.normal)
#infocriteria(garch_mean.fit.petro.student)
options(repr.plot.width=15, repr.plot.height=15)
plot(garch_mean.fit.petro.student, which="all")
##
## please wait...calculating quantiles...
plot(garch_mean.fit.petro.normal, which="all")
##
## please wait...calculating quantiles...
Agora vamos estimar um modelo EGARCH(1, 1) para a mesma série de retornos:
#https://search.r-project.org/CRAN/refmans/rugarch/html/ugarchspec-methods.html
#?ugarchspec
egarch.spec.student <- ugarchspec(variance.model=list(model="eGARCH",
garchOrder=c(1, 1)),
mean.model=list(armaOrder=c(1, 1),
include.mean=TRUE),
distribution.model="std")
egarch.spec.normal <- ugarchspec(variance.model=list(model="eGARCH",
garchOrder=c(1, 1)),
mean.model=list(armaOrder=c(1, 1),
include.mean=TRUE),
distribution.model="norm")
egarch.fit.petro.student <- ugarchfit(spec=garch_mean.spec.student,
data=daily_returns_petro)
egarch.fit.petro.normal <- ugarchfit(spec=egarch.spec.normal,
data=daily_returns_petro)
egarch.fit.petro.student
##
## *---------------------------------*
## * 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|)
## mu -0.004075 0.003645 -1.11796 0.263586
## ar1 0.259123 0.348814 0.74287 0.457561
## ma1 -0.324036 0.341256 -0.94954 0.342347
## archm 0.212071 0.141680 1.49683 0.134437
## omega 0.000043 0.000017 2.61664 0.008880
## alpha1 0.053885 0.018174 2.96502 0.003027
## beta1 0.887367 0.034600 25.64669 0.000000
## shape 4.018916 0.479258 8.38571 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu -0.004075 0.003652 -1.11576 0.264524
## ar1 0.259123 0.315947 0.82015 0.412132
## ma1 -0.324036 0.304790 -1.06314 0.287717
## archm 0.212071 0.144380 1.46884 0.141877
## omega 0.000043 0.000023 1.87268 0.061112
## alpha1 0.053885 0.033349 1.61580 0.106138
## beta1 0.887367 0.053904 16.46204 0.000000
## shape 4.018916 0.503986 7.97426 0.000000
##
## LogLikelihood : 2581.111
##
## Information Criteria
## ------------------------------------
##
## Akaike -4.5704
## Bayes -4.5346
## Shibata -4.5705
## Hannan-Quinn -4.5569
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 3.405 0.06501
## Lag[2*(p+q)+(p+q)-1][5] 3.819 0.10348
## Lag[4*(p+q)+(p+q)-1][9] 6.257 0.21694
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 11.52 0.0006901
## Lag[2*(p+q)+(p+q)-1][5] 12.37 0.0022275
## Lag[4*(p+q)+(p+q)-1][9] 16.66 0.0014044
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 1.370 0.500 2.000 0.2419
## ARCH Lag[5] 1.425 1.440 1.667 0.6123
## ARCH Lag[7] 2.128 2.315 1.543 0.6902
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 2.4703
## Individual Statistics:
## mu 0.02574
## ar1 0.38442
## ma1 0.39261
## archm 0.02052
## omega 0.43834
## alpha1 0.11457
## beta1 0.25353
## shape 0.08474
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.89 2.11 2.59
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 0.05121 9.592e-01
## Negative Sign Bias 4.52965 6.540e-06 ***
## Positive Sign Bias 0.49878 6.180e-01
## Joint Effect 24.50960 1.955e-05 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 17.48 0.5573
## 2 30 29.93 0.4174
## 3 40 32.93 0.7420
## 4 50 51.98 0.3588
##
##
## Elapsed time : 0.350457
egarch.fit.petro.normal
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : eGARCH(1,1)
## Mean Model : ARFIMA(1,0,1)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu -0.000014 0.000711 -0.019857 0.984158
## ar1 -0.195928 0.075219 -2.604770 0.009194
## ma1 0.155129 0.075866 2.044774 0.040877
## omega -0.448190 0.148522 -3.017665 0.002547
## alpha1 -0.080069 0.021106 -3.793707 0.000148
## beta1 0.935537 0.020610 45.392309 0.000000
## gamma1 0.241387 0.039149 6.165803 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu -0.000014 0.000691 -0.020411 0.983716
## ar1 -0.195928 0.019989 -9.801953 0.000000
## ma1 0.155129 0.021421 7.242059 0.000000
## omega -0.448190 0.260853 -1.718170 0.085766
## alpha1 -0.080069 0.048542 -1.649467 0.099052
## beta1 0.935537 0.037395 25.017950 0.000000
## gamma1 0.241387 0.102561 2.353583 0.018593
##
## LogLikelihood : 2492.37
##
## Information Criteria
## ------------------------------------
##
## Akaike -4.4145
## Bayes -4.3833
## Shibata -4.4146
## Hannan-Quinn -4.4027
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.6987 0.4032
## Lag[2*(p+q)+(p+q)-1][5] 1.3854 0.9992
## Lag[4*(p+q)+(p+q)-1][9] 3.0713 0.8795
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 3.859 0.04949
## Lag[2*(p+q)+(p+q)-1][5] 5.034 0.15041
## Lag[4*(p+q)+(p+q)-1][9] 7.039 0.19596
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.09861 0.500 2.000 0.7535
## ARCH Lag[5] 0.37109 1.440 1.667 0.9208
## ARCH Lag[7] 0.57260 2.315 1.543 0.9714
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 2.2336
## Individual Statistics:
## mu 0.08429
## ar1 0.03083
## ma1 0.02998
## omega 0.46743
## alpha1 0.64168
## beta1 0.53073
## gamma1 0.67791
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.69 1.9 2.35
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 0.1055 0.916018
## Negative Sign Bias 2.6190 0.008937 ***
## Positive Sign Bias 0.2196 0.826208
## Joint Effect 8.6543 0.034258 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 62.70 1.435e-06
## 2 30 75.23 5.658e-06
## 3 40 102.99 1.116e-07
## 4 50 104.20 7.389e-06
##
##
## Elapsed time : 0.09670401
#infocriteria(egarch.fit.petro.normal)
#infocriteria(egarch.fit.petro.student)
options(repr.plot.width=15, repr.plot.height=15)
plot(egarch.fit.petro.student, which="all")
##
## please wait...calculating quantiles...
plot(egarch.fit.petro.normal, which="all")
##
## please wait...calculating quantiles...
Agora vamos estimar um modelo GJR(1, 1) para a mesma série de retornos:
#https://search.r-project.org/CRAN/refmans/rugarch/html/ugarchspec-methods.html
gjr_garch.spec.student <- ugarchspec(variance.model=list(model="gjrGARCH",
garchOrder=c(1, 1)),
mean.model=list(armaOrder=c(1, 1),
include.mean=TRUE),
distribution.model="std")
gjr_garch.spec.normal <- ugarchspec(variance.model=list(model="gjrGARCH",
garchOrder=c(1, 1)),
mean.model=list(armaOrder=c(1, 1),
include.mean=TRUE),
distribution.model="norm")
gjr_garch.fit.petro.student <- ugarchfit(spec=gjr_garch.spec.student,
data=daily_returns_petro)
gjr_garch.fit.petro.normal <- ugarchfit(spec=gjr_garch.spec.normal,
data=daily_returns_petro)
gjr_garch.fit.petro.student
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(1,1)
## Mean Model : ARFIMA(1,0,1)
## Distribution : std
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.001284 0.000587 2.18620 0.028801
## ar1 0.295257 0.341528 0.86452 0.387303
## ma1 -0.358215 0.333203 -1.07506 0.282345
## omega 0.000042 0.000016 2.66882 0.007612
## alpha1 0.027074 0.026182 1.03407 0.301101
## beta1 0.895955 0.033694 26.59062 0.000000
## gamma1 0.034298 0.027526 1.24602 0.212757
## shape 4.035157 0.488622 8.25824 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.001284 0.000587 2.18699 0.028743
## ar1 0.295257 0.305721 0.96577 0.334158
## ma1 -0.358215 0.293708 -1.21963 0.222606
## omega 0.000042 0.000023 1.80943 0.070385
## alpha1 0.027074 0.028700 0.94336 0.345499
## beta1 0.895955 0.052715 16.99611 0.000000
## gamma1 0.034298 0.033215 1.03260 0.301791
## shape 4.035157 0.520241 7.75632 0.000000
##
## LogLikelihood : 2580.599
##
## Information Criteria
## ------------------------------------
##
## Akaike -4.5694
## Bayes -4.5337
## Shibata -4.5695
## Hannan-Quinn -4.5560
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 2.859 0.09086
## Lag[2*(p+q)+(p+q)-1][5] 3.246 0.32701
## Lag[4*(p+q)+(p+q)-1][9] 5.438 0.35932
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 11.13 0.0008516
## Lag[2*(p+q)+(p+q)-1][5] 11.57 0.0036033
## Lag[4*(p+q)+(p+q)-1][9] 15.53 0.0026527
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.6006 0.500 2.000 0.4383
## ARCH Lag[5] 0.6371 1.440 1.667 0.8425
## ARCH Lag[7] 1.1278 2.315 1.543 0.8919
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 2.9259
## Individual Statistics:
## mu 0.08464
## ar1 0.32629
## ma1 0.33046
## omega 0.46329
## alpha1 0.10784
## beta1 0.26787
## gamma1 0.31765
## shape 0.09803
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.89 2.11 2.59
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 0.03635 9.710e-01
## Negative Sign Bias 4.42258 1.070e-05 ***
## Positive Sign Bias 0.62171 5.343e-01
## Joint Effect 23.22492 3.625e-05 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 21.82 0.29355
## 2 30 24.39 0.70944
## 3 40 46.08 0.20270
## 4 50 62.45 0.09384
##
##
## Elapsed time : 0.392061
gjr_garch.fit.petro.normal
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(1,1)
## Mean Model : ARFIMA(1,0,1)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000309 0.000007 4.6042e+01 0.000000
## ar1 0.967970 0.006162 1.5708e+02 0.000000
## ma1 -0.993218 0.000007 -1.3477e+05 0.000000
## omega 0.000192 0.000053 3.6275e+00 0.000286
## alpha1 0.102692 0.043528 2.3592e+00 0.018314
## beta1 0.549100 0.098776 5.5590e+00 0.000000
## gamma1 0.202363 0.067008 3.0200e+00 0.002528
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000309 0.000010 2.9896e+01 0.000000
## ar1 0.967970 0.007131 1.3573e+02 0.000000
## ma1 -0.993218 0.000008 -1.2844e+05 0.000000
## omega 0.000192 0.000156 1.2312e+00 0.218243
## alpha1 0.102692 0.086701 1.1844e+00 0.236240
## beta1 0.549100 0.308675 1.7789e+00 0.075257
## gamma1 0.202363 0.196115 1.0319e+00 0.302137
##
## LogLikelihood : 2503.208
##
## Information Criteria
## ------------------------------------
##
## Akaike -4.4338
## Bayes -4.4025
## Shibata -4.4338
## Hannan-Quinn -4.4220
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1056 0.7452
## Lag[2*(p+q)+(p+q)-1][5] 0.4162 1.0000
## Lag[4*(p+q)+(p+q)-1][9] 2.5849 0.9434
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.9497 0.3298
## Lag[2*(p+q)+(p+q)-1][5] 2.5132 0.5031
## Lag[4*(p+q)+(p+q)-1][9] 3.9484 0.5976
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.4319 0.500 2.000 0.5111
## ARCH Lag[5] 0.5916 1.440 1.667 0.8563
## ARCH Lag[7] 1.1729 2.315 1.543 0.8839
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 2.9393
## Individual Statistics:
## mu 0.07299
## ar1 0.04500
## ma1 0.05489
## omega 1.06895
## alpha1 0.09375
## beta1 0.44229
## gamma1 0.19797
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.69 1.9 2.35
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.3194 0.1873
## Negative Sign Bias 0.7024 0.4826
## Positive Sign Bias 0.6476 0.5173
## Joint Effect 3.6450 0.3024
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 61.21 2.485e-06
## 2 30 77.57 2.612e-06
## 3 40 84.59 3.258e-05
## 4 50 100.11 2.295e-05
##
##
## Elapsed time : 0.4506459
#infocriteria(gjr_garch.fit.petro.normal)
#infocriteria(gjr_garch.fit.petro.student)
options(repr.plot.width=15, repr.plot.height=15)
plot(gjr_garch.fit.petro.student, which="all")
##
## please wait...calculating quantiles...
plot(gjr_garch.fit.petro.normal, which="all")
##
## please wait...calculating quantiles...
(b)
Vamos estimar um modelo ARCH(1) para a série de retornos do IBOVESPA:
arch.fit.ibovespa.student <- ugarchfit(spec=arch.spec.student,
data=daily_returns_ibovespa)
arch.fit.ibovespa.normal <- ugarchfit(spec=arch.spec.normal,
data=daily_returns_ibovespa)
arch.fit.ibovespa.student
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : std
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000010 0.000001 11.5285 0e+00
## alpha1 0.090183 0.007910 11.4011 0e+00
## beta1 0.858689 0.015226 56.3945 0e+00
## shape 9.705862 2.171377 4.4699 8e-06
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000010 0.000002 5.8427 0.0e+00
## alpha1 0.090183 0.007881 11.4428 0.0e+00
## beta1 0.858689 0.015371 55.8644 0.0e+00
## shape 9.705862 2.204339 4.4031 1.1e-05
##
## LogLikelihood : 3235.996
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.7407
## Bayes -5.7228
## Shibata -5.7407
## Hannan-Quinn -5.7339
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 2.468 0.1162
## Lag[2*(p+q)+(p+q)-1][2] 2.504 0.1913
## Lag[4*(p+q)+(p+q)-1][5] 2.781 0.4486
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 2.996e-05 0.9956
## Lag[2*(p+q)+(p+q)-1][5] 2.466e+00 0.5131
## Lag[4*(p+q)+(p+q)-1][9] 8.112e+00 0.1226
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 3.129 0.500 2.000 0.07691
## ARCH Lag[5] 3.230 1.440 1.667 0.25813
## ARCH Lag[7] 3.900 2.315 1.543 0.36127
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 28.9191
## Individual Statistics:
## omega 3.59800
## alpha1 0.10786
## beta1 0.07682
## shape 0.21516
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.07 1.24 1.6
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.9049 0.05705 *
## Negative Sign Bias 1.4880 0.13702
## Positive Sign Bias 0.9758 0.32937
## Joint Effect 10.6071 0.01405 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 30.45 0.04637
## 2 30 41.39 0.06366
## 3 40 52.69 0.07053
## 4 50 71.96 0.01799
##
##
## Elapsed time : 0.08885574
arch.fit.ibovespa.normal
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000011 0.000001 17.027 0
## alpha1 0.099488 0.008527 11.668 0
## beta1 0.846768 0.013390 63.241 0
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## omega 0.000011 0.000002 7.1264 0
## alpha1 0.099488 0.009109 10.9216 0
## beta1 0.846768 0.018584 45.5639 0
##
## LogLikelihood : 3219.56
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.7133
## Bayes -5.6999
## Shibata -5.7133
## Hannan-Quinn -5.7082
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 2.428 0.1192
## Lag[2*(p+q)+(p+q)-1][2] 2.458 0.1969
## Lag[4*(p+q)+(p+q)-1][5] 2.723 0.4599
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.05562 0.8136
## Lag[2*(p+q)+(p+q)-1][5] 1.80704 0.6647
## Lag[4*(p+q)+(p+q)-1][9] 6.75054 0.2210
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 2.258 0.500 2.000 0.1330
## ARCH Lag[5] 2.433 1.440 1.667 0.3832
## ARCH Lag[7] 3.002 2.315 1.543 0.5132
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 27.7992
## Individual Statistics:
## omega 3.84161
## alpha1 0.18667
## beta1 0.05003
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 0.846 1.01 1.35
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.9660 0.04955 **
## Negative Sign Bias 1.2424 0.21436
## Positive Sign Bias 0.8574 0.39141
## Joint Effect 9.8789 0.01962 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 42.81 0.001376
## 2 30 51.14 0.006787
## 3 40 67.82 0.002867
## 4 50 76.58 0.007104
##
##
## Elapsed time : 0.0450387
#infocriteria(arch.fit.ibovespa.normal)
# infocriteria(arch.fit.ibovespa.student)
options(repr.plot.width=15, repr.plot.height=15)
plot(arch.fit.ibovespa.student, which="all")
##
## please wait...calculating quantiles...
plot(arch.fit.ibovespa.normal, which="all")
##
## please wait...calculating quantiles...
Agora vamos estimar um modelo GARCH(1, 1) para a mesma série de retornos:
garch.fit.ibovespa.student <- ugarchfit(spec=garch.spec.student,
data=daily_returns_ibovespa)
garch.fit.ibovespa.normal <- ugarchfit(spec=garch.spec.normal,
data=daily_returns_ibovespa)
garch.fit.ibovespa.student
##
## *---------------------------------*
## * 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|)
## mu 0.000827 0.000345 2.39612 0.016570
## ar1 0.198370 0.474652 0.41793 0.676000
## ma1 -0.262746 0.466525 -0.56320 0.573300
## omega 0.000010 0.000001 10.76541 0.000000
## alpha1 0.089373 0.007751 11.53028 0.000000
## beta1 0.860978 0.015298 56.27867 0.000000
## shape 9.042534 1.910818 4.73228 0.000002
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000827 0.000368 2.24452 0.024799
## ar1 0.198370 0.548261 0.36182 0.717489
## ma1 -0.262746 0.532496 -0.49342 0.621713
## omega 0.000010 0.000002 5.60614 0.000000
## alpha1 0.089373 0.007616 11.73483 0.000000
## beta1 0.860978 0.015000 57.39911 0.000000
## shape 9.042534 1.927403 4.69156 0.000003
##
## LogLikelihood : 3240.71
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.7437
## Bayes -5.7125
## Shibata -5.7438
## Hannan-Quinn -5.7319
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1381 0.7102
## Lag[2*(p+q)+(p+q)-1][5] 0.7675 1.0000
## Lag[4*(p+q)+(p+q)-1][9] 3.4206 0.8171
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.02557 0.87295
## Lag[2*(p+q)+(p+q)-1][5] 2.59420 0.48614
## Lag[4*(p+q)+(p+q)-1][9] 8.57492 0.09917
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 3.546 0.500 2.000 0.05968
## ARCH Lag[5] 3.689 1.440 1.667 0.20421
## ARCH Lag[7] 4.407 2.315 1.543 0.29161
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 28.8759
## Individual Statistics:
## mu 0.21452
## ar1 0.71743
## ma1 0.71578
## omega 3.25372
## alpha1 0.08393
## beta1 0.09917
## shape 0.29527
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.69 1.9 2.35
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.5874 0.1127
## Negative Sign Bias 1.3834 0.1668
## Positive Sign Bias 0.7749 0.4386
## Joint Effect 8.2028 0.0420 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 35.03 0.01385
## 2 30 39.36 0.09488
## 3 40 54.53 0.05037
## 4 50 69.65 0.02780
##
##
## Elapsed time : 0.1552076
garch.fit.ibovespa.normal
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(1,0,1)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000593 0.000368 1.609340 0.10754
## ar1 -0.078177 0.569634 -0.137240 0.89084
## ma1 0.029166 0.570963 0.051081 0.95926
## omega 0.000011 0.000001 17.070067 0.00000
## alpha1 0.099239 0.008454 11.738111 0.00000
## beta1 0.847457 0.013347 63.494305 0.00000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000593 0.000379 1.563222 0.11800
## ar1 -0.078177 0.525973 -0.148632 0.88184
## ma1 0.029166 0.522406 0.055829 0.95548
## omega 0.000011 0.000002 7.072895 0.00000
## alpha1 0.099239 0.009107 10.897277 0.00000
## beta1 0.847457 0.018573 45.627681 0.00000
##
## LogLikelihood : 3221.902
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.7121
## Bayes -5.6853
## Shibata -5.7121
## Hannan-Quinn -5.7020
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.009172 0.9237
## Lag[2*(p+q)+(p+q)-1][5] 0.275775 1.0000
## Lag[4*(p+q)+(p+q)-1][9] 2.832332 0.9144
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1139 0.7357
## Lag[2*(p+q)+(p+q)-1][5] 1.9434 0.6319
## Lag[4*(p+q)+(p+q)-1][9] 6.9702 0.2017
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 2.539 0.500 2.000 0.1111
## ARCH Lag[5] 2.757 1.440 1.667 0.3270
## ARCH Lag[7] 3.304 2.315 1.543 0.4580
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 29.0703
## Individual Statistics:
## mu 0.14977
## ar1 0.44995
## ma1 0.43605
## omega 3.72744
## alpha1 0.17422
## beta1 0.04668
##
## 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.9061 0.05689 *
## Negative Sign Bias 1.1105 0.26704
## Positive Sign Bias 0.8192 0.41285
## Joint Effect 8.8953 0.03072 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 38.05 0.005849
## 2 30 32.12 0.314751
## 3 40 57.73 0.027056
## 4 50 55.08 0.255420
##
##
## Elapsed time : 0.1600547
#infocriteria(garch.fit.petro.normal)
#infocriteria(garch.fit.petro.student)
options(repr.plot.width=15, repr.plot.height=15)
plot(garch.fit.ibovespa.student, which="all")
##
## please wait...calculating quantiles...
plot(garch.fit.ibovespa.normal, which="all")
##
## please wait...calculating quantiles...
Agora vamos estimar um modelo GARCH(1, 1) na média para a mesma série de retornos:
garch_mean.fit.ibovespa.student <- ugarchfit(spec=garch_mean.spec.student,
data=daily_returns_ibovespa)
garch_mean.fit.ibovespa.normal <- ugarchfit(spec=garch_mean.spec.normal,
data=daily_returns_ibovespa)
garch_mean.fit.ibovespa.student
##
## *---------------------------------*
## * 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|)
## mu -0.001586 0.001672 -0.94834 0.342957
## ar1 0.157702 0.464595 0.33944 0.734279
## ma1 -0.223123 0.457978 -0.48719 0.626122
## archm 0.186957 0.126581 1.47698 0.139681
## omega 0.000010 0.000001 11.63437 0.000000
## alpha1 0.089146 0.007508 11.87426 0.000000
## beta1 0.860211 0.015171 56.69924 0.000000
## shape 8.923234 1.888455 4.72515 0.000002
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu -0.001586 0.001423 -1.11456 0.265038
## ar1 0.157702 0.513970 0.30683 0.758972
## ma1 -0.223123 0.499856 -0.44638 0.655326
## archm 0.186957 0.102498 1.82400 0.068152
## omega 0.000010 0.000002 5.96459 0.000000
## alpha1 0.089146 0.007694 11.58718 0.000000
## beta1 0.860211 0.014244 60.39151 0.000000
## shape 8.923234 1.901783 4.69203 0.000003
##
## LogLikelihood : 3241.753
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.7438
## Bayes -5.7081
## Shibata -5.7439
## Hannan-Quinn -5.7303
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.2507 0.6166
## Lag[2*(p+q)+(p+q)-1][5] 0.8707 1.0000
## Lag[4*(p+q)+(p+q)-1][9] 3.7654 0.7447
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.02687 0.86980
## Lag[2*(p+q)+(p+q)-1][5] 3.01767 0.40383
## Lag[4*(p+q)+(p+q)-1][9] 9.20761 0.07366
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 3.916 0.500 2.000 0.04784
## ARCH Lag[5] 4.075 1.440 1.667 0.16729
## ARCH Lag[7] 5.057 2.315 1.543 0.21886
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 30.6893
## Individual Statistics:
## mu 0.25280
## ar1 0.70971
## ma1 0.70767
## archm 0.22265
## omega 3.78975
## alpha1 0.09519
## beta1 0.06909
## shape 0.29715
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.89 2.11 2.59
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.7754 0.07611 *
## Negative Sign Bias 1.1399 0.25456
## Positive Sign Bias 0.9033 0.36654
## Joint Effect 7.8008 0.05031 *
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 34.43 0.01636
## 2 30 42.77 0.04776
## 3 40 54.18 0.05381
## 4 50 55.17 0.25276
##
##
## Elapsed time : 0.3266656
garch_mean.fit.ibovespa.normal
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(1,0,1)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu -0.001638 0.001773 -0.923805 0.35559
## ar1 -0.093618 0.548725 -0.170610 0.86453
## ma1 0.043826 0.550537 0.079606 0.93655
## archm 0.172382 0.133843 1.287936 0.19777
## omega 0.000011 0.000001 16.754822 0.00000
## alpha1 0.100345 0.008623 11.636362 0.00000
## beta1 0.846288 0.013461 62.867954 0.00000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu -0.001638 0.001647 -0.994340 0.32006
## ar1 -0.093618 0.493724 -0.189616 0.84961
## ma1 0.043826 0.490957 0.089267 0.92887
## archm 0.172382 0.118415 1.455737 0.14547
## omega 0.000011 0.000002 6.914187 0.00000
## alpha1 0.100345 0.009282 10.811262 0.00000
## beta1 0.846288 0.018700 45.257048 0.00000
##
## LogLikelihood : 3222.726
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.7118
## Bayes -5.6805
## Shibata -5.7118
## Hannan-Quinn -5.7000
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.0003374 0.9853
## Lag[2*(p+q)+(p+q)-1][5] 0.2517348 1.0000
## Lag[4*(p+q)+(p+q)-1][9] 2.9970046 0.8911
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1566 0.6923
## Lag[2*(p+q)+(p+q)-1][5] 2.1460 0.5843
## Lag[4*(p+q)+(p+q)-1][9] 7.1573 0.1863
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 2.651 0.500 2.000 0.1035
## ARCH Lag[5] 2.888 1.440 1.667 0.3065
## ARCH Lag[7] 3.598 2.315 1.543 0.4082
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 28.6174
## Individual Statistics:
## mu 0.17025
## ar1 0.44327
## ma1 0.42979
## archm 0.14473
## omega 3.87709
## alpha1 0.18647
## beta1 0.05149
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.69 1.9 2.35
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 2.1144 0.03470 **
## Negative Sign Bias 0.8287 0.40744
## Positive Sign Bias 0.9460 0.34436
## Joint Effect 8.6059 0.03502 **
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 39.29 0.004047
## 2 30 40.70 0.073180
## 3 40 56.81 0.032535
## 4 50 73.11 0.014366
##
##
## Elapsed time : 0.4497621
#infocriteria(garch_mean.fit.ibovespa.normal)
#infocriteria(garch_mean.fit.ibovespa.student)
options(repr.plot.width=15, repr.plot.height=15)
plot(garch_mean.fit.ibovespa.student, which="all")
##
## please wait...calculating quantiles...
plot(garch_mean.fit.ibovespa.normal, which="all")
##
## please wait...calculating quantiles...
Agora vamos estimar um modelo EGARCH(1, 1) para a mesma série de retornos:
egarch.fit.ibovespa.student <- ugarchfit(spec=garch_mean.spec.student,
data=daily_returns_ibovespa)
egarch.fit.ibovespa.normal <- ugarchfit(spec=egarch.spec.normal,
data=daily_returns_ibovespa)
egarch.fit.ibovespa.student
##
## *---------------------------------*
## * 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|)
## mu -0.001586 0.001672 -0.94834 0.342957
## ar1 0.157702 0.464595 0.33944 0.734279
## ma1 -0.223123 0.457978 -0.48719 0.626122
## archm 0.186957 0.126581 1.47698 0.139681
## omega 0.000010 0.000001 11.63437 0.000000
## alpha1 0.089146 0.007508 11.87426 0.000000
## beta1 0.860211 0.015171 56.69924 0.000000
## shape 8.923234 1.888455 4.72515 0.000002
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu -0.001586 0.001423 -1.11456 0.265038
## ar1 0.157702 0.513970 0.30683 0.758972
## ma1 -0.223123 0.499856 -0.44638 0.655326
## archm 0.186957 0.102498 1.82400 0.068152
## omega 0.000010 0.000002 5.96459 0.000000
## alpha1 0.089146 0.007694 11.58718 0.000000
## beta1 0.860211 0.014244 60.39151 0.000000
## shape 8.923234 1.901783 4.69203 0.000003
##
## LogLikelihood : 3241.753
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.7438
## Bayes -5.7081
## Shibata -5.7439
## Hannan-Quinn -5.7303
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.2507 0.6166
## Lag[2*(p+q)+(p+q)-1][5] 0.8707 1.0000
## Lag[4*(p+q)+(p+q)-1][9] 3.7654 0.7447
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.02687 0.86980
## Lag[2*(p+q)+(p+q)-1][5] 3.01767 0.40383
## Lag[4*(p+q)+(p+q)-1][9] 9.20761 0.07366
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 3.916 0.500 2.000 0.04784
## ARCH Lag[5] 4.075 1.440 1.667 0.16729
## ARCH Lag[7] 5.057 2.315 1.543 0.21886
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 30.6893
## Individual Statistics:
## mu 0.25280
## ar1 0.70971
## ma1 0.70767
## archm 0.22265
## omega 3.78975
## alpha1 0.09519
## beta1 0.06909
## shape 0.29715
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.89 2.11 2.59
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.7754 0.07611 *
## Negative Sign Bias 1.1399 0.25456
## Positive Sign Bias 0.9033 0.36654
## Joint Effect 7.8008 0.05031 *
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 34.43 0.01636
## 2 30 42.77 0.04776
## 3 40 54.18 0.05381
## 4 50 55.17 0.25276
##
##
## Elapsed time : 0.3187859
egarch.fit.ibovespa.normal
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : eGARCH(1,1)
## Mean Model : ARFIMA(1,0,1)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.00034 0.000306 1.1114 0.266412
## ar1 -0.14422 0.082208 -1.7543 0.079372
## ma1 0.10715 0.085095 1.2591 0.207979
## omega -0.33876 0.091595 -3.6984 0.000217
## alpha1 -0.10933 0.009691 -11.2821 0.000000
## beta1 0.96032 0.010755 89.2873 0.000000
## gamma1 0.15835 0.020253 7.8185 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.00034 0.000614 0.55339 0.579996
## ar1 -0.14422 0.025690 -5.61399 0.000000
## ma1 0.10715 0.044238 2.42204 0.015434
## omega -0.33876 0.238788 -1.41866 0.155998
## alpha1 -0.10933 0.062290 -1.75523 0.079220
## beta1 0.96032 0.028210 34.04159 0.000000
## gamma1 0.15835 0.053522 2.95853 0.003091
##
## LogLikelihood : 3235.394
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.7343
## Bayes -5.7030
## Shibata -5.7343
## Hannan-Quinn -5.7225
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1366 0.7117
## Lag[2*(p+q)+(p+q)-1][5] 0.3200 1.0000
## Lag[4*(p+q)+(p+q)-1][9] 2.9334 0.9005
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.4042 0.5250
## Lag[2*(p+q)+(p+q)-1][5] 1.8024 0.6658
## Lag[4*(p+q)+(p+q)-1][9] 3.9698 0.5940
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.9258 0.500 2.000 0.3360
## ARCH Lag[5] 1.1024 1.440 1.667 0.7028
## ARCH Lag[7] 2.0946 2.315 1.543 0.6973
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 1.4241
## Individual Statistics:
## mu 0.2078
## ar1 0.3232
## ma1 0.3204
## omega 0.1177
## alpha1 0.3979
## beta1 0.1072
## gamma1 0.3494
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.69 1.9 2.35
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.6875 0.09178 *
## Negative Sign Bias 0.8107 0.41774
## Positive Sign Bias 1.5273 0.12697
## Joint Effect 5.7286 0.12559
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 37.13 0.007652
## 2 30 55.08 0.002423
## 3 40 66.54 0.003893
## 4 50 82.17 0.002092
##
##
## Elapsed time : 0.1364033
#infocriteria(egarch.fit.ibovespa.normal)
#infocriteria(egarch.fit.ibovespa.student)
options(repr.plot.width=15, repr.plot.height=15)
plot(egarch.fit.ibovespa.student, which="all")
##
## please wait...calculating quantiles...
plot(egarch.fit.ibovespa.normal, which="all")
##
## please wait...calculating quantiles...
### GRJ - GARCH
Agora vamos estimar um modelo GJR(1, 1) para a mesma série de retornos:
gjr_garch.fit.ibovespa.student <- ugarchfit(spec=gjr_garch.spec.student,
data=daily_returns_ibovespa)
gjr_garch.fit.ibovespa.normal <- ugarchfit(spec=gjr_garch.spec.normal,
data=daily_returns_ibovespa)
gjr_garch.fit.ibovespa.student
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(1,1)
## Mean Model : ARFIMA(1,0,1)
## Distribution : std
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000640 0.000347 1.84401 0.065181
## ar1 0.071072 0.505815 0.14051 0.888256
## ma1 -0.133450 0.501489 -0.26611 0.790156
## omega 0.000009 0.000000 28.10461 0.000000
## alpha1 0.006819 0.009146 0.74550 0.455968
## beta1 0.888260 0.011303 78.58341 0.000000
## gamma1 0.107079 0.025805 4.14963 0.000033
## shape 9.717963 2.252323 4.31464 0.000016
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000640 0.000363 1.76401 0.077730
## ar1 0.071072 0.581145 0.12230 0.902664
## ma1 -0.133450 0.569134 -0.23448 0.814613
## omega 0.000009 0.000000 21.83736 0.000000
## alpha1 0.006819 0.012991 0.52486 0.599681
## beta1 0.888260 0.011268 78.83337 0.000000
## gamma1 0.107079 0.038494 2.78173 0.005407
## shape 9.717963 2.457093 3.95506 0.000077
##
## LogLikelihood : 3247.943
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.7548
## Bayes -5.7191
## Shibata -5.7549
## Hannan-Quinn -5.7413
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.2539 0.6143
## Lag[2*(p+q)+(p+q)-1][5] 0.7190 1.0000
## Lag[4*(p+q)+(p+q)-1][9] 3.2792 0.8439
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.4416 0.5063
## Lag[2*(p+q)+(p+q)-1][5] 1.2642 0.7976
## Lag[4*(p+q)+(p+q)-1][9] 4.6608 0.4809
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.9417 0.500 2.000 0.3318
## ARCH Lag[5] 1.2083 1.440 1.667 0.6723
## ARCH Lag[7] 1.9614 2.315 1.543 0.7255
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 31.4394
## Individual Statistics:
## mu 0.1399
## ar1 0.6440
## ma1 0.6444
## omega 5.8922
## alpha1 0.1283
## beta1 0.1166
## gamma1 0.1170
## shape 0.2329
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.89 2.11 2.59
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.7679 0.07735 *
## Negative Sign Bias 0.5091 0.61077
## Positive Sign Bias 1.0454 0.29606
## Joint Effect 5.1285 0.16262
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 31.09 0.03949
## 2 30 48.37 0.01345
## 3 40 51.76 0.08292
## 4 50 65.83 0.05450
##
##
## Elapsed time : 0.4811046
gjr_garch.fit.ibovespa.normal
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(1,1)
## Mean Model : ARFIMA(1,0,1)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000331 0.000365 0.90727 0.36426
## ar1 -0.165422 0.554349 -0.29841 0.76539
## ma1 0.116494 0.557814 0.20884 0.83457
## omega 0.000010 0.000000 71.80858 0.00000
## alpha1 0.002120 0.005993 0.35376 0.72352
## beta1 0.885559 0.009034 98.02200 0.00000
## gamma1 0.120219 0.022070 5.44727 0.00000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000331 0.000375 0.88297 0.377250
## ar1 -0.165422 0.538402 -0.30725 0.758656
## ma1 0.116494 0.537819 0.21660 0.828517
## omega 0.000010 0.000000 53.07470 0.000000
## alpha1 0.002120 0.009628 0.22020 0.825713
## beta1 0.885559 0.012273 72.15713 0.000000
## gamma1 0.120219 0.043826 2.74312 0.006086
##
## LogLikelihood : 3232.897
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.7298
## Bayes -5.6986
## Shibata -5.7299
## Hannan-Quinn -5.7180
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.01998 0.8876
## Lag[2*(p+q)+(p+q)-1][5] 0.25395 1.0000
## Lag[4*(p+q)+(p+q)-1][9] 2.77831 0.9214
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.5209 0.4705
## Lag[2*(p+q)+(p+q)-1][5] 1.1659 0.8211
## Lag[4*(p+q)+(p+q)-1][9] 4.1426 0.5649
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.6876 0.500 2.000 0.4070
## ARCH Lag[5] 0.9503 1.440 1.667 0.7477
## ARCH Lag[7] 1.6744 2.315 1.543 0.7858
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 29.3038
## Individual Statistics:
## mu 0.15135
## ar1 0.39572
## ma1 0.38654
## omega 7.69807
## alpha1 0.15553
## beta1 0.07812
## gamma1 0.18918
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.69 1.9 2.35
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.9608 0.05015 *
## Negative Sign Bias 0.3546 0.72298
## Positive Sign Bias 1.1525 0.24937
## Joint Effect 5.6000 0.13278
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 32.58 0.0268689
## 2 30 59.29 0.0007557
## 3 40 48.64 0.1386502
## 4 50 74.71 0.0104340
##
##
## Elapsed time : 0.2701793
#infocriteria(gjr_garch.fit.ibovespa.normal)
#infocriteria(gjr_garch.fit.ibovespa.student)
options(repr.plot.width=15, repr.plot.height=15)
plot(gjr_garch.fit.ibovespa.student, which="all")
##
## please wait...calculating quantiles...
plot(gjr_garch.fit.ibovespa.normal, which="all")
##
## please wait...calculating quantiles...
Para os modelos ajustados acima, calcule os coeficientes de persistência e half-life e interprete os resultados.
O código abaixo calcula os coeficientes de persistência e half-life para os modelos da questão anterior.
Coeficiente de persistência para cada modelo usado na questão anterior para os retornos da PETROBRAS:
paste("arch.normal:", persistence(arch.fit.petro.normal))
## [1] "arch.normal: 0.821035593484168"
paste("arch.student:", persistence(arch.fit.petro.student))
## [1] "arch.student: 0.938836823458074"
paste("garch.normal:", persistence(garch.fit.petro.normal))
## [1] "garch.normal: 0.807054893047294"
paste("garch.student:", persistence(garch.fit.petro.student))
## [1] "garch.student: 0.940818454389866"
paste("garch-m.normal:", persistence(garch_mean.fit.petro.normal))
## [1] "garch-m.normal: 0.799171182563419"
paste("garch-m.student:", persistence(garch_mean.fit.petro.student))
## [1] "garch-m.student: 0.941251868765044"
paste("egarch.normal:", persistence(egarch.fit.petro.normal))
## [1] "egarch.normal: 0.935536592621902"
paste("egarch.student:", persistence(egarch.fit.petro.student))
## [1] "egarch.student: 0.941251868765044"
paste("gjr_garch.normal:", persistence(gjr_garch.fit.petro.normal))
## [1] "gjr_garch.normal: 0.752973689378903"
paste("gjr_garch.student:", persistence(gjr_garch.fit.petro.student))
## [1] "gjr_garch.student: 0.940177896725856"
Os valores acima indicam que haverá maior pesistência dos choques no
caso de usarmos o modelo EGARCH(1, 1) com distribuição de t-Studentpar a
a série de retorno em questão (egarch.student
). Ou seja,
escolhendo estemodelo haverá uma maior persistência da volatilidade.
Por outro lado, escolhendo o GJR(1, 1) com distribuição normal
(gjr_garch.normal
) haverá uma menor persistência da
volatilidade.
Half-life:
Half-time para cada modelo usado na questão anterior para os retornos da PETROBRAS:
paste("arch.normal:", halflife(arch.fit.petro.normal))
## [1] "arch.normal: 3.51514448095383"
paste("arch.student:", halflife(arch.fit.petro.student))
## [1] "arch.student: 10.982534200381"
paste("garch.normal:", halflife(garch.fit.petro.normal))
## [1] "garch.normal: 3.23351169110512"
paste("garch.student:", halflife(garch.fit.petro.student))
## [1] "garch.student: 11.3621211201249"
paste("garch-m.normal:", halflife(garch_mean.fit.petro.normal))
## [1] "garch-m.normal: 3.09192095628646"
paste("garch-m.student:", halflife(garch_mean.fit.petro.student))
## [1] "garch-m.student: 11.4485546166543"
paste("egarch.normal:", halflife(egarch.fit.petro.normal))
## [1] "egarch.normal: 10.4021458478853"
paste("egarch.student:", halflife(egarch.fit.petro.student))
## [1] "egarch.student: 11.4485546166543"
paste("gjr_garch.normal:", halflife(gjr_garch.fit.petro.normal))
## [1] "gjr_garch.normal: 2.44302475288226"
paste("gjr_garch.student:", halflife(gjr_garch.fit.petro.student))
## [1] "gjr_garch.student: 11.2366707633623"
Pelos valores acima, notamos que com a escolha do modelo GRJ(1, 1)
com distribuição Normal (gjr_garch.normal
), modelo
correspondente ao menor valor de “half-time”, teremos uma menor
quantidade de dias para o choque ser dissipado pela metade (cerca de 2
dias).
Por outro lado, escolhendo o EGARCH(1, 1) com distribuição t-Student
(egarch.student
), levaremos mais dia para que um choque se
dissipe pela metade (cerca de 11 dias).
Coeficiente de persistência para cada modelo usado na questão anterior para os retornos dO IBOVESPA:
paste("arch.normal:", persistence(arch.fit.ibovespa.normal))
## [1] "arch.normal: 0.946256005542736"
paste("arch.student:", persistence(arch.fit.ibovespa.student))
## [1] "arch.student: 0.948872109741046"
paste("garch.normal:", persistence(garch.fit.ibovespa.normal))
## [1] "garch.normal: 0.946695902993415"
paste("garch.student:", persistence(garch.fit.ibovespa.student))
## [1] "garch.student: 0.950351882379123"
paste("garch-m.normal:", persistence(garch_mean.fit.ibovespa.normal))
## [1] "garch-m.normal: 0.946632784570808"
paste("garch-m.student:", persistence(garch_mean.fit.ibovespa.student))
## [1] "garch-m.student: 0.949357841477559"
paste("egarch.normal:", persistence(egarch.fit.ibovespa.normal))
## [1] "egarch.normal: 0.960325035260647"
paste("egarch.student:", persistence(egarch.fit.ibovespa.student))
## [1] "egarch.student: 0.949357841477559"
paste("gjr_garch.normal:", persistence(gjr_garch.fit.ibovespa.normal))
## [1] "gjr_garch.normal: 0.947789376337547"
paste("gjr_garch.student:", persistence(gjr_garch.fit.ibovespa.student))
## [1] "gjr_garch.student: 0.948618605282961"
Analisando os valores obtidos notamos que todos os modelos analisados possuem persistência muito semelhante, por volta de 0.95.
Half-life:
Half-time para cada modelo usado na questão anterior para os retornos do IBOVESPA:
paste("arch.normal:", halflife(arch.fit.ibovespa.normal))
## [1] "arch.normal: 12.5474381780688"
paste("arch.student:", halflife(arch.fit.ibovespa.student))
## [1] "arch.student: 13.2075197477399"
paste("garch.normal:", halflife(garch.fit.ibovespa.normal))
## [1] "garch.normal: 12.6539004883465"
paste("garch.student:", halflife(garch.fit.ibovespa.student))
## [1] "garch.student: 13.6116827110337"
paste("garch-m.normal:", halflife(garch_mean.fit.ibovespa.normal))
## [1] "garch-m.normal: 12.6385169872218"
paste("garch-m.student:", halflife(garch_mean.fit.ibovespa.student))
## [1] "garch-m.student: 13.3375817893554"
paste("egarch.normal:", halflife(egarch.fit.ibovespa.normal))
## [1] "egarch.normal: 17.1217319527808"
paste("egarch.student:", halflife(egarch.fit.ibovespa.student))
## [1] "egarch.student: 13.3375817893554"
paste("gjr_garch.normal:", halflife(gjr_garch.fit.ibovespa.normal))
## [1] "gjr_garch.normal: 12.9263088867355"
paste("gjr_garch.student:", halflife(gjr_garch.fit.ibovespa.student))
## [1] "gjr_garch.student: 13.1406164558691"
Pelos valores acima, notamos que com a escolha do modelo ARCH(1) com
distribuição Normal (arch.normal
), modelo correspondente ao
menor valor de “half-time”, teremos uma menor quantidade de dias para o
choque ser dissipado pela metade (cerca de 12 dias).
Por outro lado, escolhendo o EGARCH(1, 1) com distribuição normal
(egarch.normal
), levaremos mais dia para que um choque se
dissipe pela metade (cerca de 17 dias).
Materiais das aulas (profa. Andreza Palma)
CAP. 2 do livro “TSAY, Ruey S. An introduction to analysis of financial data with R. John Wiley & Sons, 2014.”
https://blog.devgenius.io/volatility-modeling-with-r-arch-and-garch-models-11fde2d7ac38