% q_k = 1
% q_h = 1
% x_ss = eps_y/(eps_y - 1)
% r_d = piss/betap - 1
% r_pol = ((eps_d - 1)/eps_d)*r_d
% r_biw = (eps_biw/(eps_biw - 1))*r_pol
% r_bih = (eps_bih/(eps_bih - 1))*r_pol
% r_be = (eps_be/(eps_be - 1))*r_pol
% lam_p = 1/c_p
% lam_i = 1/c_i
% lam_e = 1/c_e
% s_ih = (1/(1 + r_bih) - betai/piss)*lam_i
% s_iw = (1/(1 + r_biw) - betai/piss)*lam_i
% s_e = (1/(1 + r_be) - betae/piss)*lam_e
% c_p = w_p*l_p + ((1 + r_d)/piss - 1)*d + luc_y - deltah*h_p
% c_i = w_i*l_i - ((1 + r_bih)/piss - 1)*b_ih - ((1 + r_biw)/piss - 1)*b_iw-deltah*h_i
% c_e = y_e/x_ss - w_p*l_p - w_i*l_i - er*pQ*Q - ((1 + r_be)/piss - 1)*b_e- deltak*k - deltah*h_e
% h_p = jh/((1 - (1 - deltah)*betap)*lam_p)
% h_i = jh/((1 - (1 - deltah)*betai)*lam_i - (1 - deltah)*s_ih*mih*piss)
% h_e = jh/((1 - (1 - deltah)*betae)*lam_e - (1 - deltah)*s_e*me*piss)
% b_ih = (1/(1 + r_bih))*mih*qh*(1 - deltah)*h_i*piss
% b_iw = (1/(1 + r_biw))*miw*w_i*l_i*piss
% b_e = (1/(1 + r_be))*me*( q_h*(1 - deltah)*h_e*piss + q_k*(1 - deltak)*k*piss)
% d = b_ih + b_iw + b_e - er*B_star - k_b
% w_p = (eps_l/(eps_l - 1))*(l_p ˆ phi)/lam_p
% w_i = (eps_l/(eps_l - 1))*(l_i ˆ phi)/(lam_i + s_iw*miw)
% y_e = (k ˆ alphak)*(l_p ˆ (mu*alphal))*(l_i^((1 - mu)*alphal))*(Q^(1 -alphal - alphak))
% l_p = (mu*alphal/x_ss)*(y_e/w_p)
% l_i = ((1 - mu)*alphal/x_ss)*(y_e/w_i))
% Q = ((1 - alphak - alphal)/x_ss)*(y_e/(er*pQ))
% lam_e*q_k = s_e*me*q_k*piss*(1 - deltak) + betae*lam_e*(alphak*y_e/(x_ss*k)+ q_k*(1 - deltak))
% premium = exp(-zeta*er*B_star/k_b)
% premium*(piss/piss_star)*(1 - zeta*er*B_star/k_b) = (1 + r_pol)/(1 + R_star)
% h = h_p + h_i + h_e
% y = c_p + c_i + c_e + deltah*h + deltak*k + y_exp
% y_exp - er*pQ*Q - (1 + (1 + R_star)*premium/piss_star - 1/piss_star)*er*B_star= 0
% luc_y = (1 - 1/x_ss)*y
% k_b = (1/(piss - 1 + deltakb))*(r_bih*b_ih + r_biw*b_iw + r_be*b_e -r_d*d + (1 - (1 + R_star)*premium/piss_star)*er*B_star)
% y_exp = ((1/(er*x_ss)) ˆ -tau)*y_star
% Dicionário:
% x(1): lam_p
% x(2): lam_i
% x(3): lam_e
% x(4): s_ih
% x(5): s_iw
% x(6): s_e
% x(7): c_p
% x(8): c_i
% x(9): c_e
% x(10): h_p
% x(11): h_i
% x(12): h_e
% x(13): b_ih
% x(14): b_iw
% x(15): b_e
% x(16): d
% x(17): w_p
% x(18): w_i
% x(19): y_e
% x(20): y
% x(21): k
% x(22): l_p
% x(23): l_i
% x(24): Q
% x(25): er
% x(26): B_star
% x(27): premium
% x(28): k_b
% x(29): y_exp
function F = tese2014_rotemberg5(x)
global betap betai betae q_k q_h piss piss_star me mih miw deltak deltah deltakb jh eps_l phi eps_y mu alphal alphak eps_d eps_biw eps_bih eps_be zeta x_ss R_star pQ y_star tau vi share;
r_d = piss/betap - 1;
r_pol = ((eps_d - 1)/eps_d)*r_d;
r_biw = (eps_biw/(eps_biw - 1))*r_pol;
r_bih = (eps_bih/(eps_bih - 1))*r_pol;
r_be = (eps_be/(eps_be - 1))*r_pol;
x_ss = eps_y/(eps_y - 1);
f1 = - x(1) + 1/x(7);
f2 = - x(2) + 1/x(8);
f3 = - x(3) + 1/x(9);
f4 = - x(4) + (1/(1 + r_bih) - betai/piss)*x(2);
f5 = - x(5) + (1/(1 + r_biw) - betai/piss)*x(2);
f6 = - x(6) + (1/(1 + r_be) - betae/piss)*x(3);
f7 = - x(7) + x(17)*x(22) + ((1 + r_d)/piss - 1)*x(16) + (1 - (1/x_ss))*x(20)-deltah*x(10);
f8 = - x(8) + x(18)*x(23) - ((1 + r_bih)/piss - 1)*x(13) - ((1 + r_biw)/piss-1)*x(14) - deltah*x(11);
f9 = - x(9) + x(19)/x_ss - x(17)*x(22) - x(18)*x(23) - x(25)*pQ*x(24)-((1+r_be)/piss - 1)*x(15) - deltak*x(21) - deltah*x(12);
f10 = - x(10) + jh/((1 - (1 - deltah)*betap)*x(1));
f11 = - x(11) + jh/((1 - (1 - deltah)*betai)*x(2) - (1 - deltah)*x(4)*mih*piss);
f12 = - x(12) + jh/((1 - (1 - deltah)*betae)*x(3) - (1 - deltah)*x(6)*me*piss);
f13 = - x(13) + (1/(1 + r_bih))*mih*piss*(1 - deltah)*x(11);
f14 = - x(14) + (1/(1 + r_biw))*miw*piss*x(18)*x(23);
f15 = - x(15) + (1/(1 + r_be))*me*piss*(q_k*(1 - deltak)*x(21) + q_h*(1 -deltah)*x(12));
f16 = - x(16) + x(13) + x(14) + x(15) - x(25)*x(26) - x(28);
f17 = - x(17) + (eps_l/(eps_l - 1))*(x(22)^phi)/x(1);
f18 = - x(18) + (eps_l/(eps_l - 1))*(x(23)^phi)/(x(2) + miw*x(5));
f19 = - x(19) + (x(21)^alphak)*(x(22)^(mu*alphal))*(x(23)^((1 - mu)*alphal))*(x(24)^(1 - alphal - alphak));
f20 = - x(22) + (mu*alphal/x_ss)*(x(19)/x(17));
f21 = - x(23) + ((1 - mu)*alphal/x_ss)*(x(19)/x(18));
f22 = - x(24) + ((1 - alphak - alphal)/x_ss)*(x(19)/(x(25)*pQ));
f23 = - x(3)*q_k + x(6)*me*q_k*piss*(1 - deltak) + betae*x(3)*(alphak*x(19)/(x_ss*x(21))+ q_k*(1 - deltak));
f24 = - x(27) + exp(-zeta*x(25)*x(26)/x(28));
f25 = - x(27)*(piss/piss_star)*(1 - zeta*x(25)*x(26)/x(28)) + (1 + r_pol)/(1+R_star);
f26 = - x(20) + x(7) + x(8) + x(9) + deltah*(x(10) + x(11) + x(12)) + deltak*x(21) + x(29);
f27 = x(29) - x(25)*pQ*x(24) - (1 + (1 + R_star)*x(27)/piss_star - 1/piss_star)*x(25)*x(26);
f28 = - x(28) + vi*(x(13) + x(14) + x(15));
f29 = - x(29) + share*((1/x(25)*x_ss)^-tau)*y_star;
F = [f1; f2; f3; f4; f5; f6; f7; f8; f9; f10; f11; f12; f13; f14; f15; f16; f17; f18; f19; f20;
f21; f22; f23; f24; f25; f26; f27; f28; f29];
end
