Sequence of shocks in deterministic model?

Hi, could anyone tell me how I can simulate slowly increasing productivity in a deterministic model like the following one? I want z to increase linearly from 0 to 0.1 over 20 periods. Thanks for your help!

var y c k i l y_l w r ;
varexo z;

parameters beta psi delta alpha sigma epsilon;
alpha = 0.33;
beta = 0.99;
delta = 0.023;
psi = 1.75;
sigma = (0.007/(1-alpha));
epsilon = 10;


(1/c) = beta*(1/c(+1))(1+r(+1)-delta);
c/(1-l) = w;
c+i = y;
y = (k(-1)^alpha)(exp(z)l)^(1-alpha);
w = y
r = y*((epsilon-1)/epsilon)*alpha/k(-1);
i = k-(1-delta)*k(-1);
y_l = y/l; end;

k = 9;
c = 0.7;
l = 0.3;
w = 2.0;
r = 0;
z = 0;


z = 0.1;



You need to define the productivity innovations in the shoks block (described in section 4.8 of the manual). You can do something like:

var z;
periods 1:20;
values (transpose((linspace(0.005,.1,20)));

A full example is given in this Gist.


Dear Stephane,

First I’d like to thank you for the support on the forum, a lot of useful advice that got me through most of the previous difficulties I faced. Still, this time I am stuck.

I am trying to study the transition from one steady state to another in a deterministic (trade/growth) model, and so I used the initval and endval blocks as shown in the example file on Gist. When I test your file on my installation it works nicely, but when I run my code it doesn’t. It seems dynare does not “pick” my initval block and runs on the endval block only. I tried to add a shock, which works taking as steady-states values the endval block. Both initval and endval are filled with steady states as computed separetaly depending on the exogenous variables. Any idea what is going on?

model_cs.m (10.1 KB)
model_cs.mod (3.62 KB)

Many thanks,


Dear Louis,

The Blanchard and Kahn conditions are not satisfied… You have more leaded variables than explosive eigenvalues (->indeterminacy). Also, there is no lag (states) in your model, all the variables are determined by the terminal condition (so I don’t understand the purpose of the initval block in this context)… I wonder if this is really intentional from your part and I suspect a timing error (in the law of motion for the capital stocks?).


Dear Stéphane,

I feel a bit silly to be honest, as I should have used the “check” command before asking (I did that on a previous version of the model and forgot to check again). It was easier to do the algebra with forward variables, hence the look of the law of motions. The solution was indeed to lag the law of motion for capital and consumption. Simulation working just fine now!

Thanks for your time, you just saved a chapter!