Deterministic endval and initval

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.

Deterministic endval and initval

Postby lonechicken » Tue Feb 11, 2014 12:56 am

I have a linear model that I would like to run with initial and terminal conditions; in particular the variable "gap". I mainly care about keeping "gap" at the values I define in initval and endval at the beginning and end of the simulation. Running the code below does this, but it does not move smoothly to gap's terminal value- it appears to move towards the steady state and then just jump to the terminal value I chose in the last quarter of the simulation, as if the model does not even take the terminal condition into consideration while it is running, until the last quarter, when it suddenly jumps to that value. Any way to make it so that my endval value for gap functions as a real terminal condition that the model appears to actually take into consideration? (Hope that makes sense).

Code: Select all
var infl infl_four zgap_ zgap  zrrl qgap gap rate;




model(linear);
gap=gap(-1)+(1-1.1906+0.3067)*(qgap(-1)-gap(-1))+0.3067*(gap(-1)-gap(-2))+zgap;

infl=0.5*infl_four(-1)+(1-0.5)*infl(1)+0.02667*gap(-1)+0.11268*(zrrl-zrrl(-1));
qgap=-1.7602*zrrl+0.62*zgap_+0.38*gap;
zrrl=0.967*zrrl(1)+(1-0.967)*(rate-infl-0.6*gap);
zgap=(1-1.1906+0.3067)*(qgap-qgap(-1))-0.3067*(1-1.1906+0.3067)*(0.98^2)*(qgap(1)-qgap)+1.1906*0.98*zgap(1)-0.3067*(0.98^2)*zgap(2);
zgap_=0.93*zgap_(1)+(1-0.93)*qgap;
infl_four=0.25*(infl+infl(-1)+infl(-2)+infl(-3));
rate=max(0,0.85*rate(-1)+0.15*(0.0+infl+0.5*(infl-0.02)+gap));
end;


initval;
gap=-0.04;
infl=0.012;

infl_four=0.012;
rate=0.0012;
end;


endval;
gap=0.005;

infl=0.02;
infl_four=0.02;
rate=0.04;

end;


simul(periods=40,maxit=400) ;
lonechicken
 
Posts: 2
Joined: Tue Dec 24, 2013 3:19 am

Re: Deterministic endval and initval

Postby jpfeifer » Tue Feb 11, 2014 7:53 pm

This manual draft should answer your question:
Code: Select all
var c k;
varexo x;
@dots{}
model;
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;

initval;
c = 1.2;
k = 12;
x = 1;
end;
 
endval;
c = 2;
k = 20;
x = 1.1;
end;
simul(periods=200);

In this example, the problem is finding the optimal path for consumption
and capital for the periods t=1 to T=200, given the path of the exogenous
technology level @code{x}. Setting @code{x=1.1} in the
@code{endval}-block without a @code{shocks}-block implies that technology
jumps to this new level in t=1 and stays there forever. Because the law
of motion for capital is backward-looking, we also need an initial
condition for @code{k} at time 0, specified in the @code{initval}-block.
Similarly, because the Euler equation is forward-looking, we need a
terminal condition for @code{c} at t=201, which is specified in the
@code{endval}-block. Specifying @code{c} in the @code{initval}-block and
@code{k} in the @code{endval}-block has no impact on the results: due to
the optimization problem in the first period being to choose @code{c,k}
at t=1 given predetermined capital stock @code{k} inherited from t=0 as
well as the current and future values for technology, the value for
@code{c} at time t=0 plays no role. The same applies to the choice of
@code{c,k} at time t=200, which does not depend on @code{k} at t=201. As
the Euler equation shows, that choice only depends on current capital as
well as future consumption @code{c} and technology @code{x}, but not on
future capital @code{k}. The intuitive reason is that those variables are
the consequence of optimization problems taking place in at periods t=0
and t=201, respectively, which are not considered. Thus, when specifying
those values in the @code{initval} and @code{endval}-blocks, Dynare takes
them as given and basically assumes that there were realizations
of exogenous variables and states (basically initial/terminal conditions
at the unspecified time periods t<0 and t>201) that make those choices
equilibrium values.

This also suggest another way of looking at the use of @code{steady}
after @code{initval} and @code{endval}. Instead of saying that the
implicit unspecified conditions before and after the simulation range
have to fit the initial/terminal conditions of the endogenous variables
in those blocks, @code{steady} specifies that those conditions at t<0 and
t>201 are equal to being at the steady state given the exogenous
variables in the @code{initval} and @code{endval}-blocks and sets the
endogenous variables at t=0 and t=201 to the corresponding steady state
equilibrium values.

The fact that @code{c} at t=0 and @code{k} at t=201 specified in
@code{initval} and @code{endval} are taken as given has an important
implication for plotting the simulated vector for the endogenous
variables: this vector will also contain the initial and terminal
conditions and thus is 202 periods long in the example. When you specify
arbitrary values for the initial and terminal conditions for forward- and
backward-looking variables, respectively, these values can be very far
away from the endogenously determined values at t=1 and t=200. While the
values at t=0 and t=201 are unrelated to the dynamics for 0<t<201, they
may result in strange-looking large jumps. In the example above,
consumption will display a large jump from t=0 to t=1 and capital will
jump from t=200 to t=201.
------------
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


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 4 guests