Page 1 of 1

Simple first order difference equation

PostPosted: Tue Sep 08, 2009 12:35 pm
by aless
Hi,
I have a simple first order difference equation, and I want to compute the transition to one steady state to another steady state, but I get the following error:
Improper assignment with rectangular empty matrix. Does Dynare work with only backward looking variables?

The code is:

var f;
varexo a;
parameters b;
b=0.7;

model;
f=a+b*f(-1);
end;

initval;
f=1.6;
a=0.5;
end;
steady;

endval;
f=2.6;
a=0.8;
end;
steady;

check;

simul(periods=10);

Many thanks!
Alessandro

Re: Simple first order difference equation

PostPosted: Wed Sep 09, 2009 3:42 pm
by StephaneAdjemian
Dear Alessandro,

Dynare is able to simulate a backward looking model (but I never tried because dynare is not needed to solve purely backward looking models, this can be done even with excel ;-)).

There is something weird in your example. How can you expect to go from one steady state to another steady state if the model is backward looking?

If you want to simulate a path from f=0.5/(1-0.7)=1.666667 to f=0.8/(1-0.7)=1.666667 you may try instead the following approach:

Code: Select all

var f;
varexo  a;
parameters b;
b=0.7;

model(block, bytecode);
f=a+b*f(-1);
end;
 
initval;
a = 0.50000000;
f = 1.66666667;
end;

steady(solve_algo=5);

shocks;
var a;
periods 1:20;
values 0.8;
end;

 
simul(periods=20, stack_solve_algo=5);

plot(f);



Note that in this example I use the new deterministic simulation algorithms described here.

Best,
Stéphane.

Re: Simple first order difference equation

PostPosted: Thu Sep 10, 2009 9:54 am
by aless
Dear Stéphane,
many thanks for your reply.
I have tried the code but it seems that my version of Dynare does not recognise the new algoritms you use: my version is version 4.0.4, is there a new version?
Without the new algoritms the code does not work and it gives the same error as before.

One strange thing (and this is why I suspected that the problem was with a model with only pretedermined variables): if I add to the model another equations with a forward looking variable (call it g) everything works (actually my model have only static and predetermined variables but in the future it should incorparate some forward looking variables and this is why I would like to begin to use Dynare):

var f g;
varexo a;
parameters b;
b=0.7;

model;
f=a+b*f(-1);
g=a+b*g(+1);
end;

initval;
a = 0.50000000;
f = 1.66666667;
end;

steady;

shocks;
var a;
periods 1:20;
values 0.8;
end;


simul(periods=20);

plot(f);

This code works but I don't understand why simply adding the equation for g solves the problem.

Many thanks again,
Best,
Alessandro

Re: Simple first order difference equation

PostPosted: Thu Sep 10, 2009 10:26 am
by StephaneAdjemian
Hi Alessandro,

There is a bug (thanx for your bug report) for the deterministic simulations of models with only predetermined variables (using the old algorithms sim1 and simk). We have to investigate this... The new algorithms will be distributed in the next release of dynare (4.1.0) but are already available in the snapshot version.

Best,
Stéphane.