You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tutorial/boehl_hommes.rst
+9-34Lines changed: 9 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
Boehl-Hommes method
3
3
-------------------
4
4
5
-
The package also contains an alternative "shooting" method much aligned to the one introduced in Boehl & Hommes (2021). In the original paper we use this method to solve for chaotic asset price dynamics. The method can be understood as a policy function iteration where the initial state is the only fixed grid point and all other grid points are chosen endogenously (as in a "reverse" EGM) to map the expected trajectory.
5
+
The package also contains an alternative "shooting" method much aligned to the one introduced in Boehl & Hommes (2021). In the original paper we use this method to solve for chaotic asset price dynamics. The method can be understood as an extension to Fair & Taylor (1983) and is similar to a policy function iteration where the initial state is the only fixed grid point and all other grid points are chosen endogenously (as in a "reverse" EGM) to map the expected trajectory.
6
6
7
-
The main advantage (in terms of robustness) over the stacking method comes from exploiting the property that most determined perfect foresight models are a contraction mapping both, forward and backwards. The model is given by
7
+
Assume the model is given by
8
8
9
9
.. code-block::
10
10
@@ -17,39 +17,9 @@ We iterate on the expected trajectory itself instead of the policy function. We
17
17
d f(x_{t-1}, x_t, x_{t+1} ) < d x_{t-1},
18
18
d f(x_{t-1}, x_t, x_{t+1} ) < d x_{t+1}.
19
19
20
-
This is also the weakness of the method: not every DSGE model (that is determined in the Blanchard-Kahn sense) is such backward-and-forward contraction. In most cases the algorithm converges anyways, but convergence is not guaranteed.
20
+
This is also the weakness of the method: not every DSGE model (that is determined in the Blanchard-Kahn sense) is such backward-and-forward contraction. Thus, unless you are interested in chaotic dynamics, the standard "stacking" method is to be prefered.
21
21
22
-
The following example shows how to use the shooting method on the simple New Keynesian model.
23
-
24
-
.. code-block:: python
25
-
26
-
import numpy as np
27
-
import matplotlib.pyplot as plt
28
-
import econpizza as ep
29
-
from econpizza import example_nk
30
-
31
-
# load the example.
32
-
# example_nk is nothing else but the path to the yaml, hence you could also use `filename = 'path_to/model.yaml'`
33
-
mod = ep.load(example_nk)
34
-
# solve for the steady state
35
-
_ = mod.solve_stst()
36
-
37
-
# get the steady state as an initial state
38
-
state = mod['stst'].copy()
39
-
# increase the discount factor by one percent
40
-
state['beta'] *=1.02
41
-
42
-
# simulate the model
43
-
x, _, flag = mod.find_path_shooting(state.values())
44
-
45
-
# plotting
46
-
for i,v inenumerate(mod.var_names):
47
-
48
-
plt.figure()
49
-
plt.plot(x[:,i])
50
-
plt.title(v)
51
-
52
-
Lets go for a second, numerically more challenging example: the chaotic rational expectations model of Boehl & Hommes (2021)
22
+
The following example shows how to use the shooting method to a numerically challenging example: the chaotic rational expectations model of Boehl & Hommes (2021). The YAML for this model can be found `here <https://github.com/gboehl/econpizza/blob/master/econpizza/examples/bh.yml>`_.
53
23
54
24
.. code-block:: python
55
25
@@ -81,3 +51,8 @@ This will give you boom-bust cycles in asset pricing dynamics:
f"`{v}Lag` in decisions calls detected. For efficiency reasons, the use of lagged values is not supported here. This can be circumvented by defining an auxilliary variable, e.g. `{v}_lagged = {v}Lag`.")
0 commit comments