var ctt, cnt, ctn, cnn, kt, kn, bt, bn, p, yt, yn, tot, u, n, d, et, en, TB, GDP, TB_GDP, N_T, CONS; varexo ertot, ern; parameters alfa, eta, fit, fin, Ft, Fn, beta, gama, delta, r, m0, n0, eps, u0, a, b, ksi, rhon, rhotot, bt0, bn0, tot0, sigman, sigmatot, p0; alfa = 0.40; // share of capital in the T sector eta = 0.20; // share of capital in the N sector fit = 0.29; // share of tradable goods in consumption of the T sector fin = 0.29; // share of tradable goods in consumption of the N sector Ft = 0.30; // adjustment cost in the T sector Fn = 0.30; // adjustment cost in the N sector beta = 0.90; // discount factor in the T sector gama = 0.90; // discount factor in the T sector delta = 0.10; // depreciation rate for capital in both sectors r = 0.04; // world interest rate m0 = 0.233; // borrowing coefficient in the N sector n0 = 0.128; // borrowing coefficient in the T sector eps = 0.00061; // interest elasticity ceofficient: [1+r+csi*(exp(at-atss)-1)] u0 = 0.198; // steady-stae value of capital utilization a = 0.96; // elasticity between the borrowing constraint and capital utilization b = 1.195; // proportionality between capital utilization and depreciation ksi = 1.31; // elasticity between capital utilization and depreciation rhon = 0.80; // persistence of the shock to the borrowing constraint rhotot = 0.90; // persistence of the shock to the terms of trade tot0 = 1.24; // steady-state level of the terms of trade sigman = -0.50; // variance of the shock to the borrowing constrant of the N sector sigmatot= 0.10; // variance of the shock to the terms of trade shock A = ((1 - m0/(1+r))/beta - 1 + delta + m0)/alfa; B = ((1 - n0/(1+r))/gama - 1 + delta + n0)/eta; C = fit*(A - delta - m0*r/(1+r)); D0 = (1-fin)*(B - delta - n0*r/(1+r)); kt0 = (tot0/A)^(1/(1-alfa)); kn0 = (u0^eta/B)^(1/(1-eta)); p0 = (C/(B - delta - D0))*((1-fit)/fit)*kt0/kn0; //steady-state real exchange rate bt0 = kt0*m0/(1+r); bn0 = kn0*p0*n0/(1+r); model; #A = ((1 - m0/(1+r))/beta - 1 + delta + m0)/alfa; #B = ((1 - n0/(1+r))/gama - 1 + delta + n0)/eta; #C = fit*(A - delta - m0*r/(1+r)); #D0 = (1-fin)*(B - delta - n0*r/(1+r)); #kt0 = (tot0/A)^(1/(1-alfa)); #kn0 = (u0^eta/B)^(1/(1-eta)); #p0 = (C/(B - delta - D0))*((1-fit)/fit)*kt0/kn0; //steady-state real exchange rate #bt0 = kt0*m0/(1+r); #bn0 = kn0*p0*n0/(1+r); fit*exp(ctn)*exp(p)=(1-fit)*exp(ctt); //consumption substitution in the T sector fin*exp(cnn)*exp(p)=(1-fin)*exp(cnt); //consumption substitution in the N sector //euler equation for the T sector beta*(exp(ctt)/exp(ctt(+1)))*(alfa*exp(tot(+1))*(exp(kt))^(alfa-1) + 1 - delta + Ft*(exp(kt(+1))-exp(kt)) - m0) = 1 + Ft*(exp(kt) - exp(kt(-1))) - m0/(1+r+et(+1)); //euler equation for the N sector gama*(exp(cnt)/exp(cnt(+1)))*(eta*((exp(u(+1)))^eta)*(exp(kn))^(eta-1) + 1 - exp(d(+1)) + Fn*(exp(kn(+1))-exp(kn)) - exp(n)) = (exp(p)/exp(p(+1)))*( 1 + Fn*(exp(kn) - exp(kn(-1))) - exp(n)/(1+r+en(+1)) ); //borrowing constraint in the T sector (1+r+et(+1))*exp(bt) = m0*exp(kt); //borrowing constraint in the N sector (1+r+en(+1))*exp(bn) = exp(p(+1))*exp(n)*exp(kn); //budget constraint in the T sector exp(ctt) + exp(p)*exp(ctn) + exp(kt) - (1-delta)*exp(kt(-1)) + 0.5*Ft*(exp(kt)-exp(kt(-1)))^2 = exp(tot)*(exp(kt(-1)))^alfa + exp(bt) - exp(bt(-1))*(1+r+et); //budget constraint in the N sector exp(cnt) + exp(p)*exp(cnn) + exp(p)*exp(kn) - (1-delta)*exp(p)*exp(kn(-1)) + 0.5*exp(p)*Fn*(exp(kn)-exp(kn(-1)))^2 = exp(p)*(exp(u)*exp(kn(-1)))^eta + exp(bn) - exp(bn(-1))*(1+r+en); //resource constraint exp(ctn) + exp(cnn) + exp(kn) - (1-d)*exp(kn(-1)) + 0.5*Fn*(exp(kn)-exp(kn(-1)))^2 = (exp(u)*exp(kn(-1)))^eta; //capital utilization exp(u) = u0*(exp(n)/n0)^a; exp(d) = delta + b*((exp(u))^ksi - u0^ksi); exp(n) = (n0^(1-rhon))*((exp(n(-1)))^rhon)*exp(sigman*ern); exp(tot) = (tot0^(1-rhotot))*((exp(tot(-1)))^rhotot)*exp(sigmatot*ertot); et=eps*(exp(exp(bt)-bt0)-1); en=eps*(exp(exp(bn)-bn0)-1); exp(yt)=(exp(kt))^alfa; exp(yn)=(exp(u)*exp(kn))^eta; exp(GDP) = exp(yt) + p0*exp(yn); exp(CONS) = exp(ctt) + exp(cnt) + p0*(exp(ctn) + exp(cnn)); TB = exp(bt(-1))*(1+r)-exp(bt)+exp(bn(-1))*(1+r)-exp(bn); TB_GDP = TB/(exp(yt) + exp(p)*exp(yn)); exp(N_T)=exp(yn-yt); end; // puts some initial values initval; kt = log(kt0); kn = log(kn0); p = log(p0); ctt= log(C*kt0); cnn= log(D0*kn0); ctn= log(((1-fit)/fit)*exp(ctt)/p0); cnt= log((fin/(1-fin))*exp(cnn)*p0); bt = log(bt0); bn = log(bn0); u = log(u0); tot= log(tot0); yt = log(kt0^alfa); yn = log((u0*kn0)^eta); n = log(n0); d = log(delta); et = 0; en = 0; GDP = log(exp(yt) + p0*exp(yn)); CONS = log(exp(ctt) + exp(cnt) + p0*(exp(ctn) + exp(cnn))); TB = bt0*r+bn0*r; TB_GDP = TB/(exp(yt) + p0*exp(yn)); N_T=yn-yt; ertot = 0; ern = 0; end; steady; check; shocks; var ern = 1; var ertot = 1; end; // simulation: for deterministic case, simulation is done with Newton method: not an approximation //simul(periods=60); stoch_simul(order=2 , irf=20, periods=2000);