Modelling Volatility for Stock Markets
By: Aiswarya Alapuzha
Tags: Arch, Garch, Time Series Analysis, Data Science, Econometrics

The financial data in the real world is very volatile, which means that the variance is changing and hence our ARIMA models cannot be applied (assumes homoscedasticity). Autoregressive Conditional Heteroscedasticity( ARCH )and Generalised Autoregressive Conditional Heteroscedasticity (GARCH) model overcomes this difficulty.

Specifically, an ARCH method models the variance at a time step as a functionof the residual errors from a mean process (e.g. a zero mean).In the GARCH technique a lag parameter must be specified to define the number of prior residual errors to include in the model.

ARCH MODEL

The estimate of the variance based on long run average variance and m observations. Older observations are given less weight.

GARCH MODEL

Just like ARCH(p) is AR(p) applied to the variance of a time series, GARCH(p, q) is an ARMA(p,q) model applied to the variance of a time series.

The introduction of a moving average component allows the model to both model the conditional change in variance over time as well as changes in the time-dependent variance. Examples include conditional increases and decreases in variance.

The model introduces a new parameter “p” that describes the number of lag variance terms:

p: The number of lag variances to include in the GARCH model.

q: The number of lag residual errors to include in the GARCH model.

A generally accepted notation for a G ARCH model is to specify the GARCH() function with the p and q parameters GARCH(p, q); for example GARCH(1, 1) would be a first order GARCH model.

GARCH(1,1) model,

where V_L is the longterm variance

Application of GARCH

Here we are making an attempt to model the volatility of stock market data for Apple for the last 5 years, 2014–2019 in python.We are making a prediction for the returns of the available data.

We can model this series as :

where rt be the returns of a stock (dependent variable)in time t.

σt is the standard deviation of rt in time t, and ϵt is an error term for time t.

A glimpse into the data in hand

We are deseasonalised the level and trend to make the data stationary.

To identify the parameters for the GARCH model we perform Autocorrelation and Partial Autocorrelation on the data.

From the graphs we can assume that the values of p and q can be taken as 1, the first peak in the graphs respectively.

The differencing factor ,d, was earlier found to be 1. Hence now we are ready to plot our model with GARCH.

Result after fitting the model

So now we can make a few observations from the above result. The beta coefficient is very close to 1 but a little bit lower.This is our MA term and hence this was expected.If beta greater than 1 , small noises will amplify over time. In which case the variance explode to an infinite value making regression would be impossible. So in terms of volatility of our model we want beta to be less than 1 in absolute value, but you can’t just take this term in isolation as the AR term has a similar effect.

Omega is the baseline variance for the model. It is the expected variance of the model when past variances are not being passed to the model. So the square-root of omega would be the standard deviation in returns. This coefficient suggests that the standard deviation of returns should be around 11.09% per day which is fairly volatile.

Lastly, the alpha term tells us how much the previous period’s volatility to add to today’s volatility. It turns out that we shouldn’t expect too much clumping to be going on. According to this only about 10% of the previous days volatility will be carried over into the next day.

We expect that our returns will be about -4.67% per day as indicated by the mu coefficient

The results could be obtained after fitting in the model on the dataset. We can check the accuracy with the help of the residues.

The above plot shows that our model fits well on the data, the red colored residue is in line with the actual data.

Now our model is all set to forecast for the future values of the stock for Apple.

Conclusion

We have now had a brief understanding on how to model using the GARCH technique.

Click here for the python notebook

This article was prepared as a part of the PGPDS program at Praxis Business School, Bengaluru.

That’s all for now!

References