# Optimal lag length selection criterion in GARCH(p,q) model using MATLAB

As assessed by the title, I'm trying to estimate a GARCH(p,q) model to forecast stock market volatility and, in order to be able to do that, I've to identify the optimal number of lags, p and q, to fit the model properly. Can someone of you suggest me the proper function/procedure to do that in Matlab? I looked for that in Mathworks and in the Internet, but I found nothing whatsoever. Thanks for helping.

• mathworks.com/help/econ/conduct-a-likelihood-ratio-test.html – John Mar 11 '14 at 22:34
• Thanks John, I already took a look to that link and conducted that analysis, but that procedure only compares different GARCH(p,q) model and provide the best one among two ones; I would like to find the correct number of lags to estimate GARCH, for instance, using AIC/BIC/SIC information criterion. – Quantopik Mar 12 '14 at 8:00
• Matlab's GARCH outputs the log-likelihood, which is the primary input to AIC/BIC. Just write a function that loops over the relevant parameters, calculate AIC/BIC, then selects the one with the best. – John Mar 12 '14 at 16:46

work you way from GARCH(4,4) to GARCH(0,0) removing the intercept too. 5*5*2-1 = 49 estimations

1. Make sure your coefficients are all statistically significant at least to 95% confidence.
2. Make sure you have no autocorrelation in your error terms. pacf and acf should be clean.
3. Likelihood ratio tests assess whether you lose explaining power from removing/adding lags.

Lastly your real test should be an out-of-sample study of the forecast error distribution, and really look at whether your GARCH adds value.

It's ok to have a biased estimation of the conditional variance if the forecast error variance is smaller than a non-biased estimation. But again, that depends on the use you have for your forecast.

• This is an adaptation of the Box-Jenkins procedure useful for ARMA models. – not.so.quanty Mar 18 '14 at 5:26

If you have the optimization toolkit, you can download a free software package written by Kevin Sheppard of the Mann Quantitative Finance Institute at the Uni of Oxford. He has all the tools you'll need. Link below.

Generally, there's no agreed upon methodology to do what you want to do. You should start by plotting the auto-correlations of your time series and the partial auto-correlations and taking a look to see where the bulk of concentration is. This should give you a starting point. Since GARCH/ARCH/etc. are auto-regressive, the number of lags is not super important.

Then test up from 1/1 to whatever you deem necessary. Compare BICs. I wouldn't go with AIC simply because it doesn't punish noise from added lags enough.

http://www.kevinsheppard.net/wiki/MFE_Toolbox