Page 1 of 1
Dynare notation
Posted:
Mon Jul 18, 2016 2:16 pm
by fabioit
Hello everyone,
I have found a replication of a labour market model that uses a notation of this kind:
model;
(1/c) = beta*(1/c(+1))*(1+r(+1)-delta);
However, I want to integrate it with another NK model that uses a notation of this kind:
model;
(1/exp(c)) = beta*(1/exp(c(+1)))*(1+exp(r(+1))-delta);
I thought I could solve by re-writing the first piece of code in in exp-logs (as the second one) but when I do, dynare says it cannot find the steady state anymore.
Does anyone understand why that might happen?
Cheers
Re: Dynare notation
Posted:
Mon Jul 18, 2016 6:20 pm
by jpfeifer
Then you must have introduced a mistake when doing this. You must consistently replace all variables that have been redefined.
Re: Dynare notation
Posted:
Tue Jul 19, 2016 8:14 am
by fabioit
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
Re: Dynare notation
Posted:
Tue Jul 19, 2016 9:50 am
by jpfeifer
When doing an exp()-transformation, you need to adjust the initial values as well. When using
- 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 = log(294.865);
V = log(0.543609);
M = log(295.738);
S = log(0.32959);
u = log(0.0798989);
e = log(0.920101);
v = log(0.04076282);
t = log(0.510245);
z = log(1);
end;
shocks;
var zi = sigma^2;
end;
resid;
steady(solve_algo=4,maxit=1000);
stoch_simul(
order = 1,
periods = 30300,
drop = 300,
IRF = 90
);
it works.
Re: Dynare notation
Posted:
Tue Jul 19, 2016 10:18 am
by fabioit
Dear Professor,
Thank you so much, I was stuck I couldn't get why and thus could not proceed with my work.
Your work here in this blog is precious.
Best,
Fabio
Re: Dynare notation
Posted:
Wed Jul 20, 2016 4:54 pm
by fabioit
Dear Prof.,
One thing remains obscure about the explog version of the model.
The steady-state value of unemployment becomes log(0.0798989) = -2.5270,
how should this be interpreted?
In the normal model 0.08 should be the equilibrium fraction of the household that remains unemployed, but I don't really know how to interpret the transformed value.
Best,
Fabio
Re: Dynare notation
Posted:
Wed Jul 20, 2016 5:21 pm
by jpfeifer
I am not following. After substitution, the new variables are actually the logarithms of the old variables. Steady state unemployment is therefore still 0.0798989.