"Convergency obtained" - but not true

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

"Convergency obtained" - but not true

Postby Peter Zar » Fri Oct 31, 2014 1:25 pm

Hi all,

I have written the code from Adam (2011) - "Government debt and optimal monetary and fiscal policy" in Dynare and used the deterministic simulation to solve it. After letting it run the code seems to be converging as

MODEL SIMULATION :

Total time of simulation :0.07

Convergency obtained.

However, the debt stock decreases continuously and jumps in the last period. In that period, the equations do not sum to 0 as imposed by the model.

To be precise just use the following commands:

c=oo_.endo_simul(2,:);
pi=oo_.endo_simul(3,:);
h=oo_.endo_simul(4,:);
b=oo_.endo_simul(5,:);
R=oo_.endo_simul(6,:);
tau=oo_.endo_simul(7,:);
g=oo_.endo_simul(8,:);
uc = 1./c;
uh = -omegah*h.^phi;

figure
plot(b)

and when evaluating the budget constraint at the second last and the very last (basically the endpoint) one gets completely different results:
resid_last=b(end) -(tau(end)/(1-tau(end)))*(uh(end)/uc(end))*h(end)-g(end)-R(end-1)*b(end-1)/pi(end);
resid_2nd_last=b(end-1) -(tau(end-1)/(1-tau(end-1)))*(uh(end-1)/uc(end-1))*h(end-1)-g(end-1)-R(end-1-1)*b(end-1-1)/pi(end-1);

Does that mean the code did not converge or am I interpreting something wrong here?

Thanks in advance!

For those not familiar with the paper, it is a standard NKM with optimal fiscal and monetary policy.
Attachments
adam_dynare.mod
(3.55 KiB) Downloaded 155 times
Peter Zar
 
Posts: 14
Joined: Tue Jan 21, 2014 12:02 pm

Re: "Convergency obtained" - but not true

Postby jpfeifer » Fri Oct 31, 2014 7:32 pm

Try a stochastic simulation:
Code: Select all
var z c pi h b R tau g gamma2 gamma1 gamma4 gamma3 uc uh ug ucc uhh ugg;
parameters eta omegah phi beta theta omegag arz;
varexo eps_z;

// PREFERENCES
b_ss   = 0;             // 0 steady state real government debt
beta   = 1/(1+0.035/4); // quarterly discount factor (with annual average real interest rate 3.5//)
theta  = 17.5;          // degree of price stickiness
phi    = 1.0;           // 1/elasticity of labor supply
fw     = 0;             // directly wasteful government spending, called x in the model
eta    = -6;
arz    = 0.95;          // ar coefficient of z process,
muz    = 1.0;           // mean of technology shock

vf     = (1-arz^2)/(1-0.95^2);        // scales the variance of the prod schock so that unconditional variance is independent of autoregressive parameter arz

constz = muz*(1-arz);   // constant in the law of motion of technology
varz   = vf*(0.006)^2;     //       "            innovation's quarterly variance
mz0    = 1;

c_ss  = 0.16-fw;                   // private consumption, net of fiscal waste
h_ss  = 0.2;                       // labor effort
g_ss  = 0.04;                      // fiscal spending
pi_ss = 1;                         // gross inflation rate
R_ss  = 1/beta;                    // gross nominal interest rate

x_tilde= fw-(1-1/beta)*b_ss;

// utility parameters that give rise to the targeted Ramsey steady
// state and steady state Lagrange multipliers
omegah=19.791666666666668;
omegag=0.265589569160998;
gamma1_ss=0.873015873015873;
gamma3_ss=4.768990929705216;
gamma2_ss=0;
gamma4_ss=1.870748321670390;

uc_ss  = 1./c_ss;
ucc_ss = -c_ss.^(-2);
uh_ss  = -omegah*h_ss.^phi;
uhh_ss = -omegah*phi*h_ss.^(phi-1);

tau_ss  = (g_ss+x_tilde)/(g_ss+x_tilde+omegah*(h_ss^phi)*c_ss*h_ss);                // income tax rate         
ug_ss  = omegag/g_ss;
ugg_ss = -omegag/g_ss^2;

model;
// Specification
uc  = 1/c;              // log utility in consumption
uh  = -omegah*h^phi;
ug  = omegag/g;

ucc = -1/c^2;
uhh = -omegah*phi*h^(phi-1);
ugg = -omegag/g^2;


// Define the FOCs (7 eqns)
// FOC for c
uc + (gamma1-gamma1(-1))*ucc*(pi-1)*pi-gamma1*(ucc*z/theta*h)*(1+eta+uh*eta/(uc*(1-tau)*z))
-gamma1*(uc*z/theta*h)*(-ucc*uh*eta/(uc^2*(1-tau)*z))+gamma2*ucc/R-gamma2(-1)*ucc/pi-gamma3+gamma4*((tau/(1-tau))*uh*h*ucc/(uc^2));

