Maximize loglikelihood function GARCH(1,1)

조회 수: 19 (최근 30일)
Anth Cos
Anth Cos 2015년 12월 27일
답변: Brendan Hamm 2015년 12월 28일
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!

답변 (2개)

Alan Weiss
Alan Weiss 2015년 12월 28일
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 2015년 12월 28일
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).

카테고리

Help CenterFile Exchange에서 Conditional Variance Models에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by