Model#

This class is the base class for all model classes. It contains the common methods for all model classes.

Constructor#

Model(parameters, hyperparameters, ...)

A general class to represent a macroeconomic model.

Initialization and Loading#

Model.load(path)

Class method to load a model instance from a pickled file.

Simulation and Behavior#

Model.simulate([scenario])

Simulate the model.

Serialization / IO#

Model.save(path)

Save the model object as a pickled file

Model.to_json(file_path, *args, **kwargs)

Convert the model to a JSON file split into parameters, scenarios, and variables.

Notes#

The Model class is designed to be a flexible wrapper that allows users to implement their own model behavior while maintaining a consistent interface. The key method that users need to implement is simulate(), which should return a pandas DataFrame containing the simulation results.

Example#

A general workflow for a model might look like:

>>> model = Model(parameters, hyperparameters)
>>> output = model.simulate()
>>> model.save()