OLG Model with 3 generations

Hello,

I have been working on an Over-lapping Generations model with three generations and stochastic shocks.

I have struggled while writing the dynare code because of the timing setup and the fact that I have 3 generations optimising each period. So, I came up with a way to write the Euler equations for generations 1 and 2, which is the following:

code = cbetarho1(R(+1)/(1 + g))*(cxi/c2(+1));

(cxi/c2) = cbetarho2(R(+1)/(1 + g))*(cxi/c3(+1));
[/code]

Being c1, c2(+1) and c3(+2) the consumption of generation 1, 2 and 3 in period 0, 1 and 2.

Im worried that my code could not be optimising for the entire time horizon of an agent (3 periods) but instead in a staggered way.

This has been the only way in which I have fulfilled the Blanchard Kahn Conditions.

Thanks beforehand for all the help.

It seems you are using stochastic simulations. In this case, Dynare only solves stationary, recursive problems. You enter the FOCs that have to hold in each period t={0,1,…,Inf} for one period t_0. Dynare then knows that these same FOCs have to hold in all subsequent periods as well (rational expectations modelling kicks in). If your problem does not fit into this structure, e.g. because of being a finite horizon problem you cannot use stoch_simul.