Hi everyone!
i am running a nk model for a small open economy using this cod
%----------------------------------------------------------------
% 0. Housekeeping (close all graphic windows)
%----------------------------------------------------------------
close all;
%----------------------------------------------------------------
% 1. Defining variables
%----------------------------------------------------------------
// Endogenous variables (31)
var la cc ppi pis ch pf cf ph mch f1h f2h pih pmh yh w RW RE dM dE tb rer chE yE m h R e_m stb z piE;
// Exogenous variables (3)
varexo u_e_m u_e_RW u_e_yE;
// Parameters (20)
parameters BETA SIGMA PHI OMEGA NU FI;
parameters EPSIh TITAh PSI XI ETA D ETAE;
parameters ALPHA_ppi ALPHA_y ALPHA_R;
parameters RHO_RW RHO_yE RHO_m SIGMA_RW SIGMA_yE SIGMA_m;
parameters ppi_ss vel_ss R_ss yh_ss h_ss RW_ss yE_ss stb_ss;
%----------------------------------------------------------------
% 2. Calibration
%----------------------------------------------------------------
// Calibarted parameteres (BETA, VARPHI, NU are determined in the calibration)
SIGMA=1;
OMEGA=0.65;
NU=1.5;
EPSILON=11;
TITAh=0.7;
ETA=1.5;
ETAh=1.5;
PHI=0.0001;
FI=1;
ALPHA_ppi=1.5;
ALPHA_y=0.2;
ALPHA_R=0.7;
RHO_RW=0.9;
SIGMA_RW=0.01;
RHO_m=0;
SIGMA_m=0.01;
RHO_yE=0.9;
SIGMA_yE=0.01;
BETA=.99;
XI=10;
// Targeted steady state values
piE_ss=1;
ppi_ss=1.0075;
vel_ss=3;
h_ss=1/3;
ph_ss=1;
stb_ss=0.05;
z_ss=1;
%----------------------------------------------------------------
% 3. Model (16 equations)
%----------------------------------------------------------------
model;
////////////////////////////HOUSEHOLDS
//la=cc^(-SIGMA);
exp(la)=exp(cc)^(-SIGMA);
//w*la=PSI*h^(FI);
exp(w)*exp(la)=PSI*exp(h)^(FI);
//(1/la)*NU*m^(-XI)=1-(1/R);
exp(1/la)*NU*exp(m)^(-XI)=1-(1/exp(R));
//la=BETA*R*la(+1)/ppi(+1);
exp(la)=BETA*exp(R)*exp(la(+1))/exp(ppi(+1));
//la= BETA*RE*pis(+1)*la(+1)/ppi(+1);
exp(la)=BETA*exp(RE)*exp(pis(+1))*exp(la(+1))/exp(ppi(+1));
////////////////////////////FINAL CONS GDS
//cc=(OMEGA^(1/ETA)*(ch^(1-1/ETA))+((1-OMEGA)^(1/ETA))*(cf^(1-1/ETA)))^(ETA/(ETA-1))
exp(cc)=(OMEGA^(1/ETA)*(exp(ch)^(1-1/ETA))+((1-OMEGA)^(1/ETA))*exp(cf^(1-1/ETA)))^(ETA/(ETA-1));
//cf=(1-OMEGA)*(pf^(-ETA))*cc
exp(cf)=(1-OMEGA)*(exp(pf)^(-ETA))*exp(cc);
//ch=OMEGA*(ph^(-ETA))*cc
exp(ch)=OMEGA*(exp(ph)^(-ETA))*exp(cc);
////////////////////////////VARIETIES OF H GDS
//ph*mch*z=w
exp(ph)*exp(mch)*exp(z)=exp(w);
//f1h=(pmh^(1-EPSIh))*yh*(1-1/EPSIh)+TITAh*(BETA*(la(+1)/(la*ppi(+1))))*((pmh*ppi/pmh(+1))^(1-EPSIh))*((pih(+1))^(EPSIh))*f1h(+1)
exp(f1h)=(exp(pmh)^(1-EPSIh))*exp(yh)*(1-1/EPSIh)+TITAh*(BETA*(exp(la(+1))/(exp(la)*exp(ppi(+1))))*((exp(pmh)*exp(ppi)/exp(pmh(+1))^(1-EPSIh))*(exp(pih(+1))^(EPSIh))*exp(f1h(+1))));
//f2h=(pmh^(-EPSIh))*yh*mch+TITAh*(BETA*(la(+1)/(la*ppi(+1))))*((pmh*ppi/pmh(+1))^(-EPSIh))*(pih(+1))^(1+EPSIh)*f2h(+1)
exp(f2h)=(exp(pmh)^(-EPSIh))*exp(yh)*exp(mch)+TITAh*(BETA*(exp(la(+1))/(exp(la)*exp(ppi(+1)))))*((exp(pmh)*exp(ppi)/exp(pmh(+1)))^(-EPSIh))*(exp(pih(+1))^(1+EPSIh))*exp(f2h(+1));
//f1h=f2h
exp(f1h)=exp(f2h);
//1=TITAh*((pih/ppi(-1))^(EPSIh-1))+ (1-TITAh)*(pmh^(1-EPSIh))
1=TITAh*((exp(pih)/exp(ppi(-1)))^(EPSIh-1))+(1-TITAh)*(exp(pmh)^(1-EPSIh));
//RE=RW*exp(PHI*(dE-D))
exp(RE)=exp(RW)*exp(PHI*(dE-D));
//rer=pf
exp(rer)=exp(pf);
//chE=((ph/rer)^(-ETAE))*yE
exp(chE)=((exp(ph)/exp(rer))^(-ETAE))*exp(yE);
////////////////////////////AGREGATION
//yh=ch+chE
exp(yh)=exp(ch)+exp(chE);
//yh=z*h
exp(yh)=exp(z)*exp(h);
//ph/ph(-1)=pih/ppi
exp(ph)/exp(ph(-1))=exp(pih)/exp(ppi);
//rer/rer(-1)=pis*piE/ppi
exp(rer)/exp(rer(-1))=exp(pis)*exp(piE)/exp(ppi);
//rer*dE+pih*ph*chE-rer*cf=rer*dE(-1)*RE(-1)/ppi
exp(rer)*exp(dE)+exp(pih)*exp(ph)*exp(chE)-exp(rer)*exp(cf)=exp(rer)*dE(-1)*exp(RE(-1))/exp(ppi);
//tb=ph*chE-rer*cf
tb=exp(ph)*exp(chE)-exp(rer)*exp(cf);
//dM=m*ppi/m(-1)
exp(dM)=exp(m)/exp(m(-1))*exp(ppi);
//stb=tb/(ph*yh)
stb=tb/(exp(ph)*exp(yh));
// Monetary policy
//(R/R_ss)=(R(-1)/R_ss)^(ALPHA_R)*((ppi/ppi_ss)^ALPHA_ppi*(yh/yh_ss)^ALPHA_y)^(1-ALPHA_R)*e_m;
(exp(R)/R_ss)=(exp(R(-1))/R_ss)^(ALPHA_R)*((exp(ppi)/ppi_ss)^ALPHA_ppi*(exp(yh)/yh_ss)^ALPHA_y)^(1-ALPHA_R)*exp(e_m);
// Exogenous
//log(e_m)=RHO_m*log(e_m(-1))+u_m; // CAMBIO: antes 'u_m', ahora 'u_e_m'
log(exp(e_m))=RHO_m*log(exp(e_m(-1)))+u_e_m; // CAMBIO: antes 'u_m', ahora 'u_e_m'
//log(RW/RW_ss)=RHO_RW*log(RW(-1)/RW_ss)+u_e_RW
log(exp(RW)/exp(RW_ss))=RHO_RW*log(exp(RW(-1))/exp(RW_ss))+u_e_RW;
//log(yE/yE_ss)=RHO_yE*log(yE(-1)/yE)+u_e_yE
log(exp(yE)/exp(yE_ss))=RHO_yE*log(exp(yE(-1))/exp(yE))+u_e_yE;
end;
%----------------------------------------------------------------
% 4. Steady State
%----------------------------------------------------------------
steady_state_model;
// Computing the steady state and calibrated parameters
dE_ss=D;
BETA=ppi_ss/R_ss;
piE_ss=ppi_ss/pis_ss;
RE_ss=R_ss/pis_ss;
RW_ss=RE_ss;
pih_ss=ppi_ss;
vel=yh_ss*ph_ss/m_ss;
pmh_ss=1;
mch_ss=(EPSIh-1)/EPSIh;
yh_ss=z_ss*h_ss;
f1h_ss=(pmh_ss^(-EPSIh)*yh_ss*mch_ss)/(1-BETA*TITAh);
f1h_ss=f2h_ss;
pf_ss=((1-OMEGA*ph^(1-ETA))/(1-OMEGA))^(1/(1-ETA));
tb_ss=stb_ss*ph_ss*yh_ss;
cc_ss=ph_ss*yh_ss-tb_ss;
ch_ss=OMEGA*(ph_ss)^(-ETA)*cc_ss;
cheE=yh_ss-ch_ss;
rer_ss=pf_ss;
yE_ss=chE_ss*(ph_ss/rer_ss)^ETAE;
cf_ss=(1-OMEGA)*(rer_ss)^(-ETA)*cc_ss;
dE=tb_ss(rer_ss*(RE_ss/ppi_ss-1))^(-1);
w_ss=ph_ss*z_ss*mch_ss;
la_ss=cc^(-SIGMA);
PSI=w_ss*(h_ss)^(-FI)*cc_ss^(-SIGMA);
m_ss=yh_ss*ph_ss/vel_ss;
NU=la_ss(1-1/R_ss)*m_ss^(XI);
dM_ss=ppi_ss;
// Initial values for solver
f1h=log(f1h_ss);
f2h=log(f2h_ss);
pmh=log(pmh_ss);
yh=log(yh_ss);
ppi=log(ppi_ss);
cc=log(cc_ss);
la=log(la_ss);
h=log(h_ss);
m=log(m_ss);
w=log(w_ss);
mch=log(mch_ss);
stb=log(stb_ss);
R=log(R_ss);
z=log(z_ss);
dM=log(dM_ss);
e_m=log(1);
pis=log(pis_ss);
ch=log(ch_ss);
pf=log(pf_ss);
cf=log(cf_ss);
ph=log(ph_ss);
pih=log(pìh_ss);
RW=log(RW_ss);
RE=log(RE_ss);
dE=dE_ss;
tb=tb_ss;
rer=log(rer_ss);
chE=log(chE_ss);
yE=log(yE_ss);
piE=log(piE_ss);
yE=log(yE_ss);
end;
%----------------------------------------------------------------
% 4. Computation
%----------------------------------------------------------------
steady;
check;
shocks;
var u_e_m = SIGMA_m^2; // CAMBIO: antes 'u_m', ahora 'u_e_m'
var u_e_RW = SIGMA_RW^2;
var u_e_yE = SIGMA_yE^2;
end;
stoch_simul(periods=0, irf = 50, order = 1, nograph);
save TP3.mat;
but when i run the code it tells me that tb cannot take argument
can anyone please help me?
thank you