# GARCH modelling by maximum likelihood in R

I would like to estimate the following ARCH model in R by maximum likelihood.

$Y = \alpha + \varepsilon_{t} - \theta \varepsilon_{t-1} \newline \sigma^{2}_{t} = a + b \left (\sum_{i=1}^{22} \frac{\varepsilon^{2}_{t-1}}{22} \right )$

This question is related to: Maximum likelihood estimation of GARCH modelling in R

The answer given to another question is helpful, but uses python: Fitting a GARCH(1, 1) model

Thus, I am hoping for an answer that can tie all of this together by showing how to maximize the GARCH likelihood function in R and also allow for customization of the variance equation as in my case.

• ok so I think you have some errors in the model equations ... the sum is over $i$ but the index on lagged error is over $t$. Also the equation linking $\sigma$ to $\epsilon$ is missing but I guess you have something like $\epsilon = \sigma z$ with $z$ being what distribution? (kind of essential for the likelihood). Then there is the fact that you restrict all coefficient of lagged error terms to have the same value, is that intentional? – Stop Closing Questions Fast Oct 28 '19 at 19:34
• The sum should be over t not i (my error). z is normal distribution. Yes, all the coefficients of lagged error terms are equal. That is intentional. – user1491868 Oct 28 '19 at 21:16
• try the rugarch package, I do not know whether you can impose that specific restriction, you might have to code that yourself, but the rugarch package is in my opinion the best for univariate arch-family models in R. – Stop Closing Questions Fast Oct 28 '19 at 21:53
• I agree the rugarch package is excellent. But it doesn't allow for my weird variance equation. Plus I think it would be helpful to have a generic maximum likelihood solution on here that others could use and modify as needed. – user1491868 Oct 28 '19 at 23:16