Thank you for the reply.
I have tried very hard to debug it, but there must be something that I systematically rewrite wrong thinking it's right. I wasn't sure if, for instance c^ALPHA became exp(c)^ALPHA or (exp(c))^ALPHA, so I tried both ways and neither worked. I still think the second one is correct. Except for this, it's really just 9 short equations.
Do you or anyone else spot any consistent mistake?
From:
- Code: Select all
var U V M S u e v t z;
varexo zi;
parameters A a B x l K b c rho sigma;
l = 0.039; % obsolescence separation rate
a = 0.5; % matching function exponent
A = 0.636; % matching function scale parameter
B = 0.9967; % discount factor
x = 0.5; % worker bargaining weight
rho = 0.975; % persistence of productivity process
sigma = 0.0076; % variance of productivity process
b = 0.9; % value of leisure
c = 0.17; % vacancy posting cost
K = 26.94; % creation cost
model;
% Ausiliary definitions for matching function and flow probabilities
e = 1-u;
t = v/u;
% Unemployment value function (eq 16)
U = b + B*( A * t^(1-a)*x*S(+1) + U(+1) );
% Vacancy value function (eq 17)
V = -c + B*( A * t^(-a)*(1-x)*S(+1) + V(+1) );
% Output value function (eq 18)
M = z + B*( (1-l)*S(+1) + U(+1) + V(+1) );
% Matching surplus definition (S=M-U-V) (eq 19)
S = z - b + c + B*((1-l) - A * t^(1-a)*x - A * t^(-a)*(1-x))*S(+1);
% FONC: V=K*n (eq 21)
c = B*( A * t^(-a)*(1-x)*S(+1));
% Law of motion for (eq 22)
u = u(-1) + l*(1-u(-1)) - A*(t(-1)^(1-a)) * u(-1);
% Log productivity follows an exogenous AR(1) process
log(z) = rho*log(z(-1)) + zi;
end;
initval;
U = 294.865;
V = 0.543609;
M = 295.738;
S = 0.32959;
u = 0.0798989;
e = 0.920101;
v = 0.04076282;
t = 0.510245;
z = 1;
end;
shocks;
var zi = sigma^2;
end;
steady;
stoch_simul(
nograph,
order = 1,
periods = 30300,
drop = 300,
IRF = 90
);
To:
- Code: Select all
var U V M S u e v t z;
varexo zi;
parameters A a B x l K b c rho sigma;
l = 0.039; % obsolescence separation rate
a = 0.5; % matching function exponent
A = 0.636; % matching function scale parameter
B = 0.9967; % discount factor
x = 0.5; % worker bargaining weight
rho = 0.975; % persistence of productivity process
sigma = 0.0076; % variance of productivity process
b = 0.9; % value of leisure
c = 0.17; % vacancy posting cost
K = 26.94; % creation cost
model;
% Auxiliary definitions for matching function and flow probabilities
exp(e) = 1-exp(u);
exp(t) = exp(v-u);
% Unemployment value function (eq 16)
exp(U) = b + B*( A*((exp(t))^(1-a))*x*exp(S(+1)) + exp(U(+1)) );
% Vacancy value function (eq 17)
exp(V) = -c + B*( A*((exp(t))^(-a))*(1-x)*exp(S(+1)) + exp(V(+1)) );
% Output value function (eq 18)
exp(M) = exp(z) + B*( (1-l)*exp(S(+1)) + exp(U(+1)) + exp(V(+1)) );
% Matching surplus definition (S=M-U-V) (eq 19)
exp(S) = exp(z) - b + c + B*((1-l) - A*((exp(t))^(1-a))*x - A*((exp(t))^(-a))*(1-x))*exp(S(+1));
% FONC: V=K*n (eq 21)
c = B*( A*((exp(t))^(-a))*(1-x)*exp(S(+1)));
% Law of motion for (eq 22)
exp(u) = exp(u(-1)) + l*(1-exp(u(-1))) - A*((exp(t(-1)))^(1-a)) * exp(u(-1));
% Log productivity follows an exogenous AR(1) process
z = rho*z(-1) + zi;
end;
initval;
U = 294.865;
V = 0.543609;
M = 295.738;
S = 0.32959;
u = 0.0798989;
e = 0.920101;
v = 0.04076282;
t = 0.510245;
z = 1;
end;
shocks;
var zi = sigma^2;
end;
steady(solve_algo=0);
stoch_simul(
order = 1,
periods = 30300,
drop = 300,
IRF = 90
);
The original code's source is
http://michael-droste.com/replications/Cheers