代写 math statistic GARCH Models

GARCH Models

When the squared values of the time series are autocorrelated, we say that we have an ARCH Effect.

alpha0 <- 0.1 alpha1 <- 0.4 beta1 <- 0.2 w <- rnorm(10000) a <- rep(0, 10000) h <- rep(0, 10000) for (i in 2:10000) { h[i] <- alpha0 + alpha1 * (a[i - 1]^2) + beta1 * h[i - 1] a[i] <- w[i] * sqrt(h[i]) } stemp <- scan("http://www.maths.adelaide.edu.au/andrew.metcalfe/Data/stemp.dat") stemp.ts <- ts(stemp, start = 1850, freq = 12) plot(stemp.ts) stemp.best <- get.best.arima(stemp.ts, max.order=rep(2,6)) stemp.best[[3]] stemp.arima <- arima(stemp.ts, order = c(1, 1, 2), seas = list(order = 0, 1), 12)) stemp.arima stemp.arima <- arima(stemp.ts, order = c(1, 1, 2), seas = list(order = 0, 1), 12)) stemp.arima Model Validation • To check for goodness-of-fit, use correlogram and Ljung-Box test of residuals from the ARIMA model. • In addition, to investigate volatility, use correlogram and Ljung-Box test of the squared residuals. stemp.res <- resid(stemp.arima) acf(stemp.res); Box.test(stemp.res,lag=20) tsdiag(stemp.res^2); Box.test(stemp.res^2,lag=20) • There is clear evidence of volatility, since most of the squared values of the residuals are correlated. Hence, a garch model is fitted to the residual series: stemp.garch <- garch(stemp.res, trace = F) stemp.garch$coef/sqrt(diag(stemp.garch$vcov)) stemp.garch.res <- resid(stemp.garch)[-1] acf(stemp.garch.res); Box.test(stemp.garch.res,lag=12) acf(stemp.garch.res^2); Box.test(stemp.garch.res^2,lag=12) • The coefficients of the fitted GARCH model are all statistically significant. Furthermore, the correlogram plots show no obvious patterns of significant values. Hence, a satisfactory fit has been obtained.