function fval = rbcb_monprud_nobias_ramsey_infl_bt_endoss(variablesguess,instr1,instr2)


global M_ 

%% assign variables and parameter values 

num_variablesguess=size(variablesguess,1);
for idxxx=1:1:num_variablesguess
    define_string=[M_.endo_names_reduced(idxxx,:),'=',sprintf('%20.20g',variablesguess(idxxx))];
    evalc(define_string);
end

if isnan(M_.params(:,:))==0
    %read parameter values from M_.params and assign to parameters names.
    %this overwrites parameters coming from params.m if estimation is done.
    num_para=size(M_.params,1);
    for idxxx=1:1:num_para
        define_string=[M_.param_names(idxxx,:),'=',sprintf('%20.20g',M_.params(idxxx))];
        evalc(define_string);
    end
end
 
 
fval(1) = Util - ( omega_welf1*Util1+omega_welf2*Util2); 
 
fval(2) = Welf - ( Util + nbeta*Welf); 
 
fval(3) = Welf1 - ( Util1 + nbeta*Welf1); 
 
fval(4) = Welf2 - ( Util2+ nbeta*Welf2); 
 
fval(5) = instr1 - ( infl); 
 
fval(6) = instr2 - ( bt); 
 
fval(7) =  btlag - (bt);  
fval(8) = clag - (c);  
fval(9) = etalag - (eta);  
fval(10) = iglag - (ig);  
fval(11) = infllag - (infl);  
fval(12) = klag - (k);  
fval(13) = llag - (l);  
fval(14) = rmonlag - (rmon);  
fval(15) = qlag - (q);  
fval(16) = rlag - (r);  
fval(17) = nlag - (n);  
fval(18) = slag - (s);  
fval(19) = vlag - (v);  
fval(20) = ylag - (y);  
  
 
 
 
 
 
 
 
fval(21) = lambdac - ( 1/(c-gammap*clag+cpref)-betavar*gammap/(c-gammap*c+cpref)); 
 
fval(22) = chi0p*l^chip - ( lambdac*w); 
 
fval(23) = lambdac/lambdac - ( 1/(betavar*(1+r))); 
 
fval(24) = q*s - ( eta/(lambda-v)*n*(1-bt)); 
 
fval(25) = n - ( thetap *((rs-r)*etalag/(lambda-vlag)+1+r)*nlag*(1-btlag) + baromegap*q*slag); 
 
fval(26) = v - ( (1-thetap)*betap*lambdac/lambdac*(rs-r)+thetap*betap*lambdac/lambdac*( (eta/(lambdap-v)) / (eta/(lambdap-v))*((rs-r)*eta/(lambdap-v)+1+r))*(1-bt)*v); 
 
fval(27) = eta - ( (1-thetap)+thetap*betap*lambdac/lambdac*((rs-r)*eta/(lambdap-v)+1+r)*(1-bt)*eta); 
 
fval(28) = k - ( s); 
 
fval(29) = y - ( exp(z)*klag^alphap*l^(1-alphap)); 
 
fval(30) = l - ( (1-alphap)*sigma*y/w); 
 
fval(31) = 1+rs - ( alphap*sigma*y/(q*klag)+(1-deltap)*q/q); 
 
fval(32) = 0 - ( (-(1+taup+markup)/nup + sigma*(1 + nup)/nup)*y ... 
    - y*dphidp ... 
    - (1/(1+rmon))*y*dphidlp); 
 
fval(33) = phi - ( (phip/2)*(infl/(indexp*infllag+(1-indexp)*infl_ss) - 1)^2); 
fval(34) = dphidp - ( phip*(infl/(indexp*infl+(1-indexp)*infl_ss) - 1)*infl/(indexp*infl+(1-indexp)*infl_ss)); 
fval(35) = dphidlp - ( -phip*(infl/(indexp*infl+(1-indexp)*infl_ss) - 1)*infl^2/(indexp*infl+(1-indexp)*infl_ss)); 
 
fval(36) = k - ( in+(1-deltap)*klag); 
 
fval(37) = in - ( (1-psip/2*(ig/iglag-1)^2)*ig); 
 
fval(38) = q*(1-psip/2*(ig/ig-1)^2)-q*psip*(ig/ig-1)*ig/ig+betavar*lambdac/lambdac*q*psip*(ig/ig-1)*ig^2/ig^2 - ( 1); 
 
fval(39) = y - ( c+ig+gc+phi*y); 
 
fval(40) = gc - ( omegagyp*y); 
 
fval(41) = spread - ( rs - rlag); 
 
fval(42) = l2n - ( eta/(lambdap-v)); 
 
fval(43) = lambdac/lambdac/infl - ( 1/(betavar*(1+rmon))); 
 
fval(44) = n2y - ( n/y); 
 
fval(45) = Util1 - ( (log(c-gammap*clag+cpref)-chi0p*l^(chip+1)/(chip+1))); 
 
fval(46) = Util2 - ( (log(c-gammap*clag+cpref)-chi0p*l^(chip+1)/(chip+1))); 
 
 
 
fval(47) = lambda - lambdap - ( rholambdap*(lambda - lambdap) + sigmalambdap*0); 
 
fval(48) = betavar - betap - ( rhobetavarp*(betavar-betap)+sigmabetavarp*0); 
 
fval(49) = cpref - ( rhocprefp*cpref + sigmacprefp*0); 
 
fval(50) = z - ( rhozp*z+sigmazp*0); 
 
fval(51) = markup - ( rhomarkup*markup+sigmamarkup*0); 
