function [LLF,llk,penalty,sigma_e,K0Q_cP, K1Q_cP] = jsz_like_L_macro6(parameters,yields, W, mats, dt, innovations,L,NFACT)
% if max(parameters(1:3))>1
    npar=length(parameters(NFACT+2:end));
    %parameter restrictions
    lb=[-0.9*ones(NFACT,1)+1;0;-inf*ones(npar,1)];
ub=[-.0001*ones(NFACT,1)+1;0.4;inf*ones(npar,1)];
% A = [[1 -1 0; 0 1 -1] zeros(2,npar+1)];
% b = [0;0];
tmp=zeros(NFACT-1,NFACT);
jj=1;
for j=1:NFACT-1
    tmp(j,jj:jj+1)=[1 -1];
    jj=jj+1;
end
A=[tmp zeros(NFACT-1,npar+1)];
b=zeros(NFACT-1,1);
if any(parameters>ub)||any(parameters<lb)||any(A*parameters<b)
    LLF=inf;
 
else
    K1Q_X = diag(parameters(1:NFACT)-1);
    rinfQ = parameters(NFACT+1);
    sig_p = veclt(parameters(NFACT+2:end));
    Sigma_cP = sig_p*sig_p';
  
    [llk, penalty,~, ~, ~, ~, sigma_e,K0Q_cP, K1Q_cP, rho0_cP, rho1_cP, cP, llkP, llkQ] = ...
        jszLLK_L_macro5(yields, W, K1Q_X, rinfQ, Sigma_cP, mats, dt, innovations,L,NFACT);
 
    LLF = sum(llk);
end