function [LL]=NoArb3facLLZeros(THETA)

global Y

[F,Q,H,R,EE]=NoArb3facZeros(THETA);


if EE==1;
    
    n=length(H(:,1)); %dimension of observables;
    
    RR=R*R';
    QQ=Q*Q';
    dimX=3;%dimension of state;
    T=length(Y(1,:));
    xhat0=zeros(dimX,1);% define starting values for state
    
    T=length(Y);
    
    LL=0;
    
    P=reshape(inv(eye(dimX*dimX)-kron(F,F))*QQ(:),dimX,dimX);
    Xfilt=zeros(dimX,1); %initial value for the filtered state.
    
    for tt=1:T
        a=Y(:,tt)-H*Xfilt;
        Omega=H*P*H'+RR;
        Omegainv=inv(Omega);
        K=F*P*H'*Omegainv;
        L=F-K*H;
        Xfilt=F*Xfilt+K*a;
        P = F*P*L' + QQ;
        LL = LL - 0.5*(log(det(Omega)) + a'*Omegainv*a);
    end
    if imag(LL)~=0
        LL=-9e+200;
    end
    %     lpostcan=LL;
else
    LL=-9e+200;
end

%We are minimizing!
LL=-LL;