I asked this on stats.stackexchange but I realized this might be a better place to ask this question.

I am new to finance and volatility forecasting and am trying to understand how garch model works. Even though there are many tutorials on how to use arch_model from Python, none of them gives explanations of what happens behind the scenes.

After getting data

start = datetime(2010, 1, 1)
end = datetime(2021, 3, 31)
df = web.DataReader(['sp500'], 'fred', start, end)

We can simply compute returns and fit the model with

df['pct_change'] = df['sp500'].pct_change().dropna()
returns = df['pct_change'] * 100
am = arch.arch_model(returns)
res = am.fit()

Parameters I get are

mu          0.083702
omega       0.041945
alpha[1]    0.212129
beta[1]     0.754365

Now getting forecast of the volatility of the next day using all of the days before is:

vol_forecast = 0.01 * np.sqrt(res.params['omega'] + res.params['alpha[1]'] * res.resid**2 + res.conditional_volatility**2*res.params['beta[1]'])

May questions are the following:

  1. How can we compute residuals and conditional volatility ourselves, i.e. without resid and conditional_volatility from arch_model, only using data?

  2. How do we evaluate those models? We can get AIC and BIC from model summary but my question is rather if I want to do backtesting step by step and I forecast following 7 days (in this case 1st to 7th of April) how can I actually see how good my model performed in those seven days? If the answer is to use some of those information criteria which would be the best and how can I compute it by hand? In other words if I only have 7 numbers which are predictors of volatility in the next 7 days and 7 returns, how should I proceed?

  1. And lastly does the number I will get in forecast, say 1.4% means only that tomorrow's price of stock will 68% of time differ by 1.4% from today's price.

It would also be helpful to get any reading on this topic including building garch from scratch in Python.

Every answer is much appreciated! Thanks in advance!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.