function LLF = E_GARCHLLF(x,T,y,h,a);
p=((2^(-2/exp(x(6))))*gamma(1/exp(x(6)))/gamma(3/exp(x(6))))^.5;
f=p*(2^(1/exp(x(6))))*gamma(2/exp(x(6)))/gamma(1/exp(x(6)));
h(1)=x(5);
a(1)=y(1,1)-x(7)-(x(8)*y(1,2))+(exp(x(9))*y(1,3))+(x(10)*sin((x(11)*pi)+x(12)));
ll(1)=-(log(exp(x(6))/p)-(.5*((abs(a(1)/(exp(h(1)/2)*p)))^exp(x(6))))-((1+(1/exp(x(6))))*log(2))...
    -(log(gamma(1/exp(x(6)))))-(.5*h(1)));
for j=2:T;
    h(j)=x(1)+(x(2)*h(j-1))+(x(3)*(a(j-1)/(exp(h(j-1)/2))))+(x(4)*(abs(a(j-1)/(exp(h(j-1)/2)))-f));
    a(j)=y(j,1)-x(7)-(x(8)*y(j,2))+(exp(x(9))*y(j,3))+(x(10)*sin((x(11)*j*pi)+x(12)));
    ll(j)=-(log(exp(x(6))/p)-(.5*((abs(a(j)/(exp(h(j)/2)*p)))^exp(x(6))))-((1+(1/exp(x(6))))*log(2))...
    -(log(gamma(1/exp(x(6)))))-(.5*h(j)));
end
LLF=sum(ll(:));
if isnan(LLF) | isinf(LLF) | ~isreal(LLF);
   LLF  =  1e+20;
end