Scenarios#

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

Constructor#

Scenarios(parameters[, scenarios, ...])

Scenarios class for the MacroStat model.

Initialization and Loading#

Scenarios.from_json(json_path, parameters)

Initialize the scenarios from a JSON file.

Scenarios.from_excel(excel_path, parameters)

Initialize the scenarios from an Excel file.

Scenario Management#

Scenarios.add_scenario(timeseries[, name, ...])

Add a scenario to the model.

Scenarios.get_default_scenario()

Return the default scenario variable in vectorized form.

Scenarios.get_default_scenario_values()

Return the default scenario values.

Scenarios.get_scenario_index(scenario)

Get the index of a scenario by name.

Scenarios.verify_scenario_info()

Verify that the scenario info is consistent: 1.

Serialization / IO#

Scenarios.to_json(json_path)

Save the scenarios to a JSON file.

Scenarios.to_excel(excel_path)

Save the scenarios to an Excel file.

Notes#

The Scenarios class provides a uniform interface for handling scenarios, particularly for exogenous shocks. It supports both user-specified scenarios and calibration scenarios, and includes methods for loading and saving scenarios in various formats.

Example#

A typical workflow for scenarios might look like:

>>> scenarios = Scenarios(parameters)
>>> scenarios.add_scenario({'shock': 0.1}, name='shock_scenario')
>>> scenarios.to_json('scenarios.json')