# Fitting a GARCH(1, 1) model

I am trying to fit my own GARCH(1,1) model using python. I have read numerous papers at this point looking for the log likelihood function of the parameters that I need to optimize. To further confuse matters, each different thing I read comes up with a slightly different variation.

This paper discusses a little bit on the nature of the parameters. Namely, they are normally distributed.

The most clear explanation of this fit comes from Volatility Trading by Euan Sinclair. Given the equation for a GARCH(1,1) model:

$\sigma_t^2 = \omega + \alpha r_{t-1}^2 + \beta\sigma_{t-1}^2$

Where $r_t$ is the t-th log return and $\sigma_t$ is the t-th volatility estimate in the past. Given this, the author hand-waves the log-likelihood function:

$\sum \limits_{i=1}^t [-ln(\sigma_t^2) - \frac{r_t^2}{2\sigma^2_i}]$

However, unfortunately he doesnt indicate how this needs to be used, nor how it is derived. I understand using MLE $\gamma, \alpha, \beta$ need to be deduced. Somehow I will need to use the derivatives of this function to get the results.

Is there an explanation that can lead me to being able to implement this myself? Everything I've seen so far falls woefully short of explaining the entire process, and every paper and book I read derives a different LL equation.

• I have already answered this fully in the Quantitative Finance (QF) forum of SE. See quant.stackexchange.com/questions/9351/… – JoleT Sep 19 '18 at 23:35
• In your question the author of the question notices the same thing. Why are there so many different formulas? Which one do I choose and why? – CL40 Sep 20 '18 at 1:32
• Additionally, this question is for AR(1)-GARCH(1,1). What is the difference between this and GARCH(1,1)? – CL40 Sep 20 '18 at 1:38
• I guess a third question for you while im asking them - you didn't specify an optimization. I have seen people use "Solver" in excel, which is a linear programming solver. I have also seen gradient descent used. Is there a reason to prefer one over the other for this problem? – CL40 Sep 20 '18 at 2:59
• You would need to look at those original papers to learn about the difference between AR(1)/GARCH(1,1) and GARCH(1,1). Use the formula in the SOLUTION for maximizing the likelihood, if you want to follow the same solution. You have to understand that the "quants" visiting the QF forum, when learning that function maximization is required, would merely, go "okay -- I'll use my favorite maximizer." – JoleT Sep 21 '18 at 22:58

I explain how to get the log-likelihood function for the GARCH(1,1) model in the answer to this question.

The GARCH model is specified in a particular way, but notation may differ between papers and applications. The log-likelihood may differ due to constants being omitted (they are irrelevant when maximizing).

The MLE is typically found using a numerical optimization routine.

A quick implementation example in python:

1. define relevant packages:

1. define algorithm

1. check if output is reasonable