function [L] = neolike(thet,y2); beta=1/(1+exp(thet(1))); g=1/(1+exp(thet(2))); ro=exp(thet(3)); alpha=1/(1+exp(thet(4))); fi=1/(1+exp(thet(5))); lambda=1/(1+exp(thet(6))); delta=1/(1+exp(thet(7))); sigmay=exp(thet(8)); sigmak=exp(thet(9))+0.00000000001; sigmac=exp(thet(10)); sigmal=exp(thet(11)); vol=exp(thet(12)); y0=y2(:,1); k0=y2(:,2); c0=y2(:,3); l0=y2(:,4); beta=0.96; %g=0.018; ro=3; alpha=1/3; %fi=0.17; %lambda=0.95; %delta=0.08; %vol=0.0002; %new parameters - definitions teta=((((1+g)^(1-fi*(1-ro)))/beta)-(1-delta))/alpha;%%=cap/gdp nu=1-(delta+g)/teta; %=cons/gdp labor=1-1/(1+fi*(1-alpha)/(nu*(1-fi))); %steady state values cap=labor/(teta^(1/(1-alpha))); gdp=teta*cap; cons=nu*gdp; %more parameter definitions phi=alpha*beta*gdp/((1+g)*cap); omega=fi*(1-ro)-1; a1=labor/(1-labor); pi=(1-fi)*(1-ro)*a1; %matrices D=[ 0,-phi,-omega,pi,0,phi,omega,-pi; -gdp,(1+g)*cap,cons,0,0,0,0,0; 1,0,0,-(1-alpha),-1,0,0,0; 1,0,-1,-(1+a1),0,0,0,0; 0,0,0,0,1,0,0,0; 1,0,0,0,0,0,0,0; 0,1,0,0,0,0,0,0; 0,0,1,0,0,0,0,0;]; E=[ 0,0,0,0,0,0,0,0; 0,(1-delta)*cap,0,0,0,0,0,0; 0,alpha,0,0,0,0,0,0; 0,0,0,0,0,0,0,0; 0,0,0,0,lambda,0,0,0; 0,0,0,0,0,1,0,0; 0,0,0,0,0,0,1,0; 0,0,0,0,0,0,0,1;]; %use gensys [G,C,impact,fmat,fwt,ywt,gev,eu]=gensys(D,E,zeros(8,1),[0;0;0;0;1;0;0;0],[0,0,0; 0,0,0; 0,0,0; 0,0,0; 0,0,0; 1,0,0; 0,1,0; 0,0,1]); if eu(1)==1 && eu(2)==1 F = G([1,2,3,4,5],[1,2,3,4,5]); %H = [1 0 0 0 0; 0 0 1 0 0; 0 0 0 1 0]; H=[eye(4),zeros(4,1)];%G([1,2,3,4],[2,5]); Q = vol*impact([1,2,3,4,5])*impact([1,2,3,4,5])'; %R = diag([sigmay,sigmac,sigmal]); R = diag([sigmay,sigmak,sigmac,sigmal]); %initx = [y0(1);0;c0(1);l0(1);0]; initx = [y0(1);k0(1);c0(1);l0(1);0]; initV = 0.1*eye(5); %y1=[y0,c0,l0]'; y1=y2'; [xfilt, Vfilt, VVfilt, loglik] = kalman_filter(y1, F, H, Q, R, initx, initV); L=-loglik; else L=100000000000000000000000000; end