Comprobad si hay efectos ARCH (gráficos y contrastes LM).
Si ninguna de las variables presenta efectos ARCH usad datos de precios de algún activo financiero o índice bursátil.
mx.ret <- CalculateReturns(mx, method="log")
mx.ret <- mx.ret[-1,]
dataToPlot <- cbind(mx.ret, mx.ret^2, abs(mx.ret))
colnames(dataToPlot) <- c("Returns", "Returns^2", "abs(Returns)")
plot.zoo(dataToPlot, main="IPI Quarterly Returns", col="blue")
par(mfrow=c(3,1))
acf(mx.ret, main="IPI Returns")
acf(mx.ret^2, main="IPI Returns^2")
acf(abs(mx.ret), main="IPI abs(Returns)")
par(mfrow=c(1,1))
table.Stats(mx.ret)
Box.test(coredata(mx.ret^2), type="Ljung-Box", lag = 12)
Box-Ljung test
data: coredata(mx.ret^2)
X-squared = 35.133, df = 12, p-value = 0.0004461
ArchTest(mx.ret)
ARCH LM-test; Null hypothesis: no ARCH effects
data: mx.ret
Chi-squared = 35.558, df = 12, p-value = 0.0003815
En los gráficos de retornos se ven claramente zonas con alta volatilidad sobretodo por 1995, en cambio en los últimos años los gráficos de retornos son más estables.
Se rechaza la hipótesis nula del LM-test y por tanto nuestra serie tiene efectos ARCH.
Construid modelos de la familia GARCH para las variables que sea preciso (construid módelos para media y varianza simultáneamente.
Iter: 1 fn: -323.9728 Pars: 0.00600054 0.00002065 0.41064643 0.58835341
Iter: 2 fn: -323.9728 Pars: 0.00600044 0.00002065 0.41063341 0.58836659
solnp--> Completed in 2 iterations
*---------------------------------*
* 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|)
mu 0.006000 0.001377 4.3585 0.000013
omega 0.000021 0.000013 1.6444 0.100099
alpha1 0.410633 0.143311 2.8653 0.004166
beta1 0.588367 0.094845 6.2035 0.000000
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu 0.006000 0.002302 2.6068 0.009138
omega 0.000021 0.000017 1.2101 0.226241
alpha1 0.410633 0.218250 1.8815 0.059907
beta1 0.588367 0.134414 4.3773 0.000012
LogLikelihood : 323.9728
Information Criteria
------------------------------------
Akaike -5.5647
Bayes -5.4693
Shibata -5.5671
Hannan-Quinn -5.5260
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 7.498 0.006177
Lag[2*(p+q)+(p+q)-1][2] 7.974 0.006573
Lag[4*(p+q)+(p+q)-1][5] 11.160 0.004617
d.o.f=0
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.03843 0.8446
Lag[2*(p+q)+(p+q)-1][5] 2.29488 0.5506
Lag[4*(p+q)+(p+q)-1][9] 3.74639 0.6321
d.o.f=2
Weighted ARCH LM Tests
------------------------------------
Statistic Shape Scale P-Value
ARCH Lag[3] 0.01708 0.500 2.000 0.8960
ARCH Lag[5] 3.18781 1.440 1.667 0.2637
ARCH Lag[7] 3.67295 2.315 1.543 0.3962
Nyblom stability test
------------------------------------
Joint Statistic: 1.8309
Individual Statistics:
mu 0.8683
omega 0.7110
alpha1 0.2063
beta1 0.5113
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 0.6085 0.5441
Negative Sign Bias 0.2452 0.8067
Positive Sign Bias 0.4985 0.6191
Joint Effect 1.8150 0.6117
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 33.70 0.019956
2 30 49.09 0.011306
3 40 65.52 0.004946
4 50 65.43 0.058230
Elapsed time : 1.084001
Realizad predicciones de media y varianza.
mx.garch11.fcst <- ugarchforecast(mx.garch11.fit, n.ahead=40)
plot(mx.garch11.fcst, which=1)
plot(mx.garch11.fcst, which=3)
Comprobad si hay efectos ARCH (gráficos y contrastes LM).
Si ninguna de las variables presenta efectos ARCH usad datos de precios de algún activo financiero o índice bursátil.
lt.ret <- CalculateReturns(lt, method="log")
lt.ret <- lt.ret[-1,]
dataToPlot <- cbind(lt.ret, lt.ret^2, abs(lt.ret))
colnames(dataToPlot) <- c("Returns", "Returns^2", "abs(Returns)")
plot.zoo(dataToPlot, main="Long Term Interest Rate Monthly Returns", col="blue")
par(mfrow=c(3,1))
acf(lt.ret, main="Long Term Interest Rate Returns")
acf(lt.ret^2, main="Long Term Interest Rate Returns^2")
acf(abs(lt.ret), main="Long Term Interest Rate abs(Returns)")
par(mfrow=c(1,1))
table.Stats(lt.ret)
Box.test(coredata(lt.ret^2), type="Ljung-Box", lag = 12)
Box-Ljung test
data: coredata(lt.ret^2)
X-squared = 38.574, df = 12, p-value = 0.0001237
ArchTest(lt.ret)
ARCH LM-test; Null hypothesis: no ARCH effects
data: lt.ret
Chi-squared = 32.78, df = 12, p-value = 0.001048
En los gráficos de retornos se ven varios periodos donde aumentan los retornos considerablemente y otros en los que se mantienen más bajos por lo que podría decirse que la varianza no es constante y hay efectos ARCH.
Se rechaza la hipótesis nula del LM-test y por tanto nuestra serie tiene efectos ARCH.
Construid modelos de la familia GARCH para las variables que sea preciso (construid módelos para media y varianza simultáneamente.
Iter: 1 fn: -286.4082 Pars: -0.0023904 0.0001566 0.1625106 0.7996552
Iter: 2 fn: -286.4082 Pars: -0.0023906 0.0001566 0.1625133 0.7996524
solnp--> Completed in 2 iterations
*---------------------------------*
* 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|)
mu -0.002391 0.003390 -0.70514 0.480721
omega 0.000157 0.000071 2.21574 0.026709
alpha1 0.162513 0.054125 3.00256 0.002677
beta1 0.799652 0.048439 16.50841 0.000000
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu -0.002391 0.003785 -0.63158 0.527660
omega 0.000157 0.000092 1.70259 0.088646
alpha1 0.162513 0.069349 2.34343 0.019107
beta1 0.799652 0.043740 18.28194 0.000000
LogLikelihood : 286.4082
Information Criteria
------------------------------------
Akaike -3.0864
Bayes -3.0163
Shibata -3.0874
Hannan-Quinn -3.0580
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 0.3949 0.5297
Lag[2*(p+q)+(p+q)-1][2] 0.6263 0.6372
Lag[4*(p+q)+(p+q)-1][5] 2.3821 0.5313
d.o.f=0
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.6125 0.4338
Lag[2*(p+q)+(p+q)-1][5] 1.2153 0.8093
Lag[4*(p+q)+(p+q)-1][9] 3.2282 0.7208
d.o.f=2
Weighted ARCH LM Tests
------------------------------------
Statistic Shape Scale P-Value
ARCH Lag[3] 0.005119 0.500 2.000 0.9430
ARCH Lag[5] 0.366499 1.440 1.667 0.9221
ARCH Lag[7] 0.596393 2.315 1.543 0.9688
Nyblom stability test
------------------------------------
Joint Statistic: 1.1239
Individual Statistics:
mu 0.22448
omega 0.20742
alpha1 0.07327
beta1 0.20602
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 0.8519 0.3954
Negative Sign Bias 0.0192 0.9847
Positive Sign Bias 0.2936 0.7694
Joint Effect 1.7647 0.6226
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 43.12 0.001248
2 30 54.87 0.002566
3 40 64.21 0.006692
4 50 80.11 0.003316
Elapsed time : 0.382998
Realizad predicciones de media y varianza.
lt.garch11.fcst <- ugarchforecast(lt.garch11.fit, n.ahead=36)
plot(lt.garch11.fcst, which=1)
plot(lt.garch11.fcst, which=3)
Comprobad si hay efectos ARCH (gráficos y contrastes LM).
Si ninguna de las variables presenta efectos ARCH usad datos de precios de algún activo financiero o índice bursátil.
mt.ret <- CalculateReturns(mt, method="log")
mt.ret <- mt.ret[-1,]
dataToPlot <- cbind(mt.ret, mt.ret^2, abs(mt.ret))
colnames(dataToPlot) <- c("Returns", "Returns^2", "abs(Returns)")
plot.zoo(dataToPlot, main="Medium Term Interest Rate Monthly Returns", col="blue")
par(mfrow=c(3,1))
acf(mt.ret, main="Medium Term Interest Rate Returns")
acf(mt.ret^2, main="Medium Term Interest Rate Returns^2")
acf(abs(mt.ret), main="Medium Term Interest Rate abs(Returns)")
par(mfrow=c(1,1))
table.Stats(mt.ret)
Box.test(coredata(mt.ret^2), type="Ljung-Box", lag = 12)
Box-Ljung test
data: coredata(mt.ret^2)
X-squared = 73.113, df = 12, p-value = 8.34e-11
ArchTest(mt.ret)
ARCH LM-test; Null hypothesis: no ARCH effects
data: mt.ret
Chi-squared = 47.132, df = 12, p-value = 4.422e-06
En los gráficos de retornos se ven varios periodos donde aumentan los retornos considerablemente y otros en los que se mantienen más bajos por lo que podría decirse que la varianza no es constante y hay efectos ARCH.
Se rechaza la hipótesis nula del LM-test y por tanto nuestra serie tiene efectos ARCH.
Construid modelos de la familia GARCH para las variables que sea preciso (construid módelos para media y varianza simumtáneamente.
Iter: 1 fn: -356.9919 Pars: -0.0024712 0.0001027 0.3939694 0.6050306
Iter: 2 fn: -356.9919 Pars: -0.0024712 0.0001027 0.3939692 0.6050307
solnp--> Completed in 2 iterations
*---------------------------------*
* 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|)
mu -0.002471 0.001914 -1.2909 0.196749
omega 0.000103 0.000040 2.5391 0.011115
alpha1 0.393969 0.100570 3.9174 0.000090
beta1 0.605031 0.078667 7.6910 0.000000
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu -0.002471 0.002530 -0.97674 0.328697
omega 0.000103 0.000097 1.05464 0.291590
alpha1 0.393969 0.152211 2.58832 0.009645
beta1 0.605031 0.148988 4.06095 0.000049
LogLikelihood : 356.9919
Information Criteria
------------------------------------
Akaike -3.8578
Bayes -3.7877
Shibata -3.8588
Hannan-Quinn -3.8294
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 15.45 8.482e-05
Lag[2*(p+q)+(p+q)-1][2] 16.73 3.214e-05
Lag[4*(p+q)+(p+q)-1][5] 23.03 2.817e-06
d.o.f=0
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.001927 0.9650
Lag[2*(p+q)+(p+q)-1][5] 0.392547 0.9729
Lag[4*(p+q)+(p+q)-1][9] 0.824442 0.9924
d.o.f=2
Weighted ARCH LM Tests
------------------------------------
Statistic Shape Scale P-Value
ARCH Lag[3] 0.004622 0.500 2.000 0.9458
ARCH Lag[5] 0.459258 1.440 1.667 0.8956
ARCH Lag[7] 0.601562 2.315 1.543 0.9683
Nyblom stability test
------------------------------------
Joint Statistic: 0.6874
Individual Statistics:
mu 0.12716
omega 0.11603
alpha1 0.12883
beta1 0.09834
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 0.4454 0.6566
Negative Sign Bias 0.1423 0.8870
Positive Sign Bias 0.2333 0.8158
Joint Effect 0.6297 0.8896
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 138.4 3.657e-20
2 30 173.6 1.549e-22
3 40 187.9 2.201e-21
4 50 211.8 3.972e-22
Elapsed time : 0.471998
Realizad predicciones de media y varianza.
mt.garch11.fcst <- ugarchforecast(mt.garch11.fit, n.ahead=36)
plot(mt.garch11.fcst, which=1)
plot(mt.garch11.fcst, which=3)
Comprobad si hay efectos ARCH (gráficos y contrastes LM).
Si ninguna de las variables presenta efectos ARCH usad datos de precios de algún activo financiero o índice bursátil.
st.ret <- CalculateReturns(st, method="log")
st.ret <- st.ret[-1,]
dataToPlot <- cbind(st.ret, st.ret^2, abs(st.ret))
colnames(dataToPlot) <- c("Returns", "Returns^2", "abs(Returns)")
plot.zoo(dataToPlot, main="Short Term Interest Rate Monthly Returns", col="blue")
par(mfrow=c(3,1))
acf(st.ret, main="Short Term Interest Rate Returns")
acf(st.ret^2, main="Short Term Interest Rate Returns^2")
acf(abs(st.ret), main="Short Term Interest Rate abs(Returns)")
par(mfrow=c(1,1))
table.Stats(st.ret)
Box.test(coredata(st.ret^2), type="Ljung-Box", lag = 12)
Box-Ljung test
data: coredata(st.ret^2)
X-squared = 35.965, df = 12, p-value = 0.0003282
ArchTest(st.ret)
ARCH LM-test; Null hypothesis: no ARCH effects
data: st.ret
Chi-squared = 29.914, df = 12, p-value = 0.002877
En los gráficos de retornos se ven varios periodos donde aumentan los retornos y otros en los que se mantienen más bajos por lo que podría decirse que la varianza no es constante y hay efectos ARCH.
Se rechaza la hipótesis nula del LM-test y por tanto nuestra serie tiene efectos ARCH.
Construid modelos de la familia GARCH para las variables que sea preciso (construid módelos para media y varianza simustáneamente.
Iter: 1 fn: -368.0697 Pars: -0.00093621 0.00005858 0.46359929 0.53540063
Iter: 2 fn: -368.0697 Pars: -0.00093629 0.00005857 0.46359739 0.53540256
solnp--> Completed in 2 iterations
*---------------------------------*
* 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|)
mu -0.000936 0.001638 -0.57173 0.567502
omega 0.000059 0.000031 1.91862 0.055033
alpha1 0.463597 0.102036 4.54345 0.000006
beta1 0.535403 0.085346 6.27330 0.000000
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu -0.000936 0.002105 -0.44482 0.656449
omega 0.000059 0.000042 1.38240 0.166850
alpha1 0.463597 0.129675 3.57507 0.000350
beta1 0.535403 0.132924 4.02789 0.000056
LogLikelihood : 368.0697
Information Criteria
------------------------------------
Akaike -3.9789
Bayes -3.9088
Shibata -3.9798
Hannan-Quinn -3.9505
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 17.38 3.062e-05
Lag[2*(p+q)+(p+q)-1][2] 18.93 8.510e-06
Lag[4*(p+q)+(p+q)-1][5] 28.29 9.598e-08
d.o.f=0
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.4363 0.5089
Lag[2*(p+q)+(p+q)-1][5] 1.8887 0.6450
Lag[4*(p+q)+(p+q)-1][9] 2.6319 0.8178
d.o.f=2
Weighted ARCH LM Tests
------------------------------------
Statistic Shape Scale P-Value
ARCH Lag[3] 1.744 0.500 2.000 0.1867
ARCH Lag[5] 2.552 1.440 1.667 0.3617
ARCH Lag[7] 2.703 2.315 1.543 0.5714
Nyblom stability test
------------------------------------
Joint Statistic: 1.8368
Individual Statistics:
mu 0.2574
omega 0.2570
alpha1 0.6818
beta1 0.4567
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.0191 0.3095
Negative Sign Bias 0.2295 0.8187
Positive Sign Bias 0.1138 0.9095
Joint Effect 1.6913 0.6389
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 20.61 0.3589
2 30 34.54 0.2200
3 40 38.42 0.4961
4 50 51.15 0.3891
Elapsed time : 0.608001
Realizad predicciones de media y varianza.
st.garch11.fcst <- ugarchforecast(st.garch11.fit, n.ahead=36)
plot(st.garch11.fcst, which=1)
plot(st.garch11.fcst, which=3)