EconForge/dolo.py

ModelError when looking at model's exogenous property

sbenthall opened this issue · 2 comments

When looking at this model:

https://github.com/EconForge/dolo/blob/master/examples/models/consumption_savings.yaml

I get the following error inspecting model.exogenous:

>>> model = yaml_import("../models/consumption_savings.yaml")
>>> model.exogenous

---------------------------------------------------------------------------
ModelError                                Traceback (most recent call last)
<ipython-input-18-26d7372e0ca8> in <module>
----> 1 model.exogenous

~/projects/econ-ark/dolo/dolo/compiler/model.py in exogenous(self)
    310     def exogenous(self):
    311         if self.__exogenous__ is None:
--> 312             self.__exogenous__ = super(self.__class__, self).get_exogenous()
    313         return self.__exogenous__
    314 

~/projects/econ-ark/dolo/dolo/compiler/model.py in get_exogenous(self)
    157         calibration = self.get_calibration()
    158         from dolo.compiler.language import eval_data
--> 159         exogenous = eval_data(exo, calibration)
    160 
    161         from ruamel.yaml.comments import CommentedMap, CommentedSeq

~/projects/econ-ark/dolo/dolo/compiler/language.py in eval_data(data, calibration)
    118             lc = data.lc
    119             msg = f"Line {lc.line}, column {lc.col}.  Tag '{tag.value}' is not recognized.'"
--> 120             raise ModelError(msg)
    121 
    122         if tag.value is not None:

ModelError: Line 29, column 11.  Tag '!AR1' is not recognized.'

Same error with:
model.get_exogenous()

albop commented

@sbenthall This issue is fixed by 7a12eb7 .
The yaml file is now incorrect and accessing the exogenous property should raise error Line 29, column 11. Unexpected argument 'Sigma'. Expected: 'AR1(ρ=float, σ=float, μ=Optional[float])'
The convention is now that AR1 is a scalar process which accepts scalar arguments, while VAR1
is a vector process, which takes vector or matrices as arguments.
To fix the yaml file either change AR1 by VAR1 or change \Sigma to \sigma as suggested by the error message.