Simple first order difference equation

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

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 :wink:).

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:


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.

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+bf(-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

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.