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

18 Ansichten (letzte 30 Tage)
Manuel Schilling
Manuel Schilling am 7 Nov. 2017
Beantwortet: Hang Qian am 15 Dez. 2017
I need help for handling with an error in matlab caused with the function
estimate(garch(1,1),x')
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)
R(i-1)=data(i)/data(i-1)-1;
end
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
daten=R(j:(n+j-1));
x=daten-mean(daten)*ones(1,n);
fit = estimate(garch(1,1),x');
estParams = ['Constant',cell2mat(fit.GARCH), cell2mat(fit.ARCH)];
alpha0(j)=estParams(1);
alpha1(j)=estParams(2);
beta1(j)=estParams(3);
end
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)
error(message('econ:garch:validateModel:InvalidModelDegrees'))
end
So I need to use
estimate(garch(1,0),x')
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?

Antworten (1)

Hang Qian
Hang Qian am 15 Dez. 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);
estimate(Mdl,y,'options',options);
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

Kategorien

Mehr zu Conditional Variance Models finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by