Skip to content

SyntheticCentralGovernment

The SyntheticCentralGovernment class is an abstract base class that serves as a container for preprocessed central government data. It manages government data including revenue streams, social benefits, tax collections, and financial positions.

Core Functionality

The class stores government data in a pandas DataFrame with the following key columns:

  • Total Unemployment Benefits: Initial unemployment benefit levels
  • Other Social Benefits: Initial levels of other social transfers
  • Debt: Initial central government debt level
  • Bank Equity Injection: Initial bank support levels
  • Total Social Housing Rent: Initial social housing revenue
  • Taxes on Production: Initial production tax revenue
  • VAT: Initial value-added tax revenue
  • Capital Formation Taxes: Initial capital tax revenue
  • Export Taxes: Initial export tax revenue
  • Corporate Taxes: Initial corporate tax revenue
  • Employer SI Tax: Initial employer social insurance revenue
  • Employee SI Tax: Initial employee social insurance revenue
  • Income Taxes: Initial income tax revenue
  • Rental Income Taxes: Initial rental tax revenue
  • Revenue: Total initial revenue
  • Taxes on Products: Initial product tax revenue

Key Attributes

  • country_name: Country identifier for data collection
  • year: Reference year for preprocessing
  • central_gov_data: Main DataFrame containing government information
  • other_benefits_model: Model for estimating other benefits
  • unemployment_benefits_model: Model for estimating unemployment benefits

Main Methods

  • update_fields: Updates preprocessed government data based on other economic agents
  • set_revenue: Sets initial revenue values in the preprocessed government data

Implementation

Module for preprocessing synthetic central government data.

This module provides an abstract base class for preprocessing and organizing central government data that will be used to initialize behavioral models. Key preprocessing includes:

  1. Data Collection and Organization:
  2. Government revenue data preparation
  3. Social benefits data processing
  4. Tax revenue calculations

  5. Financial Data Processing:

  6. Tax revenue estimation
  7. Benefits model parameter estimation
  8. Revenue stream organization

  9. Relationship Data:

  10. Government-household transfers
  11. Government-firm tax relationships
  12. Social housing management
Note

This module is NOT used for simulating government behavior. It only handles the preprocessing and organization of data that will later be used to initialize behavioral models in the simulation package.

SyntheticCentralGovernment

Abstract base class for preprocessing and organizing central government data.

This class provides a framework for collecting and organizing government data that will be used to initialize behavioral models. It is NOT used for simulating government behavior - it only handles data preprocessing.

The preprocessed data is stored in a pandas DataFrame with the following columns
  • Total Unemployment Benefits: Initial unemployment benefit levels
  • Other Social Benefits: Initial levels of other social transfers
  • Debt: Initial central government debt level
  • Bank Equity Injection: Initial bank support levels
  • Total Social Housing Rent: Initial social housing revenue
  • Taxes on Production: Initial production tax revenue
  • VAT: Initial value-added tax revenue
  • Capital Formation Taxes: Initial capital tax revenue
  • Export Taxes: Initial export tax revenue
  • Corporate Taxes: Initial corporate tax revenue
  • Employer SI Tax: Initial employer social insurance revenue
  • Employee SI Tax: Initial employee social insurance revenue
  • Income Taxes: Initial income tax revenue
  • Rental Income Taxes: Initial rental tax revenue
  • Revenue: Total initial revenue
  • Taxes on Products: Initial product tax revenue
Note

This is a data container class. The actual government behavior (spending decisions, tax adjustments, etc.) is implemented in the simulation package, which uses this preprocessed data for initialization.

Attributes:

Name Type Description
country_name str

Country identifier for data collection

year int

Reference year for preprocessing

central_gov_data DataFrame

Preprocessed government data

other_benefits_model Optional[LinearRegression]

Model for estimating other benefits

unemployment_benefits_model Optional[LinearRegression]

Model for estimating unemployment benefits

country_name = country_name instance-attribute
year = year instance-attribute
central_gov_data = central_gov_data instance-attribute
unemployment_benefits_model = unemployment_benefits_model instance-attribute
other_benefits_model = other_benefits_model instance-attribute
__init__(country_name: str, year: int, central_gov_data: pd.DataFrame, other_benefits_model: Optional[LinearRegression], unemployment_benefits_model: Optional[LinearRegression]) abstractmethod

