GARCH

GARCH stands for generalized autoregressive conditional heteroscedasticity. One of the assumptions in OLS estimation is that variance of error should be constant. However, in financial time series data, some periods are comparatively more volatile, which contributes to rise in strengths of the residuals, and also these spikes are not randomly placed due to the autocorrelation effect, also known as volatility clustering, that is, periods of high volatility tend to group together. This is where GARCH is used to forecast volatility measures, which can be used to forecast residuals in the model. We are not going to go into great depth but we will show how GARCH is executed in R.

There are various packages available in R for GARCH modeling. We will be using the rugarch package.

Let us first install and load the rugarch package, which can be done by executing the following code:

>install.packages("rugarch") 
>Library(rugarch) 
 >snp <- read.zoo("DataChap4SP500.csv",header = TRUE, sep = ",",format="%m/%d/%Y") 

Now let us define the specs for the GARCH model and try to estimate the coefficients by running the following code:

> gspec.ru <- ugarchspec(mean.model=list( armaOrder=c(0,0)), distribution="std") 
> gfit.ru <- ugarchfit(gspec.ru, snp$Return) 
> coef(gfit.ru) 

This gives the following output:

GARCH

Figure 4.17: Summary of coefficients estimate of GARCH

The main arguments for GARCH modeling are as follows:

  • Variance model: List containing the variance model specifications, especially which GARCH model to use and what should be the orders of p and q in ARCH (q) and GARCH (p).
  • Mean model: List containing the mean model specifications: arma order the autoregressive (AR) and moving average (MA) orders.
  • Distribution model: The conditional density to use for the innovations. Valid choices are norm for the normal distibution, snorm for the skew-normal distribution, std for the student -t, and so on.

Now we can generate our forecast according to our requirement, which is given by the following code:

> FutureForecast=ugarchforecast(gfit.ru, n.ahead = 5) 
> FutureForecast 

The output is as follows:

GARCH

Figure 4.18: GARCH model forecast

There are a lot of options in the GARCH model and we can use it according to our requirement.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset