Perfect foresight given sequences of exogenous variables

Dear team,
I am trying to solve part of a large OLG perfect foresight model using Dynare. In particular, I want to solve in Dynare a system of 21 equations, and I have 21 endogenous variables. However, I would also like to give as input to Dynare the exogenous sequences for three other variables (namely, TFP, aggregate labor and aggregate capital, for all periods of the simulation, i.e., periods t=1,2,…200). How can I do this?
Thank you very much!

In a prefect foresight environment (or deterministic environment), every variable is endogenous. You just need to declare the law of motions for these new variables (AR processe, Random Walk…) and simulate the model as usual. You will end up with a system of 24 equations and 24 endogenous variables.

Thank you for your reply, Tavinho!
I don’t have a law of motion, but rather exogenous sequences for the variables (example: aggregate labor L_1, L_2,…,L_200). Can I declare these exogenous sequences to Dynare? If so, how? Using shocks?
Note that I am solving only PART of my model in Dynare (i.e., the system of 21 equations). There is a huge chunk of the model that I am solving separately with a regular Matlab code.

Let me correct my previous post. You can have exogenous variables in a perfect foresight model. But you need to declare their path (and not their variance), and this is exactly what you need. See this section in the manual for an example: 4. The model file — Dynare 5.1 documentation.

In short, you need to declare the exogenous variables in the varexo block and after model declaration add a block like this:


var TFP;
periods 1:200;
values 0.5; % provide a path here

var L;
periods 1:200;
values 2; % provide a path here

var K;
periods 1:200;
values 1; % provide a path here


and then use the simul command or call to perfect_foresight_setup followed by a call to perfect_foresight_solver .

I see. I will do as you say, thank you very much! :slight_smile:

The post at

may also be useful.

1 Like