problem in running a code in dynare
Posted: Tue Oct 18, 2016 2:32 pm
Hello everyone,
I am beginner and after going through all the example of user guide and practicing 2 examples from the book of Gali, I am trying to replicate a paper. I am trying hard to write the code properly but still there is an error in executing the code. Could someone help me by pointing out the mistakes. The link of the paper is http://www.bis.org/publ/work372.pdf . mode file is also attached.
Thanks in advance.
Regard,
Tehseen Iqbal
[code][ var c i pi mc yf yi wf wi nf ni q gf gi xf xi hf hi y n a d;
varexo e_a e_d;
parameters chi beta epsilon delta gamma tech alpha_f alpha_i beta_f beta_i lamda phi_pi phi_y theta eta rho_a rho_d kappa phi phi_f phi_i mu Wu omega_f omega_i gff gii A sii Y N Wf Wi Yf Yi Xf Xi Gf Gi ;
% Calibration.
beta =0.99; // discount factor
chi =1; // preference parameter
epsilon = 6; // elasticity of substituion
delta = 0.2; // seperation rate
gamma = 0.95; // tech
tech = 1; // tech
alpha_f = 1.5; // elasticity of hiring cost of formal labor w.r.t market tightness
alpha_i = 0.75; // elasticity of hiring cost of informal labor w.r.t market tightness
beta_f = 2.5; //
beta_i = 0.5; //
lamda = 0.5; // bargaining powe of labor
phi_pi = 1.5; // policy parameter related to inflation
phi_y = 0.5; // policy parameter related to output
theta = 2/3; // number of firms who can't adjust prices
//eta = ? //
mu = epsilon/(epsilon-1);
kappa = (1-theta)*(1-theta*beta)/theta;
phi_f = A/Wf*mu;
A =1;
Phi_i = (gamma*A)/Wi*mu;
sii =0.75;
Wu = sii*(gamma*A/mu);
omega_f = (chi*c*N^eta)/Wf;
omega_i = (chi*c*N^eta)/Wi;
rho_d = 0.95;
rho_a = 0.95;
// Steady state
Y = Yf+Yi;
N = Nf+Ni;
Wf = A*(1/mu)-Gf*(1-beta*(1-sigma)); // labor demand of formal sector
Wi = gamma*A*(1/mu)-Gi*(1-beta*(1-sigma)); // labor demand of informal sector
Wf = chi*C*N^phi+Wu+lamda*(Gf-beta*(1-sigma)*((1-Xf)*Gf-Xi*Gi)); // labor supply of formal sector
Wi = chi*C*N^phi+Wu+lamda*(Gi-beta*(1-sigma)*((1-Xi)*Gi-Xf*Gf)); // labor supply of informal sector
Y = C+sigma*Gf+Nf+sigma*Gi*N-Wu*(1-N); // aggregate budjet condition
Yf = A*Nf; // production function formal sector
Yi = gamma*A*Ni; // production function informal sector
Xf = sigma*Nf/(1-(1-sigma)*N); // labor tightness of formal sector
Xi = sigma*Ni/(1-(1-sigma)*N); // labor tightness of informal sector
Gf = betai*A*X^alpha_f; // Hiring cost informal sector
Gi = betaf*A*X^alpha_i; // Hiring cost formal sector
//Linear
Model(linear);
//c = c(+1)-(i-(pi(+1)); // Euler equation
gf = a + alpha_f*xf; // hiring cost
gi = a + alpha_i*xi; // hiring cost
nf = (1-delta)*nf(-1)+delta*hf; // evolution of labor
ni = (1-delta)*ni(-1)+delta*hi; // evolution of labor
xf = hf +((1-delta)*n/1-(1-delta))*n(-1); // labor market tightness
xi = hi +((1-delta)*n/1-(1-delta))*n(-1); // labor market tightness
pi = kappa*mc+pi(+1); // phillips curve.
y = (Yf/Y)*yf+(Yi/Y)*yi;
yf = a + nf;
yi = a+ni;
wf = phi_f*(a+mc)+(Gf-Gf(-1)/Wf)*(gff); // labor demand
wi = phi_i*(a+mc)+(Gi-Gi(-1)/Wi)*(gii); // labor demand
q(+1) = c-c(+1);
wf = omega_f*(c+eta*n)+lamda*(Gf/Wf)*gff+((1-delta)*beta*lamda/Wf)*(Gf*Xf*(q(+1)+gf(+1)+xf(+1))*Gi*Xi*(q(+1)+gi(+1)+xi(+1)));
wi = omega_i*(c+eta*n)+lamda*(Gi/Wi)*gii+((1-delta)*beta*lamda/Wi)*(Gf*Xf*(q(+1)+gf(+1)+xi(+1))*Gi*Xi*(q(+1)+gi(+1)+xi(+1)));
gff = gf-(1-delta)*beta*(q(+1)+gf(+1));
gii = gi-(1-delta)*beta*(q(+1)+gi(+1));
//n = (Ni/N)*ni + (Nf/N)*nf;
mc = (mu/A)*((1+lamda)/(1-gamma))*(Gf-Gf(-1))*gff-(Gi-Gi(-1)*gii)-a;
i = phi_pi*pi + phi_y*y; //monetary policy rule
a = rho_a*a(-1)+e_a;
d = rho_d*d(-1)+e_d;
end;
check;
shocks;
var e_a; stderr .005;
var e_d; stderr .005;
end;
//Computation
check;
stoch_simul(irf=30) pi yi yf;
]
I am beginner and after going through all the example of user guide and practicing 2 examples from the book of Gali, I am trying to replicate a paper. I am trying hard to write the code properly but still there is an error in executing the code. Could someone help me by pointing out the mistakes. The link of the paper is http://www.bis.org/publ/work372.pdf . mode file is also attached.
Thanks in advance.
Regard,
Tehseen Iqbal
[code][ var c i pi mc yf yi wf wi nf ni q gf gi xf xi hf hi y n a d;
varexo e_a e_d;
parameters chi beta epsilon delta gamma tech alpha_f alpha_i beta_f beta_i lamda phi_pi phi_y theta eta rho_a rho_d kappa phi phi_f phi_i mu Wu omega_f omega_i gff gii A sii Y N Wf Wi Yf Yi Xf Xi Gf Gi ;
% Calibration.
beta =0.99; // discount factor
chi =1; // preference parameter
epsilon = 6; // elasticity of substituion
delta = 0.2; // seperation rate
gamma = 0.95; // tech
tech = 1; // tech
alpha_f = 1.5; // elasticity of hiring cost of formal labor w.r.t market tightness
alpha_i = 0.75; // elasticity of hiring cost of informal labor w.r.t market tightness
beta_f = 2.5; //
beta_i = 0.5; //
lamda = 0.5; // bargaining powe of labor
phi_pi = 1.5; // policy parameter related to inflation
phi_y = 0.5; // policy parameter related to output
theta = 2/3; // number of firms who can't adjust prices
//eta = ? //
mu = epsilon/(epsilon-1);
kappa = (1-theta)*(1-theta*beta)/theta;
phi_f = A/Wf*mu;
A =1;
Phi_i = (gamma*A)/Wi*mu;
sii =0.75;
Wu = sii*(gamma*A/mu);
omega_f = (chi*c*N^eta)/Wf;
omega_i = (chi*c*N^eta)/Wi;
rho_d = 0.95;
rho_a = 0.95;
// Steady state
Y = Yf+Yi;
N = Nf+Ni;
Wf = A*(1/mu)-Gf*(1-beta*(1-sigma)); // labor demand of formal sector
Wi = gamma*A*(1/mu)-Gi*(1-beta*(1-sigma)); // labor demand of informal sector
Wf = chi*C*N^phi+Wu+lamda*(Gf-beta*(1-sigma)*((1-Xf)*Gf-Xi*Gi)); // labor supply of formal sector
Wi = chi*C*N^phi+Wu+lamda*(Gi-beta*(1-sigma)*((1-Xi)*Gi-Xf*Gf)); // labor supply of informal sector
Y = C+sigma*Gf+Nf+sigma*Gi*N-Wu*(1-N); // aggregate budjet condition
Yf = A*Nf; // production function formal sector
Yi = gamma*A*Ni; // production function informal sector
Xf = sigma*Nf/(1-(1-sigma)*N); // labor tightness of formal sector
Xi = sigma*Ni/(1-(1-sigma)*N); // labor tightness of informal sector
Gf = betai*A*X^alpha_f; // Hiring cost informal sector
Gi = betaf*A*X^alpha_i; // Hiring cost formal sector
//Linear
Model(linear);
//c = c(+1)-(i-(pi(+1)); // Euler equation
gf = a + alpha_f*xf; // hiring cost
gi = a + alpha_i*xi; // hiring cost
nf = (1-delta)*nf(-1)+delta*hf; // evolution of labor
ni = (1-delta)*ni(-1)+delta*hi; // evolution of labor
xf = hf +((1-delta)*n/1-(1-delta))*n(-1); // labor market tightness
xi = hi +((1-delta)*n/1-(1-delta))*n(-1); // labor market tightness
pi = kappa*mc+pi(+1); // phillips curve.
y = (Yf/Y)*yf+(Yi/Y)*yi;
yf = a + nf;
yi = a+ni;
wf = phi_f*(a+mc)+(Gf-Gf(-1)/Wf)*(gff); // labor demand
wi = phi_i*(a+mc)+(Gi-Gi(-1)/Wi)*(gii); // labor demand
q(+1) = c-c(+1);
wf = omega_f*(c+eta*n)+lamda*(Gf/Wf)*gff+((1-delta)*beta*lamda/Wf)*(Gf*Xf*(q(+1)+gf(+1)+xf(+1))*Gi*Xi*(q(+1)+gi(+1)+xi(+1)));
wi = omega_i*(c+eta*n)+lamda*(Gi/Wi)*gii+((1-delta)*beta*lamda/Wi)*(Gf*Xf*(q(+1)+gf(+1)+xi(+1))*Gi*Xi*(q(+1)+gi(+1)+xi(+1)));
gff = gf-(1-delta)*beta*(q(+1)+gf(+1));
gii = gi-(1-delta)*beta*(q(+1)+gi(+1));
//n = (Ni/N)*ni + (Nf/N)*nf;
mc = (mu/A)*((1+lamda)/(1-gamma))*(Gf-Gf(-1))*gff-(Gi-Gi(-1)*gii)-a;
i = phi_pi*pi + phi_y*y; //monetary policy rule
a = rho_a*a(-1)+e_a;
d = rho_d*d(-1)+e_d;
end;
check;
shocks;
var e_a; stderr .005;
var e_d; stderr .005;
end;
//Computation
check;
stoch_simul(irf=30) pi yi yf;
]