// FOC for h
uh-gamma1*(uc*z/theta)*(1+eta+uh*eta/(uc*(1-tau)*z)+h*uhh*eta/(uc*(1-tau)*z))+gamma3*z-gamma4*(tau/((1-tau)*uc))*(uhh*h+uh);

// FOC for pi
(gamma1-gamma1(-1))*uc*(2*pi-1)+gamma2(-1)*uc/pi^2-gamma3*theta*(pi-1)+gamma4*R(-1)*b(-1)/pi^2;

// FOC for R
-gamma2*uc/R^2 -beta*gamma4(+1)*b/pi(+1);

// FOC for tau
//-gamma1*(uc*z*h/theta)*(uh*eta/(uc*z*(1-tau)^2))-gamma4*(uh*h/((1-tau)^2*uc));
-gamma1*(uc/theta*eta)-gamma4;

// FOC for g
ug -gamma3 - gamma4;

// FOC for b
gamma4-beta*(gamma4(+1)*R/pi(+1));

// Define the ICs (3 eqns)
// Phillips curve
uc*(pi-1)*pi-(uc*z*h/theta)*(1+eta+uh*eta/(uc*(1-tau)*z))-beta*uc(+1)*(pi(+1)-1)*pi(+1);

// Euler equation
uc/R-beta*uc(+1)/pi(+1);

// Ressource constraint
z*h-c-(theta/2)*(pi-1)^2-g;

// Budget constraint
b -(tau/(1-tau))*(uh/uc)*h-g-R(-1)*b(-1)/pi;

// Technology
log(z)=arz*log(z(-1))+eps_z;
end;

initval;
c=c_ss;
pi=pi_ss;
h=h_ss;
b=b_ss;
R=R_ss;
tau=tau_ss;
g=g_ss;
gamma2=gamma2_ss;
gamma1=gamma1_ss;
gamma4=gamma4_ss;
gamma3=gamma3_ss;
z=1;
uc=uc_ss;
uh=uh_ss;
ug=ug_ss;
ucc=ucc_ss;
uhh=uhh_ss;
ugg=ugg_ss;
end;
steady;

shocks;
var eps_z=0.01;
end;
stoch_simul(order=1,irf=250);

There is a unit root that makes b non-stationary. This seems to be the reason it explodes.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: "Convergency obtained" - but not true

Postby Peter Zar » Sat Nov 01, 2014 8:41 am

Now I am puzzled even more by the existence of a unit root. Are log linearization around a steady state and the resulting policy functions valid description if any transitory shock pushes some variables permanently away from the steady state? I know unit roots from technology shocks but then one detrends those variables such that they are stationary. Can you/anybody maybe help me understand how to think about that intuitively?

Thanks again!
Peter Zar
 
Posts: 14
Joined: Tue Jan 21, 2014 12:02 pm

Re: "Convergency obtained" - but not true

Postby jpfeifer » Sun Nov 02, 2014 12:54 pm

Local approximations by nature are local. If you shock is not too big, the policy functions will still be an accurate description of the true model even if a unit root is present. That is why IRFs for small shocks are still ok. You cannot run simulations as they will explode and the policy functions obtained at the steady state will be a poor representation of the true dynamics.

For non-linear deterministic simulations, this might not be that relevant, because away from the steady state, the true dynamics might be different. Unfortunately, in your case there the current model seems to display slow divergence outside of the steady state. This might indicate that your model implementation is still wrong.

I only pointed out that you have a unit root at the deterministic steady state that probably should not be there at all and there might still be a mistake in your model.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: "Convergency obtained" - but not true

Postby jpfeifer » Mon Nov 03, 2014 7:45 pm

As noted above, the model features a unit root as discussed in the paper. Thus, the steady state changes/is indeterminate. Deterministic simulations of the type you conduct here requires the specification of an initial and terminal condition. For stationary models, this is easy as the terminal condition typically is the steady state. But in the Adam (2011) model the steady state changes after a shock. Hence, specifying the terminal condition as the initial steady state is wrong and convergence to this wrong steady state cannot be obtained.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: "Convergency obtained" - but not true

Postby Peter Zar » Tue Nov 04, 2014 2:26 pm

That makes perfect sence - thank you very much!
Peter Zar
 
Posts: 14
Joined: Tue Jan 21, 2014 12:02 pm


Return to Dynare contributions and examples

Who is online

Users browsing this forum: No registered users and 1 guest