Maximize loglikelihood function GARCH(1,1)

18 vues (au cours des 30 derniers jours)
Anth Cos
Anth Cos le 27 Déc 2015
Hello, I am a new user in Matlab. I want to maximise a loglikelihood function for a normal distribution in order to estimate parameters of a GARCH(1,1). The problem is that when I use fminsearch, after 10 iterations parameters does not change anymore. I use this Matlab code :
Amazon = xlsread('C:\Users\anth000\Desktop\Apple.xlsx');
Return = Apple(1:231,6); SReturn = power(Return,2);
x0 = [0 0.2 0.2];
options = optimset('MaxFunEvals',1e10, 'MaxIter', 10000, 'TolX', 1e-5);
[params, feval] = fminsearch(@(b)LLF(b, SReturn), x0, options);
  • _ The objective function :_*
function y = LLF(params,SReturn)
omega = params(1); alpha = params(2); beta = params(2);
Agarch(231) = 0.000441;
for i = 1:230 Agarch(231-i) = omega + alpha * SReturn(232-i) + beta * Agarch(232-i); end
y = -(- 0.5*231*log(2*3.1415) - 0.5*sum(log(Agarch)) - 0.5*(sum(SReturn)/sum(Agarch)));
Can you help me please ?
Thank you!

Réponses (2)

Alan Weiss
Alan Weiss le 28 Déc 2015
You might just be running into a limitation of fminsearch, which is not a very robust solver. If you have access to Optimization Toolbox, you might do better with fminunc or fmincon.
It is also possible that choosing different initial points could help, or rerunning fminsearch after it stalls could help. See the Optimization Toolbox documentation for more suggestions.
Alan Weiss
MATLAB mathematical toolbox documentation

Brendan Hamm
Brendan Hamm le 28 Déc 2015
Also, the Econometrics Toolbox will perform a GARCH fitting for you:
mdl = garch(1,1);
EstMdl = estimate(mdl,Return);
If you prefer to go your route, then take Alan's advice (fmincon), but you need to take into into consideration the constraints in this model, that is omega > 0; alpha >=0; beta >= 0; alpha + beta < 1. It seems in your objective function you extract params(2) to both alpha and beta, which is likely a mistake. Furthermore this process is meant to model a heteroskedatic variance process, and since you call your variable returns I highly doubt that it is a variance you are modeling (i.e. contains negative values).

Catégories

En savoir plus sur Conditional Variance Models dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by