Initialize the central government data container.

Parameters:

Name Type Description Default
country_name str

Country identifier for data collection

required
year int

Reference year for preprocessing

required
central_gov_data DataFrame

Initial data to preprocess

required
other_benefits_model Optional[LinearRegression]

Model for estimating other benefits

required
unemployment_benefits_model Optional[LinearRegression]

Model for estimating unemployment benefits

required
update_fields(tax_data: TaxData, synthetic_population: SyntheticPopulation, synthetic_firms: SyntheticFirms, synthetic_banks: SyntheticBanks, industry_data: dict[str, pd.DataFrame]) -> None

Update preprocessed government data fields based on other economic agents.

This method processes and organizes data from various economic agents to prepare: 1. Social housing revenue data 2. Tax revenue calculations 3. Income and consumption data 4. Financial asset data

The preprocessing steps: 1. Calculate social housing metrics 2. Process firm and bank tax data 3. Calculate income-based revenues 4. Process consumption and investment taxes

Parameters:

Name Type Description Default
tax_data TaxData

Tax rates and parameters

required
synthetic_population SyntheticPopulation

Population data container

required
synthetic_firms SyntheticFirms

Firm data container

required
synthetic_banks SyntheticBanks

Bank data container

required
industry_data dict[str, DataFrame]

Industry-level economic data

required
set_revenue(total_social_housing_rent: float, firm_taxes_and_subsidies: float, firm_corporate_taxes: float, bank_corporate_taxes: float, firm_employer_si_tax: float, household_vat: float, export_tax: float, employee_si_tax: float, income_tax: float, rental_income_tax: float, household_gross_capital_inputs: float, cf_tax: float) -> None

Set initial revenue values in the preprocessed government data.

This method organizes and stores initial revenue values for: 1. Social housing revenue 2. Various tax revenues 3. Total government revenue 4. Product-specific taxes

The preprocessing steps: 1. Store individual revenue components 2. Calculate and store total revenue 3. Calculate and store product tax totals

Parameters:

Name Type Description Default
total_social_housing_rent float

Initial social housing revenue

required
firm_taxes_and_subsidies float

Initial production tax revenue

required
firm_corporate_taxes float

Initial firm tax revenue

required
bank_corporate_taxes float

Initial bank tax revenue

required
firm_employer_si_tax float

Initial employer SI revenue

required
household_vat float

Initial VAT revenue

required
export_tax float

Initial export tax revenue

required
employee_si_tax float

Initial employee SI revenue

required
income_tax float

Initial income tax revenue

required
rental_income_tax float

Initial rental tax revenue

required
household_gross_capital_inputs float

Initial capital inputs

required
cf_tax float

Capital formation tax rate

required

DefaultSyntheticCentralGovernment

DefaultSyntheticCentralGovernment is a concrete implementation of SyntheticCentralGovernment that provides preprocessing of central government data using standard data sources. This class handles the initialization and organization of data that will be used to initialize behavioral models in the simulation package.

Data Source Integration

The class integrates data from multiple sources:

  • Historical benefits data
  • Tax revenue data
  • Government debt data
  • Bank support data

Initial State Processing

The class processes:

  • Benefits data organization
  • Tax revenue parameter estimation
  • Initial state calculations
  • Model parameter estimation

Parameter Estimation

Key parameters estimated include:

  • Benefits models (unemployment and other benefits)
  • Tax revenue parameters
  • Initial debt levels
  • Bank support levels

Factory Methods

The class provides a factory method from_readers that creates a DefaultSyntheticCentralGovernment instance by:

  1. Reading and processing data from various sources
  2. Estimating benefits models using historical data
  3. Setting up initial state data
  4. Calculating initial parameters

Additional Methods

  • build_unemployment_model: Estimates a model for preprocessing unemployment benefits data
  • build_other_benefits_model: Estimates a model for preprocessing other benefits data

Implementation

Module for preprocessing synthetic central government data.

