Thursday, July 13, 2017

time series - How GARCH/ARCH models are useful to check the volatility?


Below a R code wrote by the moderator @richardh (whom I want to thank again) about ARCH/GARCH models.


library(quantmod)
library(tseries)
getSymbols("MSFT")
ret <- diff.xts(log(MSFT$MSFT.Adjusted))[-1]
arch_model <- garch(ret, order=c(0, 3))
garch_model <- garch(ret, order=c(3, 3))
plot(arch_model)

plot(garch_model)

My focus is to understand if the volatility of the returns is constant during all the series. I don't understand how ARCH/GARCH models could help me understading this kind of aspect, at the moment the operations I do are:



  • Calculate the % returns of the stocks

  • Linear regressione like: lm(A~B) where A and B are the stocks returns (%)

  • Passing the residuals of the linear regression to the unit root tests.


now the problem is to understand if the volatility is constant (take a look at the chart below, that problem is clearly visible), so the question is:


How can I understand if the volatility is not constant reading ARCH/GARCH model Non stationary volatility



EDIT:


garch_model <- garch(rnorm(1000), order=c(3, 3))
> summary(garch_model)

Call:
garch(x = rnorm(1000), order = c(3, 3))

Model:
GARCH(3,3)


Residuals:
Min 1Q Median 3Q Max
-3.394956 -0.668877 -0.008454 0.687890 3.221826

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
a0 7.133e-01 7.156e+00 0.100 0.921
a1 1.752e-02 3.750e-02 0.467 0.640
a2 6.388e-03 1.924e-01 0.033 0.974
a3 6.486e-14 1.711e-01 0.000 1.000

b1 7.396e-02 1.098e+01 0.007 0.995
b2 8.052e-02 1.120e+01 0.007 0.994
b3 8.493e-02 4.279e+00 0.020 0.984

Diagnostic Tests:
Jarque Bera Test

data: Residuals
X-squared = 1.4114, df = 2, p-value = 0.4938



Box-Ljung test

data: Squared.Residuals
X-squared = 0.0061, df = 1, p-value = 0.9377

>

garch_model$fitted.values enter image description here




No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...