Skip to content

Rest of World API Reference

This section documents the Rest of World (ROW) component in the macromodel package, which represents the external sector and international linkages outside the modeled countries.

macromodel.rest_of_the_world.rest_of_the_world.RestOfTheWorld

Rest of the World economic agent.

This class represents all external economies as a single agent that trades with the modeled countries. It manages international trade flows, price setting, and market interactions through: - Import and export decisions - International price determination - Trade flow adjustments - Market clearing participation

Attributes:

Name Type Description
country_name str

Associated country identifier

all_country_names list[str]

All countries in model

n_industries int

Number of industrial sectors

functions dict[str, Any]

Economic function implementations

parameters RestOfTheWorldParameters

Behavioral parameters

forecasting_window int

Periods for forecasting

assume_zero_growth bool

Whether to assume no growth

assume_zero_noise bool

Whether to suppress random variation

configuration RestOfTheWorldConfiguration

Model settings

from_pickled_row(country_name: str, all_country_names: list[str], n_industries: int, synthetic_row: SyntheticRestOfTheWorld, configuration: RestOfTheWorldConfiguration, calibration_data_before: pd.DataFrame, calibration_data_during: pd.DataFrame) -> RestOfTheWorld classmethod

Create ROW instance from synthetic data.

Factory method that constructs a RestOfTheWorld instance using synthetic data and calibration information.

Parameters:

Name Type Description Default
country_name str

Associated country identifier

required
all_country_names list[str]

All countries in model

required
n_industries int

Number of industrial sectors

required
synthetic_row SyntheticRestOfTheWorld

Synthetic ROW data

required
configuration RestOfTheWorldConfiguration

Model settings

required
calibration_data_before DataFrame

Pre-period calibration data

required
calibration_data_during DataFrame

During-period calibration data

required

Returns:

Name Type Description
RestOfTheWorld RestOfTheWorld

Initialized ROW instance

reset(configuration: RestOfTheWorldConfiguration) -> None

Reset ROW state with new configuration.

Parameters:

Name Type Description Default
configuration RestOfTheWorldConfiguration

New model settings

required
estimate_inflation(average_country_ppi_inflation: float) -> float

Estimate ROW inflation rate.

Parameters:

Name Type Description Default
average_country_ppi_inflation float

Average PPI inflation

required

Returns:

Name Type Description
float float

Estimated ROW inflation rate

prepare_buying_goods(aggregate_country_production_index: float, aggregate_country_price_index: float) -> None

Prepare import decisions.

Determines desired import volumes based on historical data and current economic conditions.

Parameters:

Name Type Description Default
aggregate_country_production_index float

Production level

required
aggregate_country_price_index float

Price level

required
prepare_selling_goods(aggregate_country_production_index: float, aggregate_country_price_index: float) -> None

Prepare export decisions.

Determines desired export volumes and prices based on historical data and current economic conditions.

Parameters:

Name Type Description Default
aggregate_country_production_index float

Production level

required
aggregate_country_price_index float

Price level

required
prepare_goods_market_clearing(aggregate_country_production_index: float, aggregate_country_price_index: float) -> None

Prepare for goods market clearing.

Sets up all necessary trade decisions and prices for market clearing.

Parameters:

Name Type Description Default
aggregate_country_production_index float

Production level

required
aggregate_country_price_index float

Price level

required
update_planning_metrics(aggregate_country_production_index: float, aggregate_country_price_index: float) -> None

Update planning metrics for market participation.

Parameters:

Name Type Description Default
aggregate_country_production_index float

Production level

required
aggregate_country_price_index float

Price level

required
record_bought_goods() -> None

Record results of goods market transactions.

Updates time series with actual trade volumes and values.

save_to_h5(file: h5py.File) -> None

Save ROW data to HDF5 file.

Parameters:

Name Type Description Default
file File

HDF5 file to save to

required