# Implementing GARCH(2,2) QMLE: where does the data (squared returns) come into play?

I am trying to implement a QMLE estimation of GARCH(2,2) model as a side project.

We can represent GARCH(2,2) as follows: \begin{aligned} r_{t} &= \mu_{t} + \epsilon_{t}, \\ \mu_{t} &= 0, \\ \epsilon_{t} &= \sigma_{t}z_{t}, \quad z_{t} \sim N(0,1), \\ \sigma_{t+1}^{2} &= \omega + \alpha_{1}\epsilon_{t}^{2} + \beta_{1}\sigma_{t}^{2} + \alpha_{2}\epsilon_{t-1}^{2} + \beta_{2}\sigma_{t-1}^{2}. \end{aligned} Using standard arguments, we can write the log-likelihood as $$\sum_{t}^{T}l(\theta|r_{t}) = \sum_{t=1}^{T}\log\bigg[ \frac{1}{\sqrt{2\pi\sigma^{2}_{t}(\theta)}}\exp\{\frac{r_{t}^{2}}{2\sigma(\theta)_{t}^{2}}\}\bigg]$$ where $$\theta$$ is just the vector of parameters.

This would be estimated, at each time $$t$$ by plugging in $$\omega + \alpha_{1}\epsilon_{t-1}^{2} + \beta_{1}\sigma_{t-1}^{2} + \alpha_{2}\epsilon_{t-2}^{2} + \beta_{2}\sigma_{t-2}^{2}$$ instead of $$\sigma_{t}^{2}$$ and $$r_{t}^{2}$$ (data). However, my problem is basically that I cannot understand whether

1. $$r_{t}^{2}$$ is the data that we have (which would be logical) or
2. if $$r_{t}^{2}$$ is simply generated from previous iterations of $$\sigma_{t}^{2}$$, as $$r_{t}^{2} = \epsilon_{t}^{2} = z_{t}^{2}\sigma_{t}^{2}=z_{t}^{2}(\omega + \alpha_{1}\epsilon_{t-1}^{2} + \beta_{1}\sigma_{t-1}^{2} + \alpha_{2}\epsilon_{t-2}^{2} + \beta_{2}\sigma_{t-2}^{2})$$.

The latter doesn't make sense, and it means I only need to initialize the process and then I wouldn't need any data to fit it, and this is exactly what confuses me.

If the former is true, then how can we say that $$r_{t} = \epsilon_{t}$$?

I have already checked this post, which was quite helpful, but still does not answer my question.

Perhaps it has to something with conditioning on information at time $$t$$, but I am struggling to clearly understand this.

If the model were true, you would find that $$r_{t}^{2} = \epsilon_{t}^{2} = z_{t}^{2}\sigma_{t}^{2}=z_{t}^{2}(\omega + \alpha_{1}\epsilon_{t-1}^{2} + \beta_{1}\sigma_{t-1}^{2} + \alpha_{2}\epsilon_{t-2}^{2} + \beta_{2}\sigma_{t-2}^{2}).$$ This provides a way to generate a time series $$\{r_t\}_{t=1}^T$$ given the starting values and the parameters. Suppose that God or nature did that, and now you have observed $$\{r_t\}_{t=1}^T$$. If you wish to find out what parameters and starting values were used to generate this time series, you can use the data $$\{r_t\}_{t=1}^T$$ to estimate them using, say, maximum likelihood.
P.S. Note that $$z_t\sim \text{i.i.d.}\ N(0,1)$$, not only $$z_t\sim N(0,1)$$.