EconForge / dolo.py

Economic modelling in python
BSD 2-Clause "Simplified" License
98 stars 72 forks source link

Handling models with no exogenous shocks #176

Open sbenthall opened 4 years ago

sbenthall commented 4 years ago

Currently, if you want to specify a model with no exogenous shocks, it's required to have an empty exogenous list in the symbols section of the markup:

symbols:
  states: [m,p]
  controls: [c]
  parameters: [β, ρ, R, Γ]
  exogenous: []

Or else the following error will be raised:

>>> model
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sb/projects/econ-ark/dolo/dolo/compiler/model.py", line 410, in __repr__
    return self.__str__()
  File "/home/sb/projects/econ-ark/dolo/dolo/compiler/model.py", line 369, in __str__
    res = self.residuals()
  File "/home/sb/projects/econ-ark/dolo/dolo/compiler/model.py", line 499, in residuals
    return residuals(self, calib)
  File "/home/sb/projects/econ-ark/dolo/dolo/algos/steady_state.py", line 15, in residuals
    m = calib['exogenous']
  File "/home/sb/projects/econ-ark/dolo/dolo/compiler/misc.py", line 82, in __getitem__
    return self.flat[p]
KeyError: 'exogenous'

It would be nice if the empty list was not necessary in these situations.

sbenthall commented 4 years ago

https://github.com/EconForge/dolo/issues/31

sbenthall commented 4 years ago

Add a dummy shock automatically if it's absent from the yaml file?