Handling with an Error caused by using GARCH(1,1) in Matlab

20 views (last 30 days)
Manuel Schilling
Manuel Schilling on 7 Nov 2017
Answered: Hang Qian on 15 Dec 2017
I need help for handling with an error in matlab caused with the function
from the Economic Toolbox. My exercise is to predict values for value-at-risks by using garch(1,1)-models for discrete returns R of share prices data
for i=1:length(data-1)
of various public companys from 2004 till 2016. Therefore I am using for example 250 discrete returns from the past to predict a value for the actual value-at-risk:
for j=1:length(R)-n
fit = estimate(garch(1,1),x');
estParams = ['Constant',cell2mat(fit.GARCH), cell2mat(fit.ARCH)];
n equals to 250 here. The problem is, that I am always getting this error after certain runs of my if-loop, because the data doesnt fit to a garch(1,1)-model:
Error using VaR_garch (line 21) Estimated GARCH model is invalid.
Caused by: Error using garch/validateModel (line 791) Non-zero degree P requires a non-zero degree Q.
and the corresponding lines of garch.m are
if (Mdl.P > 0) && (Mdl.Q == 0)
So I need to use
in my if-loop, when I get my error. How can I deal with this error, so matlab is going on with estimation the parameters in my if-loop?

Answers (1)

Hang Qian
Hang Qian on 15 Dec 2017
Hi Manuel,
The error message “Non-zero degree P requires a non-zero degree Q” basically says that the conditional volatility is not well-defined in the absence of Q, because the conditional volatility is not a function of past observations when Q=0. A model specification like GARCH(1,0) or GARCH(2,0) will trigger that error.
If the data do not have any sign of volatility clustering, estimating a GARCH(1,1) may result in the estimated coefficient Q equal to zero, hence the error message. For example, estimate(Mdl,rand(100,1)) is likely to have that error message.
There is a work-around: set the optimization algorithm as interior-point so that Q will not be exactly zero.
options = optimoptions(@fmincon,'Algorithm','interior-point');
Mdl = garch(1,1);
In that case, Q can be extremely small if there is no volatility clustering found in the data, but the error message will not pop up. The trick can be useful if we want to estimate many garch(1,1) models in a FOR loop.
Hope that helps,
Hang Qian

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!