Data Products Assessment

GARCH App

Dmitriy

Application overview

  • This app calibrate Generalized Autoregressive Conditional Heteroskedasticity model based on the number of stock indices. The data used here can be found in the EuStockMarkets dataset from datasets package in R;

  • To work with the app, simply choose index name and push Calibrate button;

  • Please note, that choosing an index automaticaly updates its plot. But in order to calculate coefficients and show diagnostic plots, button should be pushed. It was done for efficiency purposes.

What is GARCH

  • GARCH (Generalized Autoregressive Conditional Heteroskedasticity) - is a model proposed by Bollerslev (1986) for conditional normal processes. The main purpose of the model is to represent volatility of time series in terms of previous value of volatility (back to n lags) and so-called "innovation" - adjusted value based on previous error terms (back to m lags).

  • The following form helps better capture changes in scale parameter of the distribution over time. The process is conditional on its second moment, which follows ARMA (Autoregressive Moving Average) model. Generally for (n,m) lags, model takes following form:

\[ \sigma_t^2=\omega+\sum\limits_{i=1}^n {\alpha_i\epsilon_{t-i}^2}+\sum\limits_{i=1}^m {\beta_i\sigma_{t-i}^2}, \]

where \(\sigma_t\) - volatility at the time t, \(\epsilon_t\) - error rate at time t, \(\omega,\alpha_i,\beta_i\) - coefficients that need to be estimated. However, for simple GARCH(1,1) model takes form:

\[ \sigma_t^2=(1-\alpha-\beta)V_L+\alpha_i(r_{t-1}-\mu)^2+\beta_i\sigma_{t-1}^2, \]

\[ r_t=\mu+\sigma_t\epsilon_t, \]

where \(r_t\) - level of the time series (or its log return) on the time t, \(V_L\) - long term volatility of the time series.

Using GARCH in R

GARCH model can be found in the package fGarch. To calibrate model simple GARCH(1,1) based on the data, you must use function garchFit (this code uses garchSim function from the same package to simulate GARCH process, its description can be found in appropriate documentation):

simData<-garchSim(garchSpec(model = list(alpha=0.05,beta=0.9)), n = 1000)
garch.fit<-garchFit(~garch(1,1),data=simData,trace=F)

Since garch.fit is a object of the S4 class, we could access parts of the result by using slots sign @. The following code for instance print coefficent and statistics:

garch.fit@fit$matcoef
##         Estimate  Std. Error  t value  Pr(>|t|)
## mu     2.128e-04   1.402e-04    1.518 1.290e-01
## omega  3.890e-06   2.030e-06    1.916 5.533e-02
## alpha1 6.345e-02   3.149e-02    2.015 4.388e-02
## beta1  7.478e-01   1.153e-01    6.488 8.695e-11

Running diagnostics

To assess how well our model has fitted the data, we could run diagnostics plots. These plots are available via generic plot function.

Below you may find standartized residual plot and qq-plot, reflecting the fact that residuals approximately look like a white noise:

par(mfrow=c(1,2))
plot(garch.fit,which=9)
plot(garch.fit,which=13)

plot of chunk unnamed-chunk-4