//Small Open Economy Model, Benchmark var c, cT, cN, n, nT, nN, i, k, a, zT, zN, G, yT, TB; varexo eT, eN, eG, e1; parameters gamma, rho, sigma, psi, psi0, r, alfa, eta, delta, rhoT, rhoN, rhoG, sigmaT, sigmaN, sigmaG, sigma1, zT0, zN0, G0, a0, om, eps; gamma =0.3; rho =0.6; sigma =2; psi =1.6; psi0 =1.2; r =0.05; alfa =1/3; eta =1/4; delta =0.02; rhoT =0.6; rhoN =0.8; rhoG =0.75; sigmaT =0.03; sigmaN =0.03; sigmaG =0.01; sigma1 =0.0025; zT0 =1.0; zN0 =1.0; a0 =0.5; G0 =0.2; om =0.01; eps =0.007; model; exp(c) = ( gamma*exp(cT)^rho + (1-gamma)*exp(cN)^rho )^(1/rho); psi0*(exp(n)^(psi-1)) = gamma * ((exp(c)/exp(cT))^(1-rho))*(1-alfa)*exp(zT(-1))*(exp(k(-1))/exp(nT))^alfa; psi0*(exp(n)^(psi-1)) = (1-gamma) * ((exp(c)/exp(cN))^(1-rho))*(1-eta)*exp(zN(-1))*(exp(nN))^(-eta); (( exp(c) - (psi0/psi)*exp(n)^psi )^(-sigma)) * ((exp(c)/exp(cT))^(1-rho))=(( exp(c(+1)) - (psi0/psi)*exp(n(+1))^psi )^(-sigma))*((exp(c(+1))/exp(cT(+1)))^(1-rho))*(1+r+eps*(exp(a0 - a)-1))/(1+r); (1+r+eps*(exp(a0 - a)-1))*(1+om*exp(i)/exp(k(-1))) = (1-delta)*(1+om*exp(i(+1))/exp(k)) + alfa*exp(zT)*(exp(nT(+1))/exp(k))^(1-alfa) + 0.5*om*(exp(i(+1))/exp(k))^2; exp(cN) = exp(zN(-1))*(exp(nN))^(1-eta); exp(cT) + exp(i) + 0.5*om*(exp(i)^2)/exp(k(-1)) + a = exp(zT(-1))*(exp(k(-1))^alfa)*(exp(nT)^(1-alfa)) - G(-1)*exp(yT) + a(-1)*(1+r+eps*(exp(a0-a(-1))-1)); exp(i) = exp(k) - (1-delta)*exp(k(-1)); exp(yT) = exp(zT(-1))*(exp(k(-1))^alfa)*(exp(nT)^(1-alfa)); exp(nT) + exp(nN) = exp(n); TB= (a - (a(-1))*(1+r))/exp(yT) + sigma1*e1; exp(zT) = exp(zT0)^(1-rhoT)*exp(zT(-1))^rhoT*exp(sigmaT*eT); exp(zN) = exp(zN0)^(1-rhoN)*exp(zN(-1))^rhoN*exp(sigmaN*eN); G = G0*(1-rhoG) + G(-1)*rhoG + sigmaG*eG; end; initval; c = log(0.3); cT = log(0.4); cN = log(0.2); n = log(0.3); nT = log(0.1); nN = log(0.2); i = log(0.05); k = log(0.6); a = a0; zT = log(zT0); zN = log(zN0); G = G0; yT = log(0.2); TB = a0*r/exp(yT); eT = 0; eN = 0; eG = 0; e1 = 0; end; steady; shocks; var eT = 1; var eN = 1; var eG = 1; var e1 = 1; end; check; if 0 stoch_simul(dr_algo=1,drop=0,irf=40,order=1,periods=100); datatomfile('soe1simul',[]); else estimated_params; gamma, beta_pdf, 0.5, 0.2; rho, gamma_pdf, 0.6, 0.2; sigma, gamma_pdf, 2, 0.5; psi, gamma_pdf, 1.5, 0.25; psi0, gamma_pdf, 1.2, 0.5; r, gamma_pdf, 0.05, 0.01; alfa, gamma_pdf, 0.3, 0.05; eta, gamma_pdf, 0.2, 0.03; delta, gamma_pdf, 0.02, 0.005; rhoT, beta_pdf, 0.6, 0.1; rhoN, beta_pdf, 0.8, 0.05; rhoG, beta_pdf, 0.75, 0.1; sigmaT, inv_gamma_pdf, 0.03, 0.005; sigmaN, inv_gamma_pdf, 0.03, 0.005; sigmaG, inv_gamma_pdf, 0.01, 0.0025; sigma1, inv_gamma_pdf, 0.01, 0.0025; zT0, gamma_pdf, 1.0, 0.3; zN0, gamma_pdf, 1.0, 0.3; a0, gamma_pdf, 1.50, 0.5; G0, gamma_pdf, 0.005, 0.002; om, inv_gamma_pdf, 0.01, 0.003; //eps =0.007; end; varobs yT, c, TB; //$ Declaration of two global variables: global lgx_TeX_ lgy_TeX_ ; lgx_TeX_ = 'e_{1,t}'; lgx_TeX_ = strvcat(lgx_TeX_,'e_{G,t}'); lgx_TeX_ = strvcat(lgx_TeX_,'e_{N,t}'); lgx_TeX_ = strvcat(lgx_TeX_,'e_{T,t}'); lgy_TeX_ = 'a_{t}'; lgy_TeX_ = strvcat(lgy_TeX_,'c_{t}'); lgy_TeX_ = strvcat(lgy_TeX_,'c_{N,t}'); lgy_TeX_ = strvcat(lgy_TeX_,'c_{T,t}'); lgy_TeX_ = strvcat(lgy_TeX_,'G_{t}'); lgy_TeX_ = strvcat(lgy_TeX_,'i_{t}'); lgy_TeX_ = strvcat(lgy_TeX_,'k_{t}'); lgy_TeX_ = strvcat(lgy_TeX_,'n_{t}'); lgy_TeX_ = strvcat(lgy_TeX_,'n_{N,t}'); lgy_TeX_ = strvcat(lgy_TeX_,'n_{T,t}'); lgy_TeX_ = strvcat(lgy_TeX_,'TB_{t}/Y_{t}'); lgy_TeX_ = strvcat(lgy_TeX_,'y_{T,t}'); lgy_TeX_ = strvcat(lgy_TeX_,'z_{N,t}'); lgy_TeX_ = strvcat(lgy_TeX_,'z_{T,t}'); //gamma, rho, sigma, psi, psi0, r, alfa, eta, delta, rhoT, rhoN, rhoG, sigmaT, sigmaN, sigmaG, sigma1, zT0, zN0, G0, a0, om, eps; estim_params_.tex = '\gamma'; estim_params_.tex = strvcat(estim_params_.tex,'\rho'); estim_params_.tex = strvcat(estim_params_.tex,'\sigma_{1}'); estim_params_.tex = strvcat(estim_params_.tex,'\psi'); estim_params_.tex = strvcat(estim_params_.tex,'\psi_{0}'); estim_params_.tex = strvcat(estim_params_.tex,'r'); estim_params_.tex = strvcat(estim_params_.tex,'\alpha'); estim_params_.tex = strvcat(estim_params_.tex,'\eta'); estim_params_.tex = strvcat(estim_params_.tex,'\delta'); estim_params_.tex = strvcat(estim_params_.tex,'\rho_{T}'); estim_params_.tex = strvcat(estim_params_.tex,'\rho_{N}'); estim_params_.tex = strvcat(estim_params_.tex,'\rho_{G}'); estim_params_.tex = strvcat(estim_params_.tex,'\sigma_{T}'); estim_params_.tex = strvcat(estim_params_.tex,'\sigma_{N}'); estim_params_.tex = strvcat(estim_params_.tex,'\sigma_{G}'); estim_params_.tex = strvcat(estim_params_.tex,'\sigma_{1}'); estim_params_.tex = strvcat(estim_params_.tex,'Z_{T,0}'); estim_params_.tex = strvcat(estim_params_.tex,'Z_{N,0}'); estim_params_.tex = strvcat(estim_params_.tex,'a_{0}'); estim_params_.tex = strvcat(estim_params_.tex,'G_{0}'); estim_params_.tex = strvcat(estim_params_.tex,'\omega'); //estim_params_.tex = strvcat(estim_params_.tex,'\epsilon'); options_.varobs_TeX = 'Tradable Output'; options_.varobs_TeX = strvcat(options_.varobs_TeX,'Consumption'); options_.varobs_TeX = strvcat(options_.varobs_TeX,'Trade Balance/GDP'); // computes only the posterior mode for demonstration. //estimation(datafile=soe1simul,mh_replic=1000,mh_nblocks=5,mh_jscale=0.35);//,smoother,tex); estimation(datafile=soe1simul,mode_file=SOE0_mode,mh_replic=1000,mh_nblocks=5,mh_jscale=0.2,tex);//,smoother,tex); end;