Maximum likelihood Garch with fmincon

Guys,
I am working to create a model Garch with the implementation of another exogenous variable; but I have some problem with the function fmincon
I have a log_lk_GARCH11VIX function with y data.
theta = [0.1;0.3;0.2;0.4];
lb = [0;
0
0
0];
ub = [100;
0.999999
0.999999
0.999999];
%too many input
[x,fval,exitflag,output,labda,grad,hessian] = fmincon('log_lk_GARCH11VIX',theta,[],[],[],[],lb,ub)
this is the error:
Error using barrier
Objective function is undefined at initial point. Fmincon cannot continue.
Error in fmincon (line 834)
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] =
barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options.HessFcn, ...
Error in esti (line 16)
[x,fval,exitflag,output,labda,grad,hessian] =
fmincon('log_lk_GARCH11VIX',theta,[],[],[],[],lb,ub)

Answers (1)

Matt J
Matt J on 11 Jul 2020
Check log_lk_GARCH11VIX(theta). It is returning a bad value.

3 Comments

function [log_lik] = log_lk_GARCH11VIX(theta)
global y y11
[T] = size(y,1);
omega = theta(1,1);
alpha = theta(2,1);
beta=theta(3,1);
delta =theta(4,1);
sigma2 = zeros(T,1);
log_likelihood_i = zeros(T,1);
sigma2(1,1) = omega;
log_likelihood_i(1,1) = -0.5 * log(2*pi) - 0.5* log(sigma2(1,1)) - 0.5/sigma2(1,1)*(y(1,1))^2;
for t = 2 : 1 : T
sigma2(t,1) = omega + alpha * y(t-1,1)^2 + beta * sigma2(t-1,1)^2 + delta * y11(t-1,1)^2;
log_likelihood_i(t,1) = -0.5 * log(2*pi) - 0.5* log(sigma2(t,1)) - 0.5/sigma2(t,1)*(y(t,1))^2;
end
log_lik = -sum(log_likelihood_i);
end
I suppose everything is okay here.
I think there is a mistake in the fmincon input/outputs.
I don't know where.
I suppose everything is okay here.
Why? The error message has told you that the objective function returns a bad value at
theta = [0.1;0.3;0.2;0.4];
Did you check the output when this particular theta is given?

Sign in to comment.

Categories

Asked:

on 11 Jul 2020

Commented:

on 11 Jul 2020

Community Treasure Hunt

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

Start Hunting!