m1 <- Arima(coredata(diff_ln_MSFT_close), order=c(4,1,3))
tsdiag(m1, gof.lag = 24)
m2 <- Arima(coredata(diff_ln_MSFT_close), order=c(5,1,3))
tsdiag(m2, gof.lag = 24)
m3 <- Arima(coredata(diff_ln_MSFT_close), order=c(5,1,4))
tsdiag(m3, gof.lag = 24)
m4 <- Arima(coredata(diff_ln_MSFT_close), order=c(5,1,2))
tsdiag(m4, gof.lag = 24)
m5 <- Arima(coredata(diff_ln_MSFT_close), order=c(4,1,2))
tsdiag(m5, gof.lag = 24)
stargazerX(m1, m2, m3, m4, m5, type="html")
| Dependent variable: | |||||
| coredata | coredata | coredata | coredata | coredata | |
| (1) | (2) | (3) | (4) | (5) | |
| ar1 | -0.253 | -1.102 | -1.661*** | -0.950*** | -0.361 |
| (0.174) | (0.108) | (0.105) | |||
| ar2 | 0.018 | -0.905 | -1.677*** | -0.091*** | -0.067*** |
| (0.275) | (0.105) | (0.016) | (0.005) | ||
| ar3 | -0.042*** | -0.121*** | -0.979*** | -0.082*** | -0.049 |
| (0.006) | (0.013) | (0.227) | (0.017) | ||
| ar4 | -0.025* | -0.087*** | -0.110*** | -0.056*** | -0.030*** |
| (0.014) | (0.014) | (0.027) | (0.016) | (0.011) | |
| ar5 | -0.041*** | -0.043*** | -0.024** | ||
| (0.011) | (0.016) | (0.012) | |||
| ma1 | -0.785*** | 0.064 | 0.624*** | -0.089 | -0.676 |
| (0.173) | (0.108) | (0.105) | |||
| ma2 | -0.294 | -0.252*** | -0.057 | -0.910*** | -0.323 |
| (0.515) | (0.043) | (0.068) | (0.105) | ||
| ma3 | 0.081 | -0.810 | -0.727 | ||
| (0.285) | |||||
| ma4 | -0.836*** | ||||
| (0.216) | |||||
| Observations | 7,581 | 7,581 | 7,581 | 7,581 | 7,581 |
| Log Likelihood | 17,792.590 | 17,792.970 | 17,786.740 | 17,793.070 | 17,792.030 |
| sigma2 | 0.001 | 0.001 | 0.001 | 0.001 | 0.001 |
| Akaike Inf. Crit. | -35,569.180 | -35,567.950 | -35,553.480 | -35,570.130 | -35,570.070 |
| Jarque-Bera | 71,135.360 (p=0.000) | 70,028.380 (p=0.000) | 71,778.780 (p=0.000) | 70,943.700 (p=0.000) | 71,126.200 (p=0.000) |
| Q(10) resid | 8.824 (p=0.549) | 8.656 (p=0.566) | 22.660 (p=0.013) | 7.974 (p=0.632) | 10.112 (p=0.431) |
| Q(20) resid | 20.712 (p=0.415) | 20.760 (p=0.412) | 33.961 (p=0.027) | 19.872 (p=0.466) | 22.039 (p=0.339) |
| Note: | p<0.1; p<0.05; p<0.01 | ||||
Based on all the above diagnostics, it appears that Model m4 – ARMA(5,1,2) is the best fitting model.
Acf(m4$residuals, type= "correlation", lag.max = 24)
Acf(m4$residuals, type= "partial", lag.max = 24)
Acf(m4$residuals^2, type= "correlation", lag.max = 24)
Acf(m4$residuals^2, type= "partial", lag.max = 24)
Based on the above ACF and PACF of the squared residuals it appears that an Arch(8) or ARCH(14) model may be best for modeling the variance.
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~arma(5, 2) + garch(8, 0), data = coredata(diff_ln_MSFT_close),
## trace = F)
##
## Mean and Variance Equation:
## data ~ arma(5, 2) + garch(8, 0)
## <environment: 0x7f8fd8433190>
## [data = coredata(diff_ln_MSFT_close)]
##
## Conditional Distribution:
## norm
##
## Coefficient(s):
## mu ar1 ar2 ar3 ar4
## 0.00064309 -0.07321258 0.41973838 -0.01630309 -0.02091004
## ar5 ma1 ma2 omega alpha1
## -0.00195367 0.04923831 -0.44749077 0.00018165 0.16093480
## alpha2 alpha3 alpha4 alpha5 alpha6
## 0.12069419 0.06222672 0.11308056 0.05449177 0.02818132
## alpha7 alpha8
## 0.09441491 0.05392809
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu 6.431e-04 2.810e-04 2.289 0.0221 *
## ar1 -7.321e-02 2.983e-01 -0.245 0.8061
## ar2 4.197e-01 1.854e-01 2.264 0.0236 *
## ar3 -1.630e-02 1.529e-02 -1.066 0.2863
## ar4 -2.091e-02 1.572e-02 -1.330 0.1836
## ar5 -1.954e-03 1.615e-02 -0.121 0.9037
## ma1 4.924e-02 2.981e-01 0.165 0.8688
## ma2 -4.475e-01 1.890e-01 -2.367 0.0179 *
## omega 1.816e-04 7.059e-06 25.733 < 2e-16 ***
## alpha1 1.609e-01 1.502e-02 10.712 < 2e-16 ***
## alpha2 1.207e-01 1.604e-02 7.525 5.28e-14 ***
## alpha3 6.223e-02 1.213e-02 5.131 2.89e-07 ***
## alpha4 1.131e-01 1.443e-02 7.839 4.44e-15 ***
## alpha5 5.449e-02 1.142e-02 4.774 1.81e-06 ***
## alpha6 2.818e-02 1.156e-02 2.437 0.0148 *
## alpha7 9.441e-02 1.448e-02 6.520 7.05e-11 ***
## alpha8 5.393e-02 1.178e-02 4.577 4.73e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## 18630.96 normalized: 2.457261
##
## Description:
## Tue Mar 22 20:54:46 2016 by user:
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 13944.31 0
## Shapiro-Wilk Test R W NA NA
## Ljung-Box Test R Q(10) 3.89659 0.9518914
## Ljung-Box Test R Q(15) 8.865061 0.8844666
## Ljung-Box Test R Q(20) 11.18487 0.9412866
## Ljung-Box Test R^2 Q(10) 7.120645 0.7140084
## Ljung-Box Test R^2 Q(15) 25.95017 0.03854968
## Ljung-Box Test R^2 Q(20) 52.68833 9.030523e-05
## LM Arch Test R TR^2 7.156606 0.8470931
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## -4.910038 -4.894492 -4.910048 -4.904703
By the above diagnostics we see that the ARCH terms all seem to be significant but the terms on our AR(5) and MA(2) components are not significant. We can try to drop some terms to see if we can adjust the model some. We can also try to increase the ARCH terms to better model the variance.
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~arma(4, 1) + garch(8, 0), data = coredata(diff_ln_MSFT_close),
## trace = F)
##
## Mean and Variance Equation:
## data ~ arma(4, 1) + garch(8, 0)
## <environment: 0x7f8fdc19c4b0>
## [data = coredata(diff_ln_MSFT_close)]
##
## Conditional Distribution:
## norm
##
## Coefficient(s):
## mu ar1 ar2 ar3 ar4
## 0.00039874 0.60360915 -0.01162039 -0.00922859 -0.01205802
## ma1 omega alpha1 alpha2 alpha3
## -0.62757689 0.00018171 0.16126770 0.12070070 0.06224090
## alpha4 alpha5 alpha6 alpha7 alpha8
## 0.11277251 0.05452603 0.02810394 0.09465164 0.05369406
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu 3.987e-04 1.523e-04 2.619 0.00883 **
## ar1 6.036e-01 1.270e-01 4.755 1.99e-06 ***
## ar2 -1.162e-02 1.605e-02 -0.724 0.46907
## ar3 -9.229e-03 1.550e-02 -0.596 0.55150
## ar4 -1.206e-02 1.467e-02 -0.822 0.41105
## ma1 -6.276e-01 1.264e-01 -4.967 6.82e-07 ***
## omega 1.817e-04 7.061e-06 25.734 < 2e-16 ***
## alpha1 1.613e-01 1.501e-02 10.743 < 2e-16 ***
## alpha2 1.207e-01 1.606e-02 7.517 5.62e-14 ***
## alpha3 6.224e-02 1.212e-02 5.134 2.84e-07 ***
## alpha4 1.128e-01 1.440e-02 7.829 4.88e-15 ***
## alpha5 5.453e-02 1.141e-02 4.778 1.77e-06 ***
## alpha6 2.810e-02 1.160e-02 2.423 0.01541 *
## alpha7 9.465e-02 1.449e-02 6.531 6.53e-11 ***
## alpha8 5.369e-02 1.174e-02 4.574 4.79e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## 18630.8 normalized: 2.457241
##
## Description:
## Tue Mar 22 20:55:00 2016 by user:
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 14010.5 0
## Shapiro-Wilk Test R W NA NA
## Ljung-Box Test R Q(10) 3.771828 0.9570537
## Ljung-Box Test R Q(15) 8.565727 0.8991085
## Ljung-Box Test R Q(20) 10.9028 0.9487043
## Ljung-Box Test R^2 Q(10) 7.150094 0.7112033
## Ljung-Box Test R^2 Q(15) 25.98233 0.03820877
## Ljung-Box Test R^2 Q(20) 52.58486 9.351511e-05
## LM Arch Test R TR^2 7.194479 0.8444984
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## -4.910525 -4.896808 -4.910533 -4.905817
Seems like we can still remove some insignificant AR(p) terms from the model.
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~arma(1, 1) + garch(8, 0), data = coredata(diff_ln_MSFT_close),
## trace = F)
##
## Mean and Variance Equation:
## data ~ arma(1, 1) + garch(8, 0)
## <environment: 0x7f8fdb8c4b18>
## [data = coredata(diff_ln_MSFT_close)]
##
## Conditional Distribution:
## norm
##
## Coefficient(s):
## mu ar1 ma1 omega alpha1
## 0.00025016 0.72959173 -0.76347136 0.00018206 0.16152836
## alpha2 alpha3 alpha4 alpha5 alpha6
## 0.12108409 0.06204885 0.11200310 0.05418029 0.02775292
## alpha7 alpha8
## 0.09578966 0.05313716
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu 2.502e-04 8.675e-05 2.884 0.00393 **
## ar1 7.296e-01 7.644e-02 9.544 < 2e-16 ***
## ma1 -7.635e-01 7.178e-02 -10.636 < 2e-16 ***
## omega 1.821e-04 7.054e-06 25.810 < 2e-16 ***
## alpha1 1.615e-01 1.501e-02 10.763 < 2e-16 ***
## alpha2 1.211e-01 1.604e-02 7.547 4.44e-14 ***
## alpha3 6.205e-02 1.209e-02 5.132 2.87e-07 ***
## alpha4 1.120e-01 1.434e-02 7.810 5.77e-15 ***
## alpha5 5.418e-02 1.134e-02 4.776 1.79e-06 ***
## alpha6 2.775e-02 1.162e-02 2.388 0.01693 *
## alpha7 9.579e-02 1.445e-02 6.629 3.37e-11 ***
## alpha8 5.314e-02 1.172e-02 4.535 5.75e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## 18629.39 normalized: 2.457055
##
## Description:
## Tue Mar 22 20:55:08 2016 by user:
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 14065.07 0
## Shapiro-Wilk Test R W NA NA
## Ljung-Box Test R Q(10) 5.173213 0.8793108
## Ljung-Box Test R Q(15) 10.47885 0.7885876
## Ljung-Box Test R Q(20) 12.88771 0.8821499
## Ljung-Box Test R^2 Q(10) 7.165967 0.7096893
## Ljung-Box Test R^2 Q(15) 25.80793 0.04009065
## Ljung-Box Test R^2 Q(20) 52.21896 0.0001057824
## LM Arch Test R TR^2 7.212968 0.8432247
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## -4.910945 -4.899971 -4.910950 -4.907178
We have now removed all insignificant ARMA terms. We can now increase our ARCH terms to best model the variance.
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~arma(1, 1) + garch(14, 0), data = coredata(diff_ln_MSFT_close),
## trace = F)
##
## Mean and Variance Equation:
## data ~ arma(1, 1) + garch(14, 0)
## <environment: 0x7f8fd8bb9b20>
## [data = coredata(diff_ln_MSFT_close)]
##
## Conditional Distribution:
## norm
##
## Coefficient(s):
## mu ar1 ma1 omega alpha1
## 0.00023521 0.74667651 -0.78001300 0.00013245 0.11733408
## alpha2 alpha3 alpha4 alpha5 alpha6
## 0.10514044 0.04757667 0.09633824 0.03665670 0.02831655
## alpha7 alpha8 alpha9 alpha10 alpha11
## 0.08114921 0.03940968 0.05387345 0.03265302 0.03291820
## alpha12 alpha13 alpha14
## 0.05001320 0.03599471 0.03185942
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu 2.352e-04 8.087e-05 2.908 0.003633 **
## ar1 7.467e-01 7.123e-02 10.483 < 2e-16 ***
## ma1 -7.800e-01 6.661e-02 -11.710 < 2e-16 ***
## omega 1.325e-04 6.865e-06 19.295 < 2e-16 ***
## alpha1 1.173e-01 1.767e-02 6.641 3.11e-11 ***
## alpha2 1.051e-01 1.622e-02 6.482 9.03e-11 ***
## alpha3 4.758e-02 1.173e-02 4.054 5.03e-05 ***
## alpha4 9.634e-02 1.463e-02 6.587 4.49e-11 ***
## alpha5 3.666e-02 1.068e-02 3.433 0.000596 ***
## alpha6 2.832e-02 1.186e-02 2.389 0.016916 *
## alpha7 8.115e-02 1.445e-02 5.616 1.95e-08 ***
## alpha8 3.941e-02 1.124e-02 3.506 0.000454 ***
## alpha9 5.387e-02 1.406e-02 3.832 0.000127 ***
## alpha10 3.265e-02 1.473e-02 2.216 0.026683 *
## alpha11 3.292e-02 1.630e-02 2.019 0.043474 *
## alpha12 5.001e-02 1.272e-02 3.932 8.43e-05 ***
## alpha13 3.599e-02 8.683e-03 4.145 3.39e-05 ***
## alpha14 3.186e-02 1.183e-02 2.694 0.007059 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## 18714.46 normalized: 2.468275
##
## Description:
## Tue Mar 22 20:55:37 2016 by user:
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 12940.15 0
## Shapiro-Wilk Test R W NA NA
## Ljung-Box Test R Q(10) 4.737645 0.9080006
## Ljung-Box Test R Q(15) 11.14579 0.742193
## Ljung-Box Test R Q(20) 13.67222 0.8467188
## Ljung-Box Test R^2 Q(10) 1.609472 0.998552
## Ljung-Box Test R^2 Q(15) 9.00258 0.8773825
## Ljung-Box Test R^2 Q(20) 18.49476 0.5548511
## LM Arch Test R TR^2 5.087085 0.9550068
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## -4.931802 -4.915342 -4.931814 -4.926153
##
## Title:
## Jarque - Bera Normalality Test
##
## Test Results:
## STATISTIC:
## X-squared: 66325.5024
## P VALUE:
## Asymptotic p Value: < 2.2e-16
##
## Description:
## Tue Mar 22 20:55:38 2016 by user:
It appears that a ARMA(1,1)-ARCH(14) gives the best model. The down side of using a pure ARCH model is the high order number needed.
| Dependent variable: | ||||
| coredata | coredata | coredata | coredata | |
| (1) | (2) | (3) | (4) | |
| mu | 0.001** | 0.0004*** | 0.0003*** | 0.0002*** |
| (0.0003) | (0.0002) | (0.0001) | (0.0001) | |
| ar1 | -0.073 | 0.604*** | 0.730*** | 0.747*** |
| (0.298) | (0.127) | (0.076) | (0.071) | |
| ar2 | 0.420** | -0.012 | ||
| (0.185) | (0.016) | |||
| ar3 | -0.016 | -0.009 | ||
| (0.015) | (0.015) | |||
| ar4 | -0.021 | -0.012 | ||
| (0.016) | (0.015) | |||
| ar5 | -0.002 | |||
| (0.016) | ||||
| ma1 | 0.049 | -0.628*** | -0.763*** | -0.780*** |
| (0.298) | (0.126) | (0.072) | (0.067) | |
| ma2 | -0.447** | |||
| (0.189) | ||||
| omega | 0.0002*** | 0.0002*** | 0.0002*** | 0.0001*** |
| (0.00001) | (0.00001) | (0.00001) | (0.00001) | |
| alpha1 | 0.161*** | 0.161*** | 0.162*** | 0.117*** |
| (0.015) | (0.015) | (0.015) | (0.018) | |
| alpha2 | 0.121*** | 0.121*** | 0.121*** | 0.105*** |
| (0.016) | (0.016) | (0.016) | (0.016) | |
| alpha3 | 0.062*** | 0.062*** | 0.062*** | 0.048*** |
| (0.012) | (0.012) | (0.012) | (0.012) | |
| alpha4 | 0.113*** | 0.113*** | 0.112*** | 0.096*** |
| (0.014) | (0.014) | (0.014) | (0.015) | |
| alpha5 | 0.054*** | 0.055*** | 0.054*** | 0.037*** |
| (0.011) | (0.011) | (0.011) | (0.011) | |
| alpha6 | 0.028** | 0.028** | 0.028** | 0.028** |
| (0.012) | (0.012) | (0.012) | (0.012) | |
| alpha7 | 0.094*** | 0.095*** | 0.096*** | 0.081*** |
| (0.014) | (0.014) | (0.014) | (0.014) | |
| alpha8 | 0.054*** | 0.054*** | 0.053*** | 0.039*** |
| (0.012) | (0.012) | (0.012) | (0.011) | |
| alpha9 | 0.054*** | |||
| (0.014) | ||||
| alpha10 | 0.033** | |||
| (0.015) | ||||
| alpha11 | 0.033** | |||
| (0.016) | ||||
| alpha12 | 0.050*** | |||
| (0.013) | ||||
| alpha13 | 0.036*** | |||
| (0.009) | ||||
| alpha14 | 0.032*** | |||
| (0.012) | ||||
| Observations | 7,582 | 7,582 | 7,582 | 7,582 |
| Log Likelihood | -18,630.960 | -18,630.800 | -18,629.390 | -18,714.460 |
| Akaike Inf. Crit. | -4.910 | -4.911 | -4.911 | -4.932 |
| Bayesian Inf. Crit. | -4.894 | -4.897 | -4.900 | -4.915 |
| Jarque-Bera | 13,944.310 (p=0.000) | 14,010.500 (p=0.000) | 14,065.070 (p=0.000) | 12,940.150 (p=0.000) |
| Q(10) resid | 3.897 (p=0.952) | 3.772 (p=0.958) | 5.173 (p=0.880) | 4.738 (p=0.909) |
| Q(20) resid | 11.185 (p=0.942) | 10.903 (p=0.949) | 12.888 (p=0.883) | 13.672 (p=0.847) |
| Q(10) resid sq. | 7.121 (p=0.715) | 7.150 (p=0.712) | 7.166 (p=0.710) | 1.609 (p=0.999) |
| Q(20) resid sq. | 52.688 (p=0.0001) | 52.585 (p=0.0001) | 52.219 (p=0.0002) | 18.495 (p=0.555) |
| Note: | p<0.1; p<0.05; p<0.01 | |||
By viewing the ACF and PACF of the residuals and the squared residuals from the ARMA(1,1)-ARCH(14) model we can see that there is no correlation in the resuduals and very little correlation in the squared residuals. The Q(10) and Q(20) of both the residuals and the squared residuals have a high p-value indicating the model is adequate. The QQ-plot shows that the model has fat tails but follows a normal distabution in the centeral region. The Jarque - Bera Normalality Test confirms that the model error is not strictly normally distributed.
The benifit of using a GARCH(m,s) is we can reduce the order of the ARCH(14) model.
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~arma(1, 1) + garch(1, 1), data = coredata(diff_ln_MSFT_close),
## cond.dist = "std", trace = F)
##
## Mean and Variance Equation:
## data ~ arma(1, 1) + garch(1, 1)
## <environment: 0x7f8fdefe98a8>
## [data = coredata(diff_ln_MSFT_close)]
##
## Conditional Distribution:
## std
##
## Coefficient(s):
## mu ar1 ma1 omega alpha1
## 2.2590e-04 6.1078e-01 -6.4440e-01 2.4732e-06 6.4076e-02
## beta1 shape
## 9.3509e-01 4.8271e+00
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu 2.259e-04 1.030e-04 2.192 0.028367 *
## ar1 6.108e-01 1.445e-01 4.228 2.36e-05 ***
## ma1 -6.444e-01 1.396e-01 -4.616 3.91e-06 ***
## omega 2.473e-06 7.039e-07 3.513 0.000443 ***
## alpha1 6.408e-02 8.540e-03 7.503 6.26e-14 ***
## beta1 9.351e-01 8.207e-03 113.945 < 2e-16 ***
## shape 4.827e+00 2.695e-01 17.913 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## 19265 normalized: 2.540886
##
## Description:
## Tue Mar 22 20:55:42 2016 by user:
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 23852.76 0
## Shapiro-Wilk Test R W NA NA
## Ljung-Box Test R Q(10) 6.350325 0.785022
## Ljung-Box Test R Q(15) 12.83671 0.6149091
## Ljung-Box Test R Q(20) 16.06712 0.7124517
## Ljung-Box Test R^2 Q(10) 1.749131 0.9979264
## Ljung-Box Test R^2 Q(15) 6.97371 0.9583752
## Ljung-Box Test R^2 Q(20) 8.246873 0.9901044
## LM Arch Test R TR^2 2.757825 0.9970257
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## -5.079926 -5.073525 -5.079928 -5.077729
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~arma(1, 1) + garch(2, 1), data = coredata(diff_ln_MSFT_close),
## cond.dist = "std", trace = F)
##
## Mean and Variance Equation:
## data ~ arma(1, 1) + garch(2, 1)
## <environment: 0x7f8fdbe22468>
## [data = coredata(diff_ln_MSFT_close)]
##
## Conditional Distribution:
## std
##
## Coefficient(s):
## mu ar1 ma1 omega alpha1
## 2.2590e-04 6.1084e-01 -6.4446e-01 2.4727e-06 6.4060e-02
## alpha2 beta1 shape
## 1.0000e-08 9.3510e-01 4.8296e+00
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu 2.259e-04 1.031e-04 2.192 0.02839 *
## ar1 6.108e-01 1.444e-01 4.230 2.34e-05 ***
## ma1 -6.445e-01 1.396e-01 -4.618 3.88e-06 ***
## omega 2.473e-06 7.784e-07 3.177 0.00149 **
## alpha1 6.406e-02 1.502e-02 4.264 2.01e-05 ***
## alpha2 1.000e-08 1.900e-02 0.000 1.00000
## beta1 9.351e-01 1.035e-02 90.347 < 2e-16 ***
## shape 4.830e+00 2.724e-01 17.732 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## 19265.03 normalized: 2.54089
##
## Description:
## Tue Mar 22 20:55:46 2016 by user:
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 23816.13 0
## Shapiro-Wilk Test R W NA NA
## Ljung-Box Test R Q(10) 6.343261 0.7856468
## Ljung-Box Test R Q(15) 12.83368 0.6151426
## Ljung-Box Test R Q(20) 16.05704 0.7130792
## Ljung-Box Test R^2 Q(10) 1.759983 0.9978707
## Ljung-Box Test R^2 Q(15) 6.988707 0.9579624
## Ljung-Box Test R^2 Q(20) 8.265609 0.9899596
## LM Arch Test R TR^2 2.764158 0.9969924
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## -5.079670 -5.072355 -5.079673 -5.077160
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~arma(1, 1) + garch(1, 2), data = coredata(diff_ln_MSFT_close),
## cond.dist = "std", trace = F)
##
## Mean and Variance Equation:
## data ~ arma(1, 1) + garch(1, 2)
## <environment: 0x7f8fda33ad10>
## [data = coredata(diff_ln_MSFT_close)]
##
## Conditional Distribution:
## std
##
## Coefficient(s):
## mu ar1 ma1 omega alpha1
## 2.2294e-04 6.1189e-01 -6.4529e-01 2.8692e-06 7.6250e-02
## beta1 beta2 shape
## 6.8429e-01 2.3841e-01 4.8390e+00
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu 2.229e-04 1.024e-04 2.177 0.029463 *
## ar1 6.119e-01 1.447e-01 4.227 2.36e-05 ***
## ma1 -6.453e-01 1.398e-01 -4.615 3.92e-06 ***
## omega 2.869e-06 8.475e-07 3.385 0.000711 ***
## alpha1 7.625e-02 1.150e-02 6.633 3.29e-11 ***
## beta1 6.843e-01 1.414e-01 4.841 1.29e-06 ***
## beta2 2.384e-01 1.354e-01 1.761 0.078198 .
## shape 4.839e+00 2.706e-01 17.881 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## 19266.37 normalized: 2.541067
##
## Description:
## Tue Mar 22 20:55:49 2016 by user:
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 23670.47 0
## Shapiro-Wilk Test R W NA NA
## Ljung-Box Test R Q(10) 6.217 0.7967142
## Ljung-Box Test R Q(15) 12.67551 0.6273456
## Ljung-Box Test R Q(20) 15.89506 0.7231126
## Ljung-Box Test R^2 Q(10) 1.601915 0.9985813
## Ljung-Box Test R^2 Q(15) 6.647221 0.9667103
## Ljung-Box Test R^2 Q(20) 7.86277 0.9927374
## LM Arch Test R TR^2 2.468818 0.9982729
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## -5.080024 -5.072708 -5.080026 -5.077513
| Log Returns Microsoft Closing Price | |||
| GARCH(1,1) | GARCH(2,1) | GARCH(1,2) | |
| mu | 0.0002** | 0.0002** | 0.0002** |
| ar1 | 0.611*** | 0.611*** | 0.612*** |
| ma1 | -0.644*** | -0.644*** | -0.645*** |
| omega | 0.00000*** | 0.00000*** | 0.00000*** |
| alpha1 | 0.064*** | 0.064*** | 0.076*** |
| alpha2 | 0.000 | ||
| beta1 | 0.935*** | 0.935*** | 0.684*** |
| beta2 | 0.238* | ||
| shape | 4.827*** | 4.830*** | 4.839*** |
| Observations | 7,582 | 7,582 | 7,582 |
| Log Likelihood | -19,265.000 | -19,265.030 | -19,266.370 |
| Akaike Inf. Crit. | -5.080 | -5.080 | -5.080 |
| Bayesian Inf. Crit. | -5.074 | -5.072 | -5.073 |
| Jarque-Bera | 23,852.760 (p=0.000) | 23,816.130 (p=0.000) | 23,670.470 (p=0.000) |
| Q(10) resid | 6.350 (p=0.786) | 6.343 (p=0.786) | 6.217 (p=0.797) |
| Q(20) resid | 16.067 (p=0.713) | 16.057 (p=0.714) | 15.895 (p=0.724) |
| Q(10) resid sq. | 1.749 (p=0.998) | 1.760 (p=0.998) | 1.602 (p=0.999) |
| Q(20) resid sq. | 8.247 (p=0.991) | 8.266 (p=0.990) | 7.863 (p=0.993) |
| Note: | p<0.1; p<0.05; p<0.01 | ||
Based on the diagnostics from above and by looking at the summary table, all of the models seem to perform well. The ARMA(1,1)-GARCH(1,1) seems to very slightly edge out the other model variants. By viewing the QQ-Plot we see that by using the stident t innovation has helped with the normality of the errors but according to the Jarque-Bera Test statistic the models errors are still not strictly following normal distridution.
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~arma(1, 1) + garch(1, 1), data = coredata(diff_ln_MSFT_close),
## delta = 1, cond.dist = "std", leverage = T, trace = F)
##
## Mean and Variance Equation:
## data ~ arma(1, 1) + garch(1, 1)
## <environment: 0x7f8fda57bb88>
## [data = coredata(diff_ln_MSFT_close)]
##
## Conditional Distribution:
## std
##
## Coefficient(s):
## mu ar1 ma1 omega alpha1
## 0.00018953 0.60192627 -0.63698627 0.00011596 0.07387124
## gamma1 beta1 shape
## 0.13342951 0.94269539 4.35132476
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu 1.895e-04 9.899e-05 1.915 0.055550 .
## ar1 6.019e-01 1.566e-01 3.843 0.000122 ***
## ma1 -6.370e-01 1.518e-01 -4.197 2.7e-05 ***
## omega 1.160e-04 3.675e-05 3.156 0.001601 **
## alpha1 7.387e-02 7.675e-03 9.625 < 2e-16 ***
## gamma1 1.334e-01 4.907e-02 2.719 0.006548 **
## beta1 9.427e-01 6.228e-03 151.368 < 2e-16 ***
## shape 4.351e+00 2.228e-01 19.532 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## 19294.41 normalized: 2.544765
##
## Description:
## Tue Mar 22 20:55:53 2016 by user:
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 1475782519 0
## Shapiro-Wilk Test R W NA NA
## Ljung-Box Test R Q(10) 49.21349 3.722225e-07
## Ljung-Box Test R Q(15) 52.41433 4.823371e-06
## Ljung-Box Test R Q(20) 59.42498 8.738047e-06
## Ljung-Box Test R^2 Q(10) 1.55892 0.9987398
## Ljung-Box Test R^2 Q(15) 1.565776 0.9999943
## Ljung-Box Test R^2 Q(20) 1.582894 1
## LM Arch Test R TR^2 59.45631 2.835442e-08
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## -5.087420 -5.080104 -5.087422 -5.084909
By using the TGARCH model we can better capture changes in the volitility of a system. The Threshold GARCH model is asymetric which allows us to focus more on the downside volitility which is more important in modeling financial data or trying to predict the potiential loss due to a down turn with a given asset.
| Log Returns Microsoft Closing Price | |||
| GARCH(1,1) | GARCH(1,1)-std | TGARCH(1,1)-std | |
| mu | 0.0003*** | 0.0002** | 0.0002* |
| ar1 | 0.730*** | 0.611*** | 0.602*** |
| ma1 | -0.763*** | -0.644*** | -0.637*** |
| omega | 0.0002*** | 0.00000*** | 0.0001*** |
| alpha1 | 0.162*** | 0.064*** | 0.074*** |
| alpha2 | 0.121*** | ||
| alpha3 | 0.062*** | ||
| alpha4 | 0.112*** | ||
| alpha5 | 0.054*** | ||
| alpha6 | 0.028** | ||
| alpha7 | 0.096*** | ||
| alpha8 | 0.053*** | ||
| gamma1 | 0.133*** | ||
| beta1 | 0.935*** | 0.943*** | |
| shape | 4.827*** | 4.351*** | |
| Observations | 7,582 | 7,582 | 7,582 |
| Log Likelihood | -18,629.390 | -19,265.000 | -19,294.410 |
| Akaike Inf. Crit. | -4.911 | -5.080 | -5.087 |
| Bayesian Inf. Crit. | -4.900 | -5.074 | -5.080 |
| Jarque-Bera | 14,065.070 (p=0.000) | 23,852.760 (p=0.000) | 1,475,782,519.000 (p=0.000) |
| Q(10) resid | 5.173 (p=0.880) | 6.350 (p=0.786) | 49.213 (p=0.00000) |
| Q(20) resid | 12.888 (p=0.883) | 16.067 (p=0.713) | 59.425 (p=0.00001) |
| Q(10) resid sq. | 7.166 (p=0.710) | 1.749 (p=0.998) | 1.559 (p=0.999) |
| Q(20) resid sq. | 52.219 (p=0.0002) | 8.247 (p=0.991) | 1.583 (p=1.000) |
| Note: | p<0.1; p<0.05; p<0.01 | ||
By viewing the above table we can see that the ARMA(1,1)-GARCH(1,1) is slightly better than the other two models. However, I will use the TGARCH model since this has the benefit of being able to model downside volitility better than the other model variants.
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : fGARCH(1,1)
## fGARCH Sub-Model : TGARCH
## Mean Model : ARFIMA(1,0,1)
## Distribution : std
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000245 0.000224 1.0939 0.274020
## ar1 0.529186 0.061643 8.5848 0.000000
## ma1 -0.565228 0.060549 -9.3351 0.000000
## archm 0.820076 0.510066 1.6078 0.107882
## omega 0.000114 0.000026 4.4129 0.000010
## alpha1 0.072821 0.002058 35.3891 0.000000
## beta1 0.943486 0.002313 407.9316 0.000000
## eta11 0.117045 0.050098 2.3363 0.019475
## shape 4.334023 0.215397 20.1211 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000245 0.000234 1.0481 0.294586
## ar1 0.529186 0.021304 24.8395 0.000000
## ma1 -0.565228 0.022326 -25.3170 0.000000
## archm 0.820076 0.468384 1.7509 0.079970
## omega 0.000114 0.000030 3.7606 0.000169
## alpha1 0.072821 0.003109 23.4235 0.000000
## beta1 0.943486 0.002079 453.7705 0.000000
## eta11 0.117045 0.061204 1.9124 0.055827
## shape 4.334023 0.330911 13.0973 0.000000
##
## LogLikelihood : 18753.67
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.0785
## Bayes -5.0701
## Shibata -5.0785
## Hannan-Quinn -5.0756
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 1.002 0.3169
## Lag[2*(p+q)+(p+q)-1][5] 1.743 0.9889
## Lag[4*(p+q)+(p+q)-1][9] 2.751 0.9247
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.6786 0.41006
## Lag[2*(p+q)+(p+q)-1][5] 7.5916 0.03718
## Lag[4*(p+q)+(p+q)-1][9] 13.2491 0.00934
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.07615 0.500 2.000 0.782587
## ARCH Lag[5] 7.67701 1.440 1.667 0.023996
## ARCH Lag[7] 11.46988 2.315 1.543 0.008304
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 6.5607
## Individual Statistics:
## mu 0.9937
## ar1 0.4907
## ma1 0.4951
## archm 0.7362
## omega 1.9972
## alpha1 1.8382
## beta1 1.8039
## eta11 0.5396
## shape 1.1664
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 2.1 2.32 2.82
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 0.9202 0.3575
## Negative Sign Bias 1.4865 0.1372
## Positive Sign Bias 0.6173 0.5371
## Joint Effect 2.5924 0.4588
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 472.6 3.150e-88
## 2 30 550.8 1.003e-97
## 3 40 597.5 4.212e-101
## 4 50 612.2 2.562e-98
##
##
## Elapsed time : 6.967988