This module provides a concrete implementation for preprocessing central government data that will be used to initialize behavioral models. Key preprocessing includes:

  1. Data Collection and Processing:
  2. Historical benefits data preparation
  3. Tax revenue data organization
  4. Initial state calculations

  5. Parameter Estimation:

  6. Benefits model estimation
  7. Tax revenue estimation
  8. Data validation and consistency checks

  9. Data Organization:

  10. Standard data preprocessing
  11. Exogenous data preprocessing
  12. Historical data processing
Note

This module is NOT used for simulating government behavior. It preprocesses data that will be used to initialize behavioral models in the simulation package. The actual government decisions and operations are implemented elsewhere.

DefaultSyntheticCGovernment

Default implementation for preprocessing central government data.

This class preprocesses and organizes central government data by collecting historical data and estimating parameters. These will be used to initialize behavioral models, but this class does NOT implement any behavioral logic.

The class provides two preprocessing paths: 1. Standard preprocessing using historical data 2. Exogenous data preprocessing when available

The preprocessing includes: - Benefits data organization - Tax revenue parameter estimation - Initial state calculations - Model parameter estimation

Note

This is a data container class. The actual government behavior (spending, tax policy, etc.) is implemented in the simulation package, which uses these preprocessed parameters.

Attributes:

Name Type Description
country_name str

Country identifier for data collection

year int

Reference year for preprocessing

central_gov_data DataFrame

Preprocessed government data

other_benefits_model Optional[LinearRegression]

Model for estimating other benefits

unemployment_benefits_model Optional[LinearRegression]

Model for estimating unemployment benefits

__init__(country_name: str, year: int, central_gov_data: pd.DataFrame, other_benefits_model: Optional[LinearRegression], unemployment_benefits_model: Optional[LinearRegression])

Initialize the central government data container.

Parameters:

Name Type Description Default
country_name str

Country identifier for data collection

required
year int

Reference year for preprocessing

required
central_gov_data DataFrame

Initial data to preprocess

required
other_benefits_model Optional[LinearRegression]

Model for estimating other benefits

required
unemployment_benefits_model Optional[LinearRegression]

Model for estimating unemployment benefits

required
from_readers(readers: DataReaders, country_name: Country, year: int, year_range: int = 10, regression_window: int = 48, equity_injection: float = 0.0) -> SyntheticCentralGovernment classmethod

Create a preprocessed central government data container using standard data sources.

This method preprocesses data using historical sources to prepare: 1. Benefits data (unemployment and other benefits) 2. Initial debt levels 3. Parameter estimates for benefits models

The preprocessing steps: 1. Check for exogenous data availability 2. If available, estimate benefits models using historical data 3. If not available, use direct historical values 4. Prepare initial state data

Parameters:

Name Type Description Default
readers DataReaders

Data source readers

required
country_name Country

Country to preprocess data for

required
year int

Reference year for preprocessing

required
year_range int

Years of historical data to use. Defaults to 10.

10
regression_window int

Months of data for model estimation. Defaults to 48.

48
equity_injection float

Initial bank support level. Defaults to 0.0.

0.0

Returns:

Name Type Description
SyntheticCentralGovernment SyntheticCentralGovernment

Container with preprocessed government data

build_unemployment_model(benefits_inflation_data: pd.DataFrame, regression_window: int = 48)

Estimate a model for preprocessing unemployment benefits data.

This function estimates parameters for preprocessing unemployment benefits by: 1. Computing historical growth ratios 2. Fitting a model based on inflation and unemployment 3. Preparing parameters for initialization

Parameters:

Name Type Description Default
benefits_inflation_data DataFrame

Historical benefits and inflation data

required
regression_window int

Months of data for estimation. Defaults to 48.

48

Returns:

Name Type Description
LinearRegression

Estimated model for preprocessing, or None if insufficient data

build_other_benefits_model(benefits_inflation_data: pd.DataFrame, regression_window: int = 48)

Estimate a model for preprocessing other benefits data.

This function estimates parameters for preprocessing non-unemployment benefits by: 1. Computing historical growth ratios 2. Fitting a model based on inflation and unemployment 3. Preparing parameters for initialization

Parameters:

Name Type Description Default
benefits_inflation_data DataFrame

Historical benefits and inflation data

required
regression_window int

Months of data for estimation. Defaults to 48.

48

Returns:

Name Type Description
LinearRegression

Estimated model for preprocessing, or None if insufficient data