Table Of Contents

Perfect foresight algorithm

The perfect foresight algorithm is implemented for models of type “fg”. Recall that ths type of model is specified by \(g\) and \(f\) such that:

\(s_t = g \left( s_{t-1}, x_{t-1}, \epsilon_t \right)\)

\(E_t \left[ f \left( s_t, x_t, s_{t+1}, x_{t+1} \right) \right]=0\)

In this exercise, the exogenous shocks are supposed to take a predetermined series of values \((\epsilon_0,\epsilon_1,...,\epsilon_K)\). We assume \(\forall t<0, \epsilon_t=\epsilon_0\) and \(\forall t>K, \epsilon_t=\epsilon_K\).

We compute the transition of the economy specified by \(fg\), from an equilibrium with \(\epsilon=\epsilon_0\) to an equilibrim with \(\epsilon=\epsilon_K\).

This transition happens under under perfect foresight, in the following sense. For \(t<0\) agents, expect the economy to remain at its initial steady-state, but suddenly, at \(t=0\), they know the exact values, that innovations will take until the end of times.

dolo.algos.perfect_foresight.deterministic_solve(model, shocks=None, T=100, use_pandas=True, ignore_constraints=False, start_s=None, verbose=False)[source]

Computes a perfect foresight simulation using a stacked-time algorithm.

Parameters:
  • model – an “fga” model
  • shocks – a \(n_e\times N\) matrix containing \(N\) realizations of the shocks. \(N\) must be smaller than \(T\). The exogenous process is assumed to remain constant and equal to its last value after N periods.
  • T – the horizon for the perfect foresight simulation
  • use_pandas – if True, returns a pandas dataframe, else the simulation matrix
  • ignore_constraints – if True, complementarity constraintes are ignored.
Returns:

a dataframe with T+1 observations of the model variables along the simulation (states, controls, auxiliaries). The first observation is the steady-state corresponding to the first value of the shocks. The simulation should return

to a steady-state corresponding to the last value of the exogenous shocks.

dolo.algos.perfect_foresight.find_steady_state(model, e, force_values=None)[source]

Finds the steady state corresponding to exogenous shocks \(e\).

Parameters:
  • model – an “fga” model.
  • e – a vector with the value for the exogenous shocks.
  • force_values – (optional) a vector where finite values override the equilibrium conditions. For instance a vector \([0,nan,nan]\) would impose that the first state must be equal to 0, while the two next ones, will be determined by the model equations. This is useful, when the deterministic model has a unit root.
Returns:

a list containing a vector for the steady-states and the corresponding steady controls.