diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 1e91c17..10d6be9 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.7","generation_timestamp":"2024-12-04T15:19:45","documenter_version":"1.8.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.7","generation_timestamp":"2024-12-05T21:41:01","documenter_version":"1.8.0"}} \ No newline at end of file diff --git a/dev/api.html b/dev/api.html index 2b60888..1dbe54d 100644 --- a/dev/api.html +++ b/dev/api.html @@ -1,9 +1,9 @@ -API · BeforeIT.jl

Code reference

In this page we document the functions which constitute the bulk of BeforeIT.jl functionality.

Agent types

BeforeIT.AggregatesType

This is a Aggregates type. It is used to store the aggregate variables of the economy. Note that t is an integer, while the rest are floats or vectors of floats.

Fields

  • Y [vector]: GDP data + predictions
  • pi_ [vector]: inflation data + predictions
  • P_bar: Global price index
  • P_bar_g [vector]: Producer price index for principal good g
  • P_bar_HH: Consumer price index
  • P_bar_CF: Capital price index
  • P_bar_h: CPI_h
  • P_bar_CF_h: Capital price index _h
  • Y_e: Expected GDP
  • gamma_e: Expected growth
  • pi_e: Expected inflation
  • t: Time index
source
BeforeIT.BankType

This is a Bank type. It represents the bank of the model.

Fields

  • E_k: equity capital (common equity) of the bank
  • Pi_k: Profits of the bank
  • Pi_e_k: Expected profits of the bank
  • D_k: Residual and balancing item on the bank’s balance sheet
  • r: Rate for loans and morgages

Household fields (bank' owner)

  • Y_h: Net disposable income of bank owner (investor)
  • C_d_h: Consumption budget
  • I_d_h: Investment budget
  • C_h: Realised consumption
  • I_h: Realised investment
  • K_h: Capital stock
  • D_h: Deposits
source
BeforeIT.CentralBankType

This is a CentralBank type. It represents the central bank of the model.

Fields

  • r_bar: Nominal interest rate
  • r_G: Interest rate on government bonds
  • rho: Parameter for gradual adjustment of the policy rate
  • r_star: Real equilibrium interest rate
  • pi_star: Inflation target by CB
  • xi_pi: Weight the CB puts on inflation targeting
  • xi_gamma: Weight placed on economic
  • E_CB: Central bank equity
source
BeforeIT.FirmsType

This is a Firms type. Each field is an array which stores the values for all the firms in the economy. Note that the G_i, N_i and V_i fields are integers, while the rest are floats.

For all fields the entry at index i corresponds to the ith firm.

Fields

  • G_i: Principal product
  • alpha_bar_i: Average productivity of labor
  • beta_i: Productivity of intermediate consumption
  • kappa_i: Productivity of capital
  • w_i: Wages
  • w_bar_i: Average wage rate
  • delta_i: Depreciation rate for capital
  • tau_Y_i: Net tax rate on products
  • tau_K_i: Net tax rate on production
  • N_i: Number of persons employed
  • Y_i: Production of goods
  • Q_i: Sales of goods
  • Q_d_i: Demand for goods
  • P_i: Price
  • S_i: Inventories
  • K_i: Capital, in real terms
  • M_i: Intermediate goods/services and raw materials, in real terms
  • L_i: Outstanding loans
  • pi_bar_i: Operating margin
  • D_i: Deposits of the firm
  • Pi_i: Profits
  • V_i: Vacancies
  • I_i: Investments
  • E_i: Equity
  • P_bar_i: Price index
  • P_CF_i: Price index
  • DS_i: Differnece in stock of final goods
  • DM_i: Difference in stock of intermediate goods
  • DL_i: Obtained loans
  • DL_d_i: Target loans
  • K_e_i: Expected capital
  • L_e_i: Expected loans
  • Q_s_i: Expected sales
  • I_d_i: Desired investments
  • DM_d_i: Desired materials
  • N_d_i: Desired employment
  • Pi_e_i: Expected profits

Household fields (firms' owners)

  • Y_h: Net disposable income of firm owner (investor)
  • C_d_h: Consumption budget
  • I_d_h: Investment budget
  • C_h: Realised consumption
  • I_h: Realised investment
  • K_h: Capital stock
  • D_h: Deposits of the owner of the firms
source
BeforeIT.GovernmentType

This is a Government type. It represents the government of the model.

Fields

  • alpha_G: Autoregressive coefficient for government consumption
  • beta_G: Scalar constant for government consumption
  • sigma_G: Variance coefficient for government consumption
  • Y_G: Government revenues
  • C_G: Consumption demand of the general government
  • L_G: Loans taken out by the government
  • sb_inact: Social benefits for inactive persons
  • sb_other: Social benefits for all
  • C_d_j [vector]: Local governments consumption demand
  • C_j: Realised government consumption
  • P_j: Price inflation of government goods <- ??
source
BeforeIT.ModelType

This is a Model type. It is used to store all the agents of the economy.

Fields

  • w_act: Workers that are active
  • w_inact: Workers that are inactive
  • firms: Firms
  • bank: Bank
  • cb: CentralBank
  • gov: Government
  • rotw: RestOfTheWorld
  • agg: Aggregates
source
BeforeIT.RestOfTheWorldType

This is a RestOfTheWorld type. It represents the rest of the world of the model.

Fields

  • alpha_E: Autoregressive coefficient for exports
  • beta_E: Scalar constant for exports
  • sigma_E: Variance coefficient for exports
  • alpha_I: Autoregressive coefficient for imports
  • beta_I: Scalar constant for imports
  • sigma_I: Variance coefficient for imports
  • Y_EA: GDP euro area
  • gamma_EA: Growth euro area
  • pi_EA: Inflation euro area
  • alpha_pi_EA: Autoregressive coefficient for euro area inflation
  • beta_pi_EA: Autoregressive coefficient for euro area inflation Scalar constant for euro area inflation
  • sigma_pi_EA: Variance coefficient for euro area inflation
  • alpha_Y_EA: Autoregressive coefficient for euro area GDP
  • beta_Y_EA: Autoregressive coefficient for euro area GDP Scalar constant for euro area GDP
  • sigma_Y_EA: Variance coefficient for euro area GDP
  • D_RoW: Net creditor/debtor position of the national economy to the rest of the world
  • Y_I: Supply of imports (in real terms)
  • C_E: Total demand for exports
  • C_d_l [vector]: Demand for exports of specific product
  • C_l: Realised consumption by foreign consumers
  • Y_m [vector]: Supply of imports per sector
  • Q_m [vector]: Sales for imports per sector
  • Q_d_m [vector]: Demand for goods
  • P_m [vector]: Price of imports per sector
  • P_l: Price inflation of exports <- ??
source
BeforeIT.WorkersType

This is a Workers. Each field is an array which stores the values for all the workers in the economy. Note that the O_h field is an integer, while the rest are floats.

For all fields the entry at index i corresponds to the ith worker.

Fields

  • Y_h: Net disposable income of worker owner (investor)
  • D_h: Deposits
  • K_h: Capital stock
  • w_h: Wages (0 if inactive or unemployed)
  • O_h: Occupation (0 if unemployed, -1 if inactive)
  • C_d_h: Consumption budget
  • I_d_h: Investment budget
  • C_h: Realised consumption
  • I_h: Realised investment
source

Initialisation function

BeforeIT.init_modelFunction
init_model(parameters, initial_conditions, T, typeInt = Int64, typeFloat = Float64)

Initializes the model with given parameters and initial conditions.

Parameters:

  • parameters: A dictionary containing the model parameters.
  • initial_conditions: A dictionary containing the initial conditions.
  • T (integer): The time horizon of the model.
  • typeInt: (optional, default: Int64): The data type to be used for integer values.
  • typeFloat: (optional, default: Float64): The data type to be used for floating-point values.

Returns:

  • model::Model: The initialized model.
source
BeforeIT.update_variables_with_totals!Method
update_variables_with_totals!(model::Model)

Update the variables in the given model with some global quantities obtained from all agents. This is the last step in the initialization process and it must be performed after all agents have been initialized.

Arguments

  • model::Model: The model object to update.

Returns

  • Nothing
source

Functions to run an entire simulation

BeforeIT.run_one_epoch!Method
run_one_epoch!(model; multi_threading = false)

This function simulates a single epoch the economic model, updating various components of the model based the interactions between different economic agents. It accepts a model object, which encapsulates the state for the simulation, and an optional boolean parameter multi_threading to enable or disable multi-threading.

Key operations performed include:

  • Financial adjustments for firms and banks, including insolvency checks and profit calculations.
  • Economic expectations and adjustments, such as growth, inflation, and central bank rates.
  • Labor and credit market operations, including wage updates and loan processing.
  • Household economic activities, including consumption and investment budgeting.
  • Government and international trade financial activities, including budgeting and trade balances.
  • General market matching and accounting updates to reflect changes in economic indicators and positions.

The function updates the model in-place and does not return any value.

source
BeforeIT.run_n_simsMethod
run_n_sims(model, n_sims; shock = NoShock(), multi_threading = true)

A function that runs n_sims simulations in parallel with multiple threading and returns a vector of data objects of dimension n_sims.

Arguments

  • model: The model configuration used to simulate.
  • n_sims: The number of simulations to run in parallel.

Returns

  • data_vector: A vector containing the data objects collected during each simulation.
source
BeforeIT.run_one_sim!Method
run_one_sim!(model; shock = NoShock())

Run a single simulation based on the provided model. The simulation runs for a number of epochs specified by model.prop.T.

Arguments

  • model::Model: The model configuration used for the simulation.

Returns

  • data::Data: The data collected during the simulation.

Details

The function initializes the data using BeforeIT.init_data(model), then iteratively updates the model and data for each epoch using BeforeIT.run_one_epoch!(model) and BeforeIT.update_data!(data, model) respectively.

Example

```julia model = BeforeIT.initializemodel(parameters, initialconditions, T) data = runonesim!(model)

source

Firms actions

BeforeIT.firms_depositsMethod
firms_deposits(firms, model)

Calculate the new deposits of firms.

Arguments

  • firms: Firms object
  • model: Model object

Returns

  • DD_i: Vector of new deposits

The new deposits DD_i are calculated as follows:

DD_i = sales + labour_cost + material_cost + taxes_products + taxes_production + corporate_tax + dividend_payments + interest_payments + interest_received + investment_cost + new_credit + debt_installment

where:

  • sales = P_i * Q_i
  • labour_cost = (1 + tau_SIF) * w_i * N_i * P_bar_HH
  • material_cost = -DM_i * P_bar_i
  • taxes_products = -tau_Y_i * P_i * Y_i
  • taxes_production = -tau_K_i * P_i * Y_i
  • corporate_tax = -tau_FIRM * pos(Pi_i)
  • dividend_payments = -theta_DIV * (1 - tau_FIRM) * pos(Pi_i)
  • interest_payments = -r * (L_i + pos(-D_i))
  • interest_received = r_bar * pos(D_i)
  • investment_cost = -P_CF_i * I_i
  • new_credit = DL_i
  • debt_installment = -theta * L_i
source
BeforeIT.firms_equityMethod
firms_equity(firms, model)

Calculate the equity of firms.

Arguments

  • firms: Firms object
  • model: Model object

Returns

  • E_i: Vector of equity

The equity E_i is calculated as follows:

\[E_i = D_i + M_i * \sum(a_{sg}[:, G_i] * \bar{P}_g) + P_i * S_i + \bar{P}_{CF} * K_i - L_i\]

where:

  • D_i: Deposits
  • M_i: Intermediate goods
  • a_sg: Technology coefficient of the gth product in the sth industry
  • G_i: Vector of goods
  • P_bar_g: Producer price index for principal good g
  • P_i: Price
  • S_i: Stock
  • P_bar_CF: Capital price index
  • K_i: Capital stock
  • L_i: Loans
source
BeforeIT.firms_expectations_and_decisionsMethod
firms_expectations_and_decisions(firms, model)

Calculate the expectations and decisions of firms. That is: compute firm quantity, price, investment and intermediate-goods, employment decisions, expected profits, and desired/expected loans and capital.

Arguments

  • firms: Firms object
  • model: Model object

Returns

  • Q_s_i: Vector of desired quantities
  • I_d_i: Vector of desired investments
  • DM_d_i: Vector of desired intermediate goods
  • N_d_i: Vector of desired employment
  • Pi_e_i: Vector of expected profits
  • DL_d_i: Vector of desired new loans
  • K_e_i: Vector of expected capital
  • L_e_i: Vector of expected loans
  • P_i: Vector of prices
source
BeforeIT.firms_loansMethod
firms_loans(firms, model)

Calculate the new loans of firms.

Arguments

  • firms: Firms object
  • model: Model object

Returns

  • L_i: Vector of new loans

The new loans L_i are calculated as follows:

\[L_i = (1 - theta) * L_i + DL_i\]

where:

  • theta: Rate of repayment
  • L_i: Loans
  • DL_i: Acquired new loans
source
BeforeIT.firms_productionMethod
firms_production(firms)

Calculate the production of firms.

Arguments

  • firms: Firms object

Returns

  • Y_i: Vector of production

The production Y_i is computed using a Leontief technology.

source
BeforeIT.firms_profitsMethod
firms_profits(firms, model)

Calculate the profits of firms.

Arguments

  • firms: Firms object
  • model: Model object

Returns

  • Pi_i: Vector of profits

The profits Pi_i are calculated as follows:

Pi_i = in_sales + in_deposits - out_wages - out_expenses - out_depreciation - out_taxes_prods - out_taxes_capital - out_loans

where:

  • in_sales = P_i * Q_i + P_i * DS_i
  • in_deposits = r_bar * pos(D_i)
  • out_wages = (1 + tau_SIF) * w_i * N_i * P_bar_HH
  • out_expenses = 1 / beta_i * P_bar_i * Y_i
  • out_depreciation = delta_i / kappa_i * P_CF_i * Y_i
  • out_taxes_prods = tau_Y_i * P_i * Y_i
  • out_taxes_capital = tau_K_i * P_i * Y_i
  • out_loans = r * (L_i + pos(-D_i))
source
BeforeIT.firms_stocksMethod
firms_stocks(firms)

Calculate the stocks of firms.

Arguments

  • firms: Firms object

Returns

  • K_i: Vector of capital stock
  • M_i: Vector of intermediate goods
  • DS_i: Vector of differneces in stock of final goods
  • S_i: Vector of stock of final goods

The stocks are calculated as follows:

K_i = K_i - delta_i / kappa_i * Y_i + I_i
+API · BeforeIT.jl

Code reference

In this page we document the functions which constitute the bulk of BeforeIT.jl functionality.

Agent types

BeforeIT.AggregatesType

This is a Aggregates type. It is used to store the aggregate variables of the economy. Note that t is an integer, while the rest are floats or vectors of floats.

Fields

  • Y [vector]: GDP data + predictions
  • pi_ [vector]: inflation data + predictions
  • P_bar: Global price index
  • P_bar_g [vector]: Producer price index for principal good g
  • P_bar_HH: Consumer price index
  • P_bar_CF: Capital price index
  • P_bar_h: CPI_h
  • P_bar_CF_h: Capital price index _h
  • Y_e: Expected GDP
  • gamma_e: Expected growth
  • pi_e: Expected inflation
  • t: Time index
source
BeforeIT.BankType

This is a Bank type. It represents the bank of the model.

Fields

  • E_k: equity capital (common equity) of the bank
  • Pi_k: Profits of the bank
  • Pi_e_k: Expected profits of the bank
  • D_k: Residual and balancing item on the bank’s balance sheet
  • r: Rate for loans and morgages

Household fields (bank' owner)

  • Y_h: Net disposable income of bank owner (investor)
  • C_d_h: Consumption budget
  • I_d_h: Investment budget
  • C_h: Realised consumption
  • I_h: Realised investment
  • K_h: Capital stock
  • D_h: Deposits
source
BeforeIT.CentralBankType

This is a CentralBank type. It represents the central bank of the model.

Fields

  • r_bar: Nominal interest rate
  • r_G: Interest rate on government bonds
  • rho: Parameter for gradual adjustment of the policy rate
  • r_star: Real equilibrium interest rate
  • pi_star: Inflation target by CB
  • xi_pi: Weight the CB puts on inflation targeting
  • xi_gamma: Weight placed on economic
  • E_CB: Central bank equity
source
BeforeIT.FirmsType

This is a Firms type. Each field is an array which stores the values for all the firms in the economy. Note that the G_i, N_i and V_i fields are integers, while the rest are floats.

For all fields the entry at index i corresponds to the ith firm.

Fields

  • G_i: Principal product
  • alpha_bar_i: Average productivity of labor
  • beta_i: Productivity of intermediate consumption
  • kappa_i: Productivity of capital
  • w_i: Wages
  • w_bar_i: Average wage rate
  • delta_i: Depreciation rate for capital
  • tau_Y_i: Net tax rate on products
  • tau_K_i: Net tax rate on production
  • N_i: Number of persons employed
  • Y_i: Production of goods
  • Q_i: Sales of goods
  • Q_d_i: Demand for goods
  • P_i: Price
  • S_i: Inventories
  • K_i: Capital, in real terms
  • M_i: Intermediate goods/services and raw materials, in real terms
  • L_i: Outstanding loans
  • pi_bar_i: Operating margin
  • D_i: Deposits of the firm
  • Pi_i: Profits
  • V_i: Vacancies
  • I_i: Investments
  • E_i: Equity
  • P_bar_i: Price index
  • P_CF_i: Price index
  • DS_i: Differnece in stock of final goods
  • DM_i: Difference in stock of intermediate goods
  • DL_i: Obtained loans
  • DL_d_i: Target loans
  • K_e_i: Expected capital
  • L_e_i: Expected loans
  • Q_s_i: Expected sales
  • I_d_i: Desired investments
  • DM_d_i: Desired materials
  • N_d_i: Desired employment
  • Pi_e_i: Expected profits

Household fields (firms' owners)

  • Y_h: Net disposable income of firm owner (investor)
  • C_d_h: Consumption budget
  • I_d_h: Investment budget
  • C_h: Realised consumption
  • I_h: Realised investment
  • K_h: Capital stock
  • D_h: Deposits of the owner of the firms
source
BeforeIT.GovernmentType

This is a Government type. It represents the government of the model.

Fields

  • alpha_G: Autoregressive coefficient for government consumption
  • beta_G: Scalar constant for government consumption
  • sigma_G: Variance coefficient for government consumption
  • Y_G: Government revenues
  • C_G: Consumption demand of the general government
  • L_G: Loans taken out by the government
  • sb_inact: Social benefits for inactive persons
  • sb_other: Social benefits for all
  • C_d_j [vector]: Local governments consumption demand
  • C_j: Realised government consumption
  • P_j: Price inflation of government goods <- ??
source
BeforeIT.ModelType

This is a Model type. It is used to store all the agents of the economy.

Fields

  • w_act: Workers that are active
  • w_inact: Workers that are inactive
  • firms: Firms
  • bank: Bank
  • cb: CentralBank
  • gov: Government
  • rotw: RestOfTheWorld
  • agg: Aggregates
source
BeforeIT.RestOfTheWorldType

This is a RestOfTheWorld type. It represents the rest of the world of the model.

Fields

  • alpha_E: Autoregressive coefficient for exports
  • beta_E: Scalar constant for exports
  • sigma_E: Variance coefficient for exports
  • alpha_I: Autoregressive coefficient for imports
  • beta_I: Scalar constant for imports
  • sigma_I: Variance coefficient for imports
  • Y_EA: GDP euro area
  • gamma_EA: Growth euro area
  • pi_EA: Inflation euro area
  • alpha_pi_EA: Autoregressive coefficient for euro area inflation
  • beta_pi_EA: Autoregressive coefficient for euro area inflation Scalar constant for euro area inflation
  • sigma_pi_EA: Variance coefficient for euro area inflation
  • alpha_Y_EA: Autoregressive coefficient for euro area GDP
  • beta_Y_EA: Autoregressive coefficient for euro area GDP Scalar constant for euro area GDP
  • sigma_Y_EA: Variance coefficient for euro area GDP
  • D_RoW: Net creditor/debtor position of the national economy to the rest of the world
  • Y_I: Supply of imports (in real terms)
  • C_E: Total demand for exports
  • C_d_l [vector]: Demand for exports of specific product
  • C_l: Realised consumption by foreign consumers
  • Y_m [vector]: Supply of imports per sector
  • Q_m [vector]: Sales for imports per sector
  • Q_d_m [vector]: Demand for goods
  • P_m [vector]: Price of imports per sector
  • P_l: Price inflation of exports <- ??
source
BeforeIT.WorkersType

This is a Workers. Each field is an array which stores the values for all the workers in the economy. Note that the O_h field is an integer, while the rest are floats.

For all fields the entry at index i corresponds to the ith worker.

Fields

  • Y_h: Net disposable income of worker owner (investor)
  • D_h: Deposits
  • K_h: Capital stock
  • w_h: Wages (0 if inactive or unemployed)
  • O_h: Occupation (0 if unemployed, -1 if inactive)
  • C_d_h: Consumption budget
  • I_d_h: Investment budget
  • C_h: Realised consumption
  • I_h: Realised investment
source

Initialisation function

BeforeIT.init_modelFunction
init_model(parameters, initial_conditions, T, typeInt = Int64, typeFloat = Float64)

Initializes the model with given parameters and initial conditions.

Parameters:

  • parameters: A dictionary containing the model parameters.
  • initial_conditions: A dictionary containing the initial conditions.
  • T (integer): The time horizon of the model.
  • typeInt: (optional, default: Int64): The data type to be used for integer values.
  • typeFloat: (optional, default: Float64): The data type to be used for floating-point values.

Returns:

  • model::Model: The initialized model.
source
BeforeIT.update_variables_with_totals!Method
update_variables_with_totals!(model::Model)

Update the variables in the given model with some global quantities obtained from all agents. This is the last step in the initialization process and it must be performed after all agents have been initialized.

Arguments

  • model::Model: The model object to update.

Returns

  • Nothing
source

Functions to run an entire simulation

BeforeIT.run_one_epoch!Method
run_one_epoch!(model; multi_threading = false)

This function simulates a single epoch the economic model, updating various components of the model based the interactions between different economic agents. It accepts a model object, which encapsulates the state for the simulation, and an optional boolean parameter multi_threading to enable or disable multi-threading.

Key operations performed include:

  • Financial adjustments for firms and banks, including insolvency checks and profit calculations.
  • Economic expectations and adjustments, such as growth, inflation, and central bank rates.
  • Labor and credit market operations, including wage updates and loan processing.
  • Household economic activities, including consumption and investment budgeting.
  • Government and international trade financial activities, including budgeting and trade balances.
  • General market matching and accounting updates to reflect changes in economic indicators and positions.

The function updates the model in-place and does not return any value.

source
BeforeIT.run_n_simsMethod
run_n_sims(model, n_sims; shock = NoShock(), multi_threading = true)

A function that runs n_sims simulations in parallel with multiple threading and returns a vector of data objects of dimension n_sims.

Arguments

  • model: The model configuration used to simulate.
  • n_sims: The number of simulations to run in parallel.

Returns

  • data_vector: A vector containing the data objects collected during each simulation.
source
BeforeIT.run_one_sim!Method
run_one_sim!(model; shock = NoShock())

Run a single simulation based on the provided model. The simulation runs for a number of epochs specified by model.prop.T.

Arguments

  • model::Model: The model configuration used for the simulation.

Returns

  • data::Data: The data collected during the simulation.

Details

The function initializes the data using BeforeIT.init_data(model), then iteratively updates the model and data for each epoch using BeforeIT.run_one_epoch!(model) and BeforeIT.update_data!(data, model) respectively.

Example

```julia model = BeforeIT.initmodel(parameters, initialconditions, T) data = runonesim!(model)

source

Firms actions

BeforeIT.firms_depositsMethod
firms_deposits(firms, model)

Calculate the new deposits of firms.

Arguments

  • firms: Firms object
  • model: Model object

Returns

  • DD_i: Vector of new deposits

The new deposits DD_i are calculated as follows:

DD_i = sales + labour_cost + material_cost + taxes_products + taxes_production + corporate_tax + dividend_payments + interest_payments + interest_received + investment_cost + new_credit + debt_installment

where:

  • sales = P_i * Q_i
  • labour_cost = (1 + tau_SIF) * w_i * N_i * P_bar_HH
  • material_cost = -DM_i * P_bar_i
  • taxes_products = -tau_Y_i * P_i * Y_i
  • taxes_production = -tau_K_i * P_i * Y_i
  • corporate_tax = -tau_FIRM * pos(Pi_i)
  • dividend_payments = -theta_DIV * (1 - tau_FIRM) * pos(Pi_i)
  • interest_payments = -r * (L_i + pos(-D_i))
  • interest_received = r_bar * pos(D_i)
  • investment_cost = -P_CF_i * I_i
  • new_credit = DL_i
  • debt_installment = -theta * L_i
source
BeforeIT.firms_equityMethod
firms_equity(firms, model)

Calculate the equity of firms.

Arguments

  • firms: Firms object
  • model: Model object

Returns

  • E_i: Vector of equity

The equity E_i is calculated as follows:

\[E_i = D_i + M_i * \sum(a_{sg}[:, G_i] * \bar{P}_g) + P_i * S_i + \bar{P}_{CF} * K_i - L_i\]

where:

  • D_i: Deposits
  • M_i: Intermediate goods
  • a_sg: Technology coefficient of the gth product in the sth industry
  • G_i: Vector of goods
  • P_bar_g: Producer price index for principal good g
  • P_i: Price
  • S_i: Stock
  • P_bar_CF: Capital price index
  • K_i: Capital stock
  • L_i: Loans
source
BeforeIT.firms_expectations_and_decisionsMethod
firms_expectations_and_decisions(firms, model)

Calculate the expectations and decisions of firms. That is: compute firm quantity, price, investment and intermediate-goods, employment decisions, expected profits, and desired/expected loans and capital.

Arguments

  • firms: Firms object
  • model: Model object

Returns

  • Q_s_i: Vector of desired quantities
  • I_d_i: Vector of desired investments
  • DM_d_i: Vector of desired intermediate goods
  • N_d_i: Vector of desired employment
  • Pi_e_i: Vector of expected profits
  • DL_d_i: Vector of desired new loans
  • K_e_i: Vector of expected capital
  • L_e_i: Vector of expected loans
  • P_i: Vector of prices
source
BeforeIT.firms_loansMethod
firms_loans(firms, model)

Calculate the new loans of firms.

Arguments

  • firms: Firms object
  • model: Model object

Returns

  • L_i: Vector of new loans

The new loans L_i are calculated as follows:

\[L_i = (1 - theta) * L_i + DL_i\]

where:

  • theta: Rate of repayment
  • L_i: Loans
  • DL_i: Acquired new loans
source
BeforeIT.firms_productionMethod
firms_production(firms)

Calculate the production of firms.

Arguments

  • firms: Firms object

Returns

  • Y_i: Vector of production

The production Y_i is computed using a Leontief technology.

source
BeforeIT.firms_profitsMethod
firms_profits(firms, model)

Calculate the profits of firms.

Arguments

  • firms: Firms object
  • model: Model object

Returns

  • Pi_i: Vector of profits

The profits Pi_i are calculated as follows:

Pi_i = in_sales + in_deposits - out_wages - out_expenses - out_depreciation - out_taxes_prods - out_taxes_capital - out_loans

where:

  • in_sales = P_i * Q_i + P_i * DS_i
  • in_deposits = r_bar * pos(D_i)
  • out_wages = (1 + tau_SIF) * w_i * N_i * P_bar_HH
  • out_expenses = 1 / beta_i * P_bar_i * Y_i
  • out_depreciation = delta_i / kappa_i * P_CF_i * Y_i
  • out_taxes_prods = tau_Y_i * P_i * Y_i
  • out_taxes_capital = tau_K_i * P_i * Y_i
  • out_loans = r * (L_i + pos(-D_i))
source
BeforeIT.firms_stocksMethod
firms_stocks(firms)

Calculate the stocks of firms.

Arguments

  • firms: Firms object

Returns

  • K_i: Vector of capital stock
  • M_i: Vector of intermediate goods
  • DS_i: Vector of differneces in stock of final goods
  • S_i: Vector of stock of final goods

The stocks are calculated as follows:

K_i = K_i - delta_i / kappa_i * Y_i + I_i
 M_i = M_i - Y_i / beta_i + DM_i
 DS_i = Y_i - Q_i
-S_i = S_i + DS_i
source
BeforeIT.firms_wagesMethod
firms_wages(firms)

Calculate the wages set by firms.

Arguments

  • firms: Firms object

Returns

  • w_i: Vector of wages
source
BeforeIT.init_firmsMethod
init_firms(parameters, initial_conditions; typeInt = Int64, typeFloat = Float64)

Initialize firms with given parameters and initial conditions.

Arguments

  • parameters: The parameters for initializing the firms.
  • initial_conditions: The initial conditions for the firms.
  • typeInt: (optional) The integer type to be used. Default is Int64.
  • typeFloat: (optional) The floating-point type to be used. Default is Float64.

Returns

  • firms::Firms: The initialized firms.
  • firms_args::Tuple: The arguments used to initialize the firms.
source
BeforeIT.leontief_productionMethod
leontief_production(Q_s_i, N_i, alpha_i, K_i, kappa_i, M_i, beta_i)

Calculate the production function of firms.

Arguments

  • Q_s_i: Vector of desired quantities
  • N_i: Vector of employment
  • alpha_i: Vector of labour productivity
  • K_i: Vector of capital stock
  • kappa_i: Vector of capital productivity
  • M_i: Vector of intermediate goods
  • beta_i: Vector of intermediate goods productivity

Returns

  • Y_i: Vector of production

The Leontief production function Y_i is calculated as follows:

\[Y_i = \min(Q_s_i, \min(N_i \cdot \alpha_i, \min(K_i \cdot \kappa_i, M_i \cdot \beta_i)))\]

source

Households actions

Government actions

BeforeIT.gov_expenditureMethod
gov_expenditure(gov::AbstractGovernment, model)

Computes government expenditure on consumption and transfers to households.

Arguments

  • gov: government object
  • model: model object

Returns

  • C_G: government consumption
  • C_d_j: local government consumptions
source
BeforeIT.gov_loansMethod
gov_loans(gov::AbstractGovernment, model, Y_G)

Computes government new government debt.

Arguments

  • gov::AbstractGovernment: government object
  • model: model object

Returns

  • L_G: new government debt
source
BeforeIT.gov_revenuesMethod
gov_revenues(model)

Computes government revenues from taxes and social security contributions. The government collects taxes on labour income, capital income, value added, and corporate income. It also collects social security contributions from workers and firms. The government also collects taxes on consumption and capital formation. Finally, the government collects taxes on exports and imports.

Arguments

  • model: model object

Returns

  • Y_G: government revenues
source
BeforeIT.gov_social_benefitsMethod
gov_social_benefits(gov::AbstractGovernment, model)

Computes social benefits paid by the government households.

Arguments

  • gov: government object
  • model: model object

Returns

  • sb_other: social benefits for other households
  • sb_inact: social benefits for inactive households
source
BeforeIT.init_governmentMethod
init_government(parameters, initial_conditions; typeInt = Int64, typeFloat = Float64)

Initialize the government agent.

Arguments

  • parameters: The parameters.
  • initial_conditions: The initial conditions.
  • typeInt: The integer type to be used (default: Int64).
  • typeFloat: The floating-point type to be used (default: Float64).

Returns

  • The initialized government model.
  • The arguments used to initialize the government model.
source

Bank and Central Bank actions

BeforeIT._bank_depositsMethod
_deposit_bank(waD_h, wiD_h, fD_h, bD_h, fD_i, bE_k, fL_i)

Helper function to calculate the new deposits of a bank.

Arguments

  • waD_h: Array of deposits from active workers
  • wiD_h: Array of deposits from inactive workers
  • fD_h: Array of deposits from firms
  • bD_h: Deposits from the bank owner
  • fD_i: Array of deposits from firms
  • bE_k: Bank equity
  • fL_i: Array of loans to firms

Returns

  • D_k: New deposits of the bank

The new deposits D_k are calculated as the sum of the deposits of the active workers, the inactive workers, the firms, and the bank owner itself, plus the bank's equity, minus the loans of the firms.

source
BeforeIT._bank_profitsMethod
_bank_profits(L_i, D_i, D_h, D_k, r_bar, r)

Helper function to calculate the total profits of a bank.

Arguments

  • L_i: Array of loans provided by the bank
  • D_i: Array of deposits from firms
  • D_h: Array of deposits from households
  • D_k: Residual and balancing item on the bank’s balance sheet
  • r_bar: Base interest rate
  • r: Interest rate set by the bank

Returns

  • Pi_k: Total profits of the bank

The total profits Pi_k are calculated as follows:

\[\Pi_k = r \cdot \sum_i(L_i + \max(0, -D_i)) + r \cdot \sum_h(\max(0, -D_h)) + r_{bar} +S_i = S_i + DS_i

source
BeforeIT.firms_wagesMethod
firms_wages(firms)

Calculate the wages set by firms.

Arguments

  • firms: Firms object

Returns

  • w_i: Vector of wages
source
BeforeIT.init_firmsMethod
init_firms(parameters, initial_conditions; typeInt = Int64, typeFloat = Float64)

Initialize firms with given parameters and initial conditions.

Arguments

  • parameters: The parameters for initializing the firms.
  • initial_conditions: The initial conditions for the firms.
  • typeInt: (optional) The integer type to be used. Default is Int64.
  • typeFloat: (optional) The floating-point type to be used. Default is Float64.

Returns

  • firms::Firms: The initialized firms.
  • firms_args::Tuple: The arguments used to initialize the firms.
source
BeforeIT.leontief_productionMethod
leontief_production(Q_s_i, N_i, alpha_i, K_i, kappa_i, M_i, beta_i)

Calculate the production function of firms.

Arguments

  • Q_s_i: Vector of desired quantities
  • N_i: Vector of employment
  • alpha_i: Vector of labour productivity
  • K_i: Vector of capital stock
  • kappa_i: Vector of capital productivity
  • M_i: Vector of intermediate goods
  • beta_i: Vector of intermediate goods productivity

Returns

  • Y_i: Vector of production

The Leontief production function Y_i is calculated as follows:

\[Y_i = \min(Q_s_i, \min(N_i \cdot \alpha_i, \min(K_i \cdot \kappa_i, M_i \cdot \beta_i)))\]

source

Households actions

Government actions

BeforeIT.gov_expenditureMethod
gov_expenditure(gov::AbstractGovernment, model)

Computes government expenditure on consumption and transfers to households.

Arguments

  • gov: government object
  • model: model object

Returns

  • C_G: government consumption
  • C_d_j: local government consumptions
source
BeforeIT.gov_loansMethod
gov_loans(gov::AbstractGovernment, model, Y_G)

Computes government new government debt.

Arguments

  • gov::AbstractGovernment: government object
  • model: model object

Returns

  • L_G: new government debt
source
BeforeIT.gov_revenuesMethod
gov_revenues(model)

Computes government revenues from taxes and social security contributions. The government collects taxes on labour income, capital income, value added, and corporate income. It also collects social security contributions from workers and firms. The government also collects taxes on consumption and capital formation. Finally, the government collects taxes on exports and imports.

Arguments

  • model: model object

Returns

  • Y_G: government revenues
source
BeforeIT.gov_social_benefitsMethod
gov_social_benefits(gov::AbstractGovernment, model)

Computes social benefits paid by the government households.

Arguments

  • gov: government object
  • model: model object

Returns

  • sb_other: social benefits for other households
  • sb_inact: social benefits for inactive households
source
BeforeIT.init_governmentMethod
init_government(parameters, initial_conditions; typeInt = Int64, typeFloat = Float64)

Initialize the government agent.

Arguments

  • parameters: The parameters.
  • initial_conditions: The initial conditions.
  • typeInt: The integer type to be used (default: Int64).
  • typeFloat: The floating-point type to be used (default: Float64).

Returns

  • The initialized government model.
  • The arguments used to initialize the government model.
source

Bank and Central Bank actions

BeforeIT._bank_depositsMethod
_deposit_bank(waD_h, wiD_h, fD_h, bD_h, fD_i, bE_k, fL_i)

Helper function to calculate the new deposits of a bank.

Arguments

  • waD_h: Array of deposits from active workers
  • wiD_h: Array of deposits from inactive workers
  • fD_h: Array of deposits from firms
  • bD_h: Deposits from the bank owner
  • fD_i: Array of deposits from firms
  • bE_k: Bank equity
  • fL_i: Array of loans to firms

Returns

  • D_k: New deposits of the bank

The new deposits D_k are calculated as the sum of the deposits of the active workers, the inactive workers, the firms, and the bank owner itself, plus the bank's equity, minus the loans of the firms.

source
BeforeIT._bank_profitsMethod
_bank_profits(L_i, D_i, D_h, D_k, r_bar, r)

Helper function to calculate the total profits of a bank.

Arguments

  • L_i: Array of loans provided by the bank
  • D_i: Array of deposits from firms
  • D_h: Array of deposits from households
  • D_k: Residual and balancing item on the bank’s balance sheet
  • r_bar: Base interest rate
  • r: Interest rate set by the bank

Returns

  • Pi_k: Total profits of the bank

The total profits Pi_k are calculated as follows:

\[\Pi_k = r \cdot \sum_i(L_i + \max(0, -D_i)) + r \cdot \sum_h(\max(0, -D_h)) + r_{bar} \cdot \max(0, D_k) - r_{bar} \cdot \sum_i(\max(0, D_i)) - r_{bar} \cdot -\sum_h(\max(0, D_h)) - r_{bar} \cdot \max(0, -D_k)\]

source
BeforeIT._central_bank_profitsMethod
_central_bank_profits(r_bar, D_k, L_G, r_G)

Helper function to calculate the profits of a central bank.

Arguments

  • r_bar: The base interest rate
  • D_k: Deposits from commercial banks
  • L_G: Loans provided to the government
  • r_G: Interest rate on government loans

Returns

  • Pi_CB: Profits of the central bank

The profits Pi_CB are calculated as follows:

\[\{Pi}_{CB} = r_{G} \cdot L_{G} - r_{bar} \cdot D_{k}\]

source
BeforeIT.bank_depositsMethod
deposits_bank(bank, w_act, w_inact, firms)

Calculate the new deposits of a bank.

Arguments

  • bank: The Bank object containing the bank of the model
  • w_act: The Workers object containing the active workers of the model
  • w_inact: The Workers object containing the inactive workers of the model
  • firms: The Firms object containing the firms of the model

Returns

  • D_k: New deposits of the bank

The new deposits D_k are calculated as the sum of the deposits of the active workers, the inactive workers, the firms, and the bank owner itself, plus the bank's equity, minus the loans of the firms.

source
BeforeIT.bank_equityMethod
bank_equity(bank, model)

Calculate the net profits of a bank.

Arguments

  • bank: The bank object.
  • model: The model object.

Returns

  • E_k: The updated equity of the bank.

The net profits DE_k are calculated as:

\[DE_k = \Pi_k - \theta_{DIV} \cdot (1 - \tau_{FIRM}) \cdot \max(0, \Pi_k) - \tau_{FIRM} \cdot \max(0, \Pi_k)\]

and the equity E_k is updated as:

\[E_k = E_k + DE_k\]

source
BeforeIT.bank_expected_profitsMethod
bank_expected_profits(Pi_k, pi_e, gamma_e)

Calculate the expected profits of a bank.

Arguments

  • Pi_k: Past profits of the bank
  • pi_e: Expected inflation rate
  • gamma_e: Expected growth rate

Returns

  • E_Pi_k: Expected profits of the bank

The expected profits E_Pi_k are calculated as follows:

\[E_{\Pi_k} = \Pi_k \cdot (1 + \pi_e) \cdot (1 + \gamma_e)\]

source
BeforeIT.bank_profitsMethod
bank_profits(bank, model)

Calculate the total profits of a bank.

Arguments

  • bank: The bank object.
  • model: The model object.

Returns

  • Pi_k: The total profits of the bank.

The total profits Pi_k are calculated as:

\[\Pi_k = r \cdot \sum_i(L_i + \max(0, -D_i)) + r \cdot \sum_h(\max(0, -D_h)) + r_{bar} +\sum_h(\max(0, D_h)) - r_{bar} \cdot \max(0, -D_k)\]

source
BeforeIT._central_bank_profitsMethod
_central_bank_profits(r_bar, D_k, L_G, r_G)

Helper function to calculate the profits of a central bank.

Arguments

  • r_bar: The base interest rate
  • D_k: Deposits from commercial banks
  • L_G: Loans provided to the government
  • r_G: Interest rate on government loans

Returns

  • Pi_CB: Profits of the central bank

The profits Pi_CB are calculated as follows:

\[\{Pi}_{CB} = r_{G} \cdot L_{G} - r_{bar} \cdot D_{k}\]

source
BeforeIT.bank_depositsMethod
deposits_bank(bank, w_act, w_inact, firms)

Calculate the new deposits of a bank.

Arguments

  • bank: The Bank object containing the bank of the model
  • w_act: The Workers object containing the active workers of the model
  • w_inact: The Workers object containing the inactive workers of the model
  • firms: The Firms object containing the firms of the model

Returns

  • D_k: New deposits of the bank

The new deposits D_k are calculated as the sum of the deposits of the active workers, the inactive workers, the firms, and the bank owner itself, plus the bank's equity, minus the loans of the firms.

source
BeforeIT.bank_equityMethod
bank_equity(bank, model)

Calculate the net profits of a bank.

Arguments

  • bank: The bank object.
  • model: The model object.

Returns

  • E_k: The updated equity of the bank.

The net profits DE_k are calculated as:

\[DE_k = \Pi_k - \theta_{DIV} \cdot (1 - \tau_{FIRM}) \cdot \max(0, \Pi_k) - \tau_{FIRM} \cdot \max(0, \Pi_k)\]

and the equity E_k is updated as:

\[E_k = E_k + DE_k\]

source
BeforeIT.bank_expected_profitsMethod
bank_expected_profits(Pi_k, pi_e, gamma_e)

Calculate the expected profits of a bank.

Arguments

  • Pi_k: Past profits of the bank
  • pi_e: Expected inflation rate
  • gamma_e: Expected growth rate

Returns

  • E_Pi_k: Expected profits of the bank

The expected profits E_Pi_k are calculated as follows:

\[E_{\Pi_k} = \Pi_k \cdot (1 + \pi_e) \cdot (1 + \gamma_e)\]

source
BeforeIT.bank_profitsMethod
bank_profits(bank, model)

Calculate the total profits of a bank.

Arguments

  • bank: The bank object.
  • model: The model object.

Returns

  • Pi_k: The total profits of the bank.

The total profits Pi_k are calculated as:

\[\Pi_k = r \cdot \sum_i(L_i + \max(0, -D_i)) + r \cdot \sum_h(\max(0, -D_h)) + r_{bar} \cdot \max(0, D_k) - r_{bar} \cdot \sum_i(\max(0, D_i)) - r_{bar} \cdot -\sum_h(\max(0, D_h)) - r_{bar} \cdot \max(0, -D_k)\]

source
BeforeIT.bank_rateMethod
bank_rate(bank, model)

Update the interest rate set by the bank.

Arguments

  • bank: The bank whose interest rate is to be updated
  • model: Model object

Returns

  • r: The updated interest rate

\[r = \bar{r} + \mu\]

source
BeforeIT.central_bank_equityMethod
central_bank_equity(cb, model)

Calculate the equity of the central bank.

Arguments

  • cb: The central bank
  • model: The model object

Returns

  • E_CB: The equity of the central bank

The equity E_CB is calculated as follows:

\[E_{CB} = E_{CB} + \Pi_{CB}\]

where \Pi_{CB} are the profits of the central bank.

source
BeforeIT.central_bank_rateMethod
central_bank_rate(cb, model)

Update the base interest rate set by the central bank according to the Taylor rule.

Arguments

  • cb: The central bank whose base interest rate is to be updated
  • model: The model object

Returns

  • r_bar: The updated base interest rate
source
BeforeIT.finance_insolvent_firms!Method
finance_insolvent_firms!(firms, bank, P_bar_CF, zeta_b,  insolvent)

Rifinance insolvent firms using bank equity.

Arguments

  • firms: The Firms object containing the firms of the model
  • bank: The Bank object containing the bank of the model
  • P_bar_CF: Capital price index
  • zeta_b: Parameter of loan-to-capital ratio for new firms after bankruptcy

Returns

  • This function does not return a value. It modifies the banks and firms collections in-place.
source
BeforeIT.taylor_ruleMethod
taylor_rule(rho, r_bar, r_star, pi_star, xi_pi, xi_gamma, gamma_EA, pi_EA)

Calculate the interest rate according to the Taylor rule.

Arguments

  • rho: Parameter for gradual adjustment of the policy rate.
  • r_bar: Nominal interest rate.
  • r_star: Real equilibrium interest rate.
  • pi_star: The target inflation rate.
  • xi_pi: Weight the CB puts on inflation targeting.
  • xi_gamma: Weight placed on economic growth.
  • gamma_EA: The output growth rate.
  • pi_EA: The inflation rate.

Returns

  • rate: The calculated interest rate.

The Taylor rule is given by the following equation:

\[r_t = ρ * r_{t-1} + (1 - ρ) * (r^* + π^* + ξ_π * (π_t - π^*) + ξ_γ * γ_t)```\]

source

Rest Of The World actions

BeforeIT.rotw_depositsMethod
rotw_deposits(rotw, tau_EXPORT)

Calculate the deposits of the rest of the world.

Arguments

  • rotw: The rest of the world object.
  • tau_EXPORT: The export tax.

Returns

  • D_RoW: The deposits of the rest of the world.

The deposits D_RoW are calculated as follows:

\[D_{RoW} = D_{RoW} + \left( \sum_{m} P_m \cdot Q_m \right) - (1 + \tau_{EXPORT}) \cdot C_l\]

source
BeforeIT.rotw_import_exportMethod
rotw_import_export(rotw, model, pi_e, epsilon_E, epsilon_I)

Calculate the demand for exports and supply of imports of the rest of the world.

Arguments

  • rotw: The rest of the world object.
  • model: The model object.

Returns

  • C_E: Total demand for exports.
  • Y_I: Supply of imports (in real terms).
  • C_d_l: TDemand for exports of specific product.
  • Y_m: Supply of imports per sector.
  • P_m: Price of imports per sector.
source

Markets

BeforeIT.search_and_matching_creditMethod
search_and_matching_credit(firms::Firms, model)

This function calculates the credit allocation for each firm in the given firms object.

Parameters:

  • firms::Firms: The firms object.
  • model: The model object.

Returns:

  • DL_i: An array of credit allocations for each firm.
source
BeforeIT.search_and_matching_labourMethod
search_and_matching_labour(firms::Firms, model)

This function implements a labor search and matching algorithm. It takes in a Firms object and a Model object as input. The Firms object contains information about the number of desired employees (N_d_i) and the current number of employees (N_i) for each firm. The model object contains information about the current employment status (O_h) of each worker.

The function performs the following steps:

  • Calculates the vacancies (V_i) for each firm as the difference between desired and current employees.
  • Identifies employed workers and shuffles them randomly.
  • Fires workers from firms with negative vacancies to adjust the workforce.
  • Identifies unemployed workers and firms with positive vacancies.
  • Randomly matches unemployed workers to firms with vacancies until all vacancies are filled or there are no more unemployed workers.

The function returns:

  • N_i: An updated array of the number of employed workers for each firm.
  • O_h: An updated array where each element represents the firm a worker is employed with (0 if unemployed).
source
BeforeIT.search_and_matching!Function
search_and_matching!(model, multi_threading::Bool = false)

This function performs a search and matching algorithm for firms and for retail markets. It takes in a model object and an optional boolean argument for multi-threading. The function loops over all goods and performs the firms market and retail market operations for each good. Finally, it updates the aggregate variables based on the results of markets.

Args:

  • model: The model object
  • multi_threading: A boolean indicating whether to use multi-threading for the algorithm. Default is false.

This function updates the model in-place and does not return any value.

source
+\sum_h(\max(0, D_h)) - r_{bar} \cdot \max(0, -D_k)\]

source
BeforeIT.bank_rateMethod
bank_rate(bank, model)

Update the interest rate set by the bank.

Arguments

  • bank: The bank whose interest rate is to be updated
  • model: Model object

Returns

  • r: The updated interest rate

\[r = \bar{r} + \mu\]

source
BeforeIT.central_bank_equityMethod
central_bank_equity(cb, model)

Calculate the equity of the central bank.

Arguments

  • cb: The central bank
  • model: The model object

Returns

  • E_CB: The equity of the central bank

The equity E_CB is calculated as follows:

\[E_{CB} = E_{CB} + \Pi_{CB}\]

where \Pi_{CB} are the profits of the central bank.

source
BeforeIT.central_bank_rateMethod
central_bank_rate(cb, model)

Update the base interest rate set by the central bank according to the Taylor rule.

Arguments

  • cb: The central bank whose base interest rate is to be updated
  • model: The model object

Returns

  • r_bar: The updated base interest rate
source
BeforeIT.finance_insolvent_firms!Method
finance_insolvent_firms!(firms, bank, P_bar_CF, zeta_b,  insolvent)

Rifinance insolvent firms using bank equity.

Arguments

  • firms: The Firms object containing the firms of the model
  • bank: The Bank object containing the bank of the model
  • P_bar_CF: Capital price index
  • zeta_b: Parameter of loan-to-capital ratio for new firms after bankruptcy

Returns

  • This function does not return a value. It modifies the banks and firms collections in-place.
source
BeforeIT.taylor_ruleMethod
taylor_rule(rho, r_bar, r_star, pi_star, xi_pi, xi_gamma, gamma_EA, pi_EA)

Calculate the interest rate according to the Taylor rule.

Arguments

  • rho: Parameter for gradual adjustment of the policy rate.
  • r_bar: Nominal interest rate.
  • r_star: Real equilibrium interest rate.
  • pi_star: The target inflation rate.
  • xi_pi: Weight the CB puts on inflation targeting.
  • xi_gamma: Weight placed on economic growth.
  • gamma_EA: The output growth rate.
  • pi_EA: The inflation rate.

Returns

  • rate: The calculated interest rate.

The Taylor rule is given by the following equation:

\[r_t = ρ * r_{t-1} + (1 - ρ) * (r^* + π^* + ξ_π * (π_t - π^*) + ξ_γ * γ_t)```\]

source

Rest Of The World actions

BeforeIT.rotw_depositsMethod
rotw_deposits(rotw, tau_EXPORT)

Calculate the deposits of the rest of the world.

Arguments

  • rotw: The rest of the world object.
  • tau_EXPORT: The export tax.

Returns

  • D_RoW: The deposits of the rest of the world.

The deposits D_RoW are calculated as follows:

\[D_{RoW} = D_{RoW} + \left( \sum_{m} P_m \cdot Q_m \right) - (1 + \tau_{EXPORT}) \cdot C_l\]

source
BeforeIT.rotw_import_exportMethod
rotw_import_export(rotw, model, pi_e, epsilon_E, epsilon_I)

Calculate the demand for exports and supply of imports of the rest of the world.

Arguments

  • rotw: The rest of the world object.
  • model: The model object.

Returns

  • C_E: Total demand for exports.
  • Y_I: Supply of imports (in real terms).
  • C_d_l: TDemand for exports of specific product.
  • Y_m: Supply of imports per sector.
  • P_m: Price of imports per sector.
source

Markets

BeforeIT.search_and_matching_creditMethod
search_and_matching_credit(firms::Firms, model)

This function calculates the credit allocation for each firm in the given firms object.

Parameters:

  • firms::Firms: The firms object.
  • model: The model object.

Returns:

  • DL_i: An array of credit allocations for each firm.
source
BeforeIT.search_and_matching_labourMethod
search_and_matching_labour(firms::Firms, model)

This function implements a labor search and matching algorithm. It takes in a Firms object and a Model object as input. The Firms object contains information about the number of desired employees (N_d_i) and the current number of employees (N_i) for each firm. The model object contains information about the current employment status (O_h) of each worker.

The function performs the following steps:

  • Calculates the vacancies (V_i) for each firm as the difference between desired and current employees.
  • Identifies employed workers and shuffles them randomly.
  • Fires workers from firms with negative vacancies to adjust the workforce.
  • Identifies unemployed workers and firms with positive vacancies.
  • Randomly matches unemployed workers to firms with vacancies until all vacancies are filled or there are no more unemployed workers.

The function returns:

  • N_i: An updated array of the number of employed workers for each firm.
  • O_h: An updated array where each element represents the firm a worker is employed with (0 if unemployed).
source
BeforeIT.perform_firms_market!Method

Perform the firms market exchange process

source
BeforeIT.perform_retail_market!Method

Perform the retail market exchange process

source
BeforeIT.search_and_matching!Function
search_and_matching!(model, multi_threading::Bool = false)

This function performs a search and matching algorithm for firms and for retail markets. It takes in a model object and an optional boolean argument for multi-threading. The function loops over all goods and performs the firms market and retail market operations for each good. Finally, it updates the aggregate variables based on the results of markets.

Args:

  • model: The model object
  • multi_threading: A boolean indicating whether to use multi-threading for the algorithm. Default is false.

This function updates the model in-place and does not return any value.

source
diff --git a/dev/examples/basic_example-0dba5b9b.svg b/dev/examples/basic_example-0dba5b9b.svg new file mode 100644 index 0000000..6d2ec0c --- /dev/null +++ b/dev/examples/basic_example-0dba5b9b.svg @@ -0,0 +1,275 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/examples/basic_example-3aeaf5c3.svg b/dev/examples/basic_example-3aeaf5c3.svg deleted file mode 100644 index bb51370..0000000 --- a/dev/examples/basic_example-3aeaf5c3.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dev/examples/basic_example-6cf98736.svg b/dev/examples/basic_example-6cf98736.svg deleted file mode 100644 index 8878c5f..0000000 --- a/dev/examples/basic_example-6cf98736.svg +++ /dev/null @@ -1,275 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dev/examples/basic_example-a03d5f9a.svg b/dev/examples/basic_example-a03d5f9a.svg new file mode 100644 index 0000000..dac846d --- /dev/null +++ b/dev/examples/basic_example-a03d5f9a.svg @@ -0,0 +1,284 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/examples/basic_example-f011c18e.svg b/dev/examples/basic_example-f011c18e.svg deleted file mode 100644 index d8e1601..0000000 --- a/dev/examples/basic_example-f011c18e.svg +++ /dev/null @@ -1,280 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dev/examples/basic_example-f9a49bb5.svg b/dev/examples/basic_example-f9a49bb5.svg new file mode 100644 index 0000000..98978f8 --- /dev/null +++ b/dev/examples/basic_example-f9a49bb5.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/examples/basic_example.html b/dev/examples/basic_example.html index ce2151a..8acdcf7 100644 --- a/dev/examples/basic_example.html +++ b/dev/examples/basic_example.html @@ -22,10 +22,10 @@ "Y_EA" => 2.35485e6 "D_I" => 54049.0 ⋮ => ⋮

We can now initialise the model, by specifying in advance the maximum number of epochs.

T = 16
-model = Bit.init_model(parameters, initial_conditions, T)
Model(Workers{Vector{Float64}, Vector{Int64}}([0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249  …  4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569], [3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487  …  22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958], [6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249  …  42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032], [0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983  …  11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522], [1, 2, 3, 4, 4, 5, 6, 6, 6, 6  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), Workers{Vector{Float64}, Vector{Int64}}([2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714  …  2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714], [13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984  …  13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984], [25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977  …  25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1  …  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), Firms{Vector{Float64}, Vector{Int64}}([1, 1, 1, 1, 1, 1, 1, 1, 1, 1  …  62, 62, 62, 62, 62, 62, 62, 62, 62, 62], [10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621  …  11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951], [1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485  …  3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877], [0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754  …  0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983  …  2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687], [0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721  …  0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782], [0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832  …  0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318], [-0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635  …  0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037], [1, 1, 1, 2, 1, 9, 1, 1, 1, 1  …  1, 1, 1, 1, 1, 1, 13, 1, 1, 1], [10.822026659306621, 10.822026659306621, 10.822026659306621, 21.644053318613242, 10.822026659306621, 97.39823993375958, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621  …  11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 155.84534404788636, 11.988103388298951, 11.988103388298951, 11.988103388298951], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [10.822026659306621, 10.822026659306621, 10.822026659306621, 21.644053318613242, 10.822026659306621, 97.39823993375958, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621  …  11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 155.84534404788636, 11.988103388298951, 11.988103388298951, 11.988103388298951], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0  …  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [298.15365853658534, 298.15365853658534, 298.15365853658534, 596.3073170731707, 298.15365853658534, 2683.382926829268, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534  …  79.20833333333334, 79.20833333333334, 79.20833333333334, 79.20833333333334, 79.20833333333334, 79.20833333333334, 1029.7083333333333, 79.20833333333334, 79.20833333333334, 79.20833333333334], [7.65511425407355, 7.65511425407355, 7.65511425407355, 15.3102285081471, 7.65511425407355, 68.89602828666195, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355  …  4.057486672347064, 4.057486672347064, 4.057486672347064, 4.057486672347064, 4.057486672347064, 4.057486672347064, 52.74732674051184, 4.057486672347064, 4.057486672347064, 4.057486672347064], [94.08074124607997, 94.08074124607997, 94.08074124607997, 188.16148249215993, 94.08074124607997, 846.7266712147195, 94.08074124607997, 94.08074124607997, 94.08074124607997, 94.08074124607997  …  24.99375238071137, 24.99375238071137, 24.99375238071137, 24.99375238071137, 24.99375238071137, 24.99375238071137, 324.9187809492477, 24.99375238071137, 24.99375238071137, 24.99375238071137], [0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726  …  0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956], [12.384292053067004, 12.384292053067004, 12.384292053067004, 24.768584106134007, 12.384292053067004, 111.45862847760303, 12.384292053067004, 12.384292053067004, 12.384292053067004, 12.384292053067004  …  13.530111496595195, 13.530111496595195, 13.530111496595195, 13.530111496595195, 13.530111496595195, 13.530111496595195, 175.89144945573753, 13.530111496595195, 13.530111496595195, 13.530111496595195], [1.2548454674764373, 1.2548454674764373, 1.2548454674764373, 2.5096909349528747, 1.2548454674764373, 11.293609207287943, 1.2548454674764373, 1.2548454674764373, 1.2548454674764373, 1.2548454674764373  …  3.5771064837982878, 3.5771064837982878, 3.5771064837982878, 3.5771064837982878, 3.5771064837982878, 3.5771064837982878, 46.50238428937774, 3.5771064837982878, 3.5771064837982878, 3.5771064837982878], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [1.3061857958470848, 1.3061857958470848, 1.3061857958470848, 2.02208568733654, 1.3061857958470848, 7.033384927762728, 1.3061857958470848, 1.3061857958470848, 1.3061857958470848, 1.3061857958470848  …  2.631055234104208, 2.631055234104208, 2.631055234104208, 2.631055234104208, 2.631055234104208, 2.631055234104208, 27.120287191063134, 2.631055234104208, 2.631055234104208, 2.631055234104208], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [11.88921238727358, 11.88921238727358, 11.88921238727358, 18.405502707537238, 11.88921238727358, 64.01953494938287, 11.88921238727358, 11.88921238727358, 11.88921238727358, 11.88921238727358  …  23.94848771160181, 23.94848771160181, 23.94848771160181, 23.94848771160181, 23.94848771160181, 23.94848771160181, 246.85527544670435, 23.94848771160181, 23.94848771160181, 23.94848771160181], [6.447669663541784, 6.447669663541784, 6.447669663541784, 9.981535999529559, 6.447669663541784, 34.718600351443996, 6.447669663541784, 6.447669663541784, 6.447669663541784, 6.447669663541784  …  12.987566600381651, 12.987566600381651, 12.987566600381651, 12.987566600381651, 12.987566600381651, 12.987566600381651, 133.87272587431335, 12.987566600381651, 12.987566600381651, 12.987566600381651]), Bank{Float64}(89460.0, 6476.292527744359, 0.0, 126431.00000000006, 0.028359903595743693, 3695.369633667522, 0.0, 0.0, 0.0, 0.0, 33636.12938055408, 18241.296726948152), CentralBank{Float64}(0.0016459319014481277, 0.0089810924595537, 0.9259668580654086, -0.003424572940686137, 0.0049629315732038215, 0.30996974466133875, 1.328593153520194, 106179.90000000002), Government{Float64}(0.9905949533296431, 0.09373211872949586, 0.011235005057648862, 0.0, 14732.121510837034, 232610.9, 2.238468336136841, 0.5902859043576301, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 0.0, 0.0), RestOfTheWorld{Float64}(0.962809216044625, 0.39260026877953946, 0.020320381298662014, 0.9662360466537488, 0.35492769963078624, 0.02122821278168188, 2.3548476e6, 0.0, 0.0019383188997990075, 0.38456173629534834, 0.0026219533879005877, 0.0025327891562467505, 0.9635784504324201, 0.5360029623199525, 0.006618207536795881, 0.0, 33097.63671130043, 34095.03119997918, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 0.0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 0.0), Aggregates{Float64, Int64}([104531.39273728609, 105062.38754395355, 105399.12953350678, 106689.88106040593, 107938.33111423723, 108890.48532381697, 110110.17779727321, 110374.00540561741, 110808.89423399912, 111932.48072916963  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [-0.007497362866886709, -0.007895434153021436, -0.0019938777296781562, -0.0035311300388783107, 0.001212170001002849, -0.001672412335241874, 0.001839696090252002, 0.004290005139261838, 0.00600429551344886, 0.0036060572293247772  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 1.0, [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0  …  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1), MutableNamedTuple(tau_VAT = 0.1528683933530887, tau_EXPORT = 0.0029486201783457183, tau_SIW = 0.17114894621657745, psi_H = 0.07125099957246343, tau_FIRM = 0.07701197259426128, H_inact = 4130, theta_DIV = 0.7858074440019603, I_s = [48, 2, 1, 1, 5, 2, 4, 1, 1, 1  …  14, 10, 13, 41, 20, 16, 7, 7, 2, 19], psi = 0.9096681249468772, tau_INC = 0.21340742230566648, zeta_b = 0.5, tau_CF = 0.08761417854834112, H_act = 4743, zeta = 0.03, mu = 0.026713971694295565, tau_G = 0.009147800682711324, theta_UB = 0.3585824478060919, T_prime = 54, tau_SIF = 0.21215146534992413, T = 16, zeta_LTV = 0.6, I = 624, products = MutableNamedTuple(a_sg = [0.37790282216028437 0.0 … 0.0 0.0; 0.0006712800413285777 0.8149348034258406 … 2.4029219530949635e-5 0.00019143106686926454; … ; 0.00037430822580994426 0.000357977071568566 … 0.3197327950788158 0.0011366219595362582; 0.0 5.36965607352849e-5 … 0.0 0.05594572929254256], b_CF_g = [0.0033476048872100555, 0.0, 0.0, 0.0008050086095806136, 0.0, 0.003306696048303853, 0.0030629933432974495, 0.0, 0.0, 0.0  …  0.0017883064872300512, 0.0, 0.0, 0.0, 0.0, 0.002291709084994238, 0.0, 0.0, 0.0, 0.0], b_CFH_g = [0.0006092803753845975, 0.0, 0.0, 0.004372477702289994, 0.0, 0.0, 0.06710603871527036, 0.0, 0.0, 0.0  …  0.0041711096896454745, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], c_E_g = [0.005090338238241512, 0.0005933402816643566, 1.793599921320476e-5, 0.007268146142708006, 0.05434404438533037, 0.02138421321578873, 0.023894091259534518, 0.028037089231640524, 0.005923381894006229, 0.011927802553688313  …  0.0014618202435669027, 0.0009447261124040238, 0.0001280209174610526, 0.0010477673386531637, 0.0, 0.0013030104043795392, 5.5260305268213854e-5, 0.0, 1.307076865739618e-5, 8.641230390167474e-6], b_HH_g = [0.011287997598927976, 0.0020040637862256817, 0.0003326837475323491, 0.00034402684015257527, 0.06305103828047173, 0.03068200872784047, 0.0003505790613555631, 0.0020473225369636873, 0.0, 0.0191077565617325  …  0.005591228759882936, 0.0004356874830029748, 0.014434120586233577, 0.03514505772295519, 0.024907176866291014, 0.013342154173060372, 0.009686226103767459, 0.011051272187723254, 0.0021206651420422927, 0.01721782824162338], c_G_g = [0.0, 0.0, 0.0, 0.0, 8.57086390274792e-6, 0.0, 0.0, 0.0, 2.4536198623552867e-5, 0.0  …  0.008555738848801895, 0.3324338967920097, 0.22067672180252998, 0.2370889178393625, 0.0477595425645907, 0.012942508661614227, 0.004667927760053456, 0.021757222045203074, 0.0, 0.002000708524749294], c_I_g = [0.016810689305736877, 0.004087420487057966, 0.00036885674795364003, 0.05818437780960789, 0.04895082866561155, 0.04689140072807505, 0.010101572733480902, 0.016066325760592727, 0.00037371898454196314, 0.041008926225895866  …  0.0018123421762754539, 0.000401097116716159, 0.0003479865324437806, 0.0006664256271585853, 0.0028556289501379516, 0.001307065586721844, 6.418152296577174e-5, 0.0, 3.538212163497461e-5, 0.00020458795490837936]), J = 156, G = 62, H = 8873, L = 312, theta = 0.05, C = [4.3800671000101816e-5 0.00010629745355671226 9.959785873214212e-5; 0.00010629745355671226 0.0004129178961230129 0.0003596689472264872; 9.959785873214212e-5 0.0003596689472264872 0.0004506370179043619]))

Note that the it is very simple to inspect the model by typing

fieldnames(typeof(model))
(:w_act, :w_inact, :firms, :bank, :cb, :gov, :rotw, :agg, :prop)

and to inspect the specific attributes of one agent type by typing

fieldnames(typeof(model.bank))
(:E_k, :Pi_k, :Pi_e_k, :D_k, :r, :Y_h, :C_d_h, :I_d_h, :C_h, :I_h, :K_h, :D_h)

We can now define a data tracker, which will store the time series of the model.

data = Bit.init_data(model);

We can run now the model for a number of epochs and progressively update the data tracker.

for t in 1:T
+model = Bit.init_model(parameters, initial_conditions, T)
Model(Workers{Vector{Float64}, Vector{Int64}}([0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249  …  4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569], [3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487  …  22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958], [6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249  …  42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032], [0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983  …  11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522], [1, 2, 3, 3, 3, 4, 5, 6, 7, 8  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), Workers{Vector{Float64}, Vector{Int64}}([2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714  …  2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714], [13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984  …  13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984], [25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977  …  25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1  …  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), Firms{Vector{Float64}, Vector{Int64}}([1, 1, 1, 1, 1, 1, 1, 1, 1, 1  …  62, 62, 62, 62, 62, 62, 62, 62, 62, 62], [10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621  …  11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951], [1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485  …  3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877], [0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754  …  0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983  …  2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687], [0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721  …  0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782], [0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832  …  0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318], [-0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635  …  0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037], [1, 1, 3, 1, 1, 1, 1, 1, 1, 55  …  16, 2, 1, 2, 2, 4, 1, 1, 2, 1], [10.822026659306621, 10.822026659306621, 32.46607997791986, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 595.2114662618642  …  191.80965421278322, 23.976206776597902, 11.988103388298951, 23.976206776597902, 23.976206776597902, 47.952413553195804, 11.988103388298951, 11.988103388298951, 23.976206776597902, 11.988103388298951], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [10.822026659306621, 10.822026659306621, 32.46607997791986, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 595.2114662618642  …  191.80965421278322, 23.976206776597902, 11.988103388298951, 23.976206776597902, 23.976206776597902, 47.952413553195804, 11.988103388298951, 11.988103388298951, 23.976206776597902, 11.988103388298951], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0  …  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [298.15365853658534, 298.15365853658534, 894.460975609756, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 16398.451219512197  …  1267.3333333333335, 158.41666666666669, 79.20833333333334, 158.41666666666669, 158.41666666666669, 316.83333333333337, 79.20833333333334, 79.20833333333334, 158.41666666666669, 79.20833333333334], [7.65511425407355, 7.65511425407355, 22.965342762220647, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 421.03128397404527  …  64.91978675755303, 8.114973344694128, 4.057486672347064, 8.114973344694128, 8.114973344694128, 16.229946689388257, 4.057486672347064, 4.057486672347064, 8.114973344694128, 4.057486672347064], [94.08074124608, 94.08074124608, 282.24222373824, 94.08074124608, 94.08074124608, 94.08074124608, 94.08074124608, 94.08074124608, 94.08074124608, 5174.4407685344  …  399.90003809138204, 49.987504761422755, 24.993752380711378, 49.987504761422755, 49.987504761422755, 99.97500952284551, 24.993752380711378, 24.993752380711378, 49.987504761422755, 24.993752380711378], [0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726  …  0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956], [12.38429205306701, 12.38429205306701, 37.15287615920103, 12.38429205306701, 12.38429205306701, 12.38429205306701, 12.38429205306701, 12.38429205306701, 12.38429205306701, 681.1360629186856  …  216.48178394552326, 27.060222993190408, 13.530111496595204, 27.060222993190408, 27.060222993190408, 54.120445986380815, 13.530111496595204, 13.530111496595204, 27.060222993190408, 13.530111496595204], [1.2548454674764367, 1.2548454674764367, 3.7645364024293086, 1.2548454674764367, 1.2548454674764367, 1.2548454674764367, 1.2548454674764367, 1.2548454674764367, 1.2548454674764367, 69.01650071120402  …  57.2337037407726, 7.154212967596575, 3.5771064837982873, 7.154212967596575, 7.154212967596575, 14.30842593519315, 3.5771064837982873, 3.5771064837982873, 7.154212967596575, 3.5771064837982873], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [1.3061857958470844, 1.3061857958470844, 2.7379855788259926, 1.3061857958470844, 1.3061857958470844, 1.3061857958470844, 1.3061857958470844, 1.3061857958470844, 1.3061857958470844, 39.96477993627762  …  33.242595180302864, 4.671824563850785, 2.631055234104207, 4.671824563850785, 4.671824563850785, 8.75336322334394, 2.631055234104207, 2.631055234104207, 4.671824563850785, 2.631055234104207], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [11.889212387273577, 11.889212387273577, 24.921793027800877, 11.889212387273577, 11.889212387273577, 11.889212387273577, 11.889212387273577, 11.889212387273577, 11.889212387273577, 363.7688896815108  …  302.58197238047995, 42.52405335619368, 23.948487711601803, 42.52405335619368, 42.52405335619368, 79.67518464537744, 23.948487711601803, 23.948487711601803, 42.52405335619368, 23.948487711601803], [6.447669663541781, 6.447669663541781, 13.515402335517322, 6.447669663541781, 6.447669663541781, 6.447669663541781, 6.447669663541781, 6.447669663541781, 6.447669663541781, 197.27645180688145  …  164.09401569279623, 23.06132987320929, 12.98756660038165, 23.06132987320929, 23.06132987320929, 43.20885641886457, 12.98756660038165, 12.98756660038165, 23.06132987320929, 12.98756660038165]), Bank{Float64}(89460.0, 6476.29252774436, 0.0, 126431.00000000003, 0.028359903595743693, 3695.3696336675225, 0.0, 0.0, 0.0, 0.0, 33636.12938055408, 18241.296726948152), CentralBank{Float64}(0.0016459319014481277, 0.0089810924595537, 0.9259668580654086, -0.003424572940686137, 0.0049629315732038215, 0.30996974466133875, 1.328593153520194, 106179.90000000002), Government{Float64}(0.9905949533296431, 0.09373211872949586, 0.011235005057648862, 0.0, 14732.121510837034, 232610.9, 2.238468336136841, 0.5902859043576301, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 0.0, 0.0), RestOfTheWorld{Float64}(0.962809216044625, 0.39260026877953946, 0.020320381298662014, 0.9662360466537488, 0.35492769963078624, 0.02122821278168188, 2.3548476e6, 0.0, 0.0019383188997990075, 0.38456173629534834, 0.0026219533879005877, 0.0025327891562467505, 0.9635784504324201, 0.5360029623199525, 0.006618207536795881, 0.0, 33097.63671130043, 34095.03119997918, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 0.0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 0.0), Aggregates{Float64, Int64}([104531.39273728609, 105062.38754395355, 105399.12953350678, 106689.88106040593, 107938.33111423723, 108890.48532381697, 110110.17779727321, 110374.00540561741, 110808.89423399912, 111932.48072916963  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [-0.007497362866886709, -0.007895434153021436, -0.0019938777296781562, -0.0035311300388783107, 0.001212170001002849, -0.001672412335241874, 0.001839696090252002, 0.004290005139261838, 0.00600429551344886, 0.0036060572293247772  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 1.0, [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0  …  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1), MutableNamedTuple(tau_VAT = 0.1528683933530887, tau_EXPORT = 0.0029486201783457183, tau_SIW = 0.17114894621657745, psi_H = 0.07125099957246343, tau_FIRM = 0.07701197259426128, H_inact = 4130, theta_DIV = 0.7858074440019603, I_s = [48, 2, 1, 1, 5, 2, 4, 1, 1, 1  …  14, 10, 13, 41, 20, 16, 7, 7, 2, 19], psi = 0.9096681249468772, tau_INC = 0.21340742230566648, zeta_b = 0.5, tau_CF = 0.08761417854834112, H_act = 4743, zeta = 0.03, mu = 0.026713971694295565, tau_G = 0.009147800682711324, theta_UB = 0.3585824478060919, T_prime = 54, tau_SIF = 0.21215146534992413, T = 16, zeta_LTV = 0.6, I = 624, products = MutableNamedTuple(a_sg = [0.37790282216028437 0.0 … 0.0 0.0; 0.0006712800413285777 0.8149348034258406 … 2.4029219530949635e-5 0.00019143106686926454; … ; 0.00037430822580994426 0.000357977071568566 … 0.3197327950788158 0.0011366219595362582; 0.0 5.36965607352849e-5 … 0.0 0.05594572929254256], b_CF_g = [0.0033476048872100555, 0.0, 0.0, 0.0008050086095806136, 0.0, 0.003306696048303853, 0.0030629933432974495, 0.0, 0.0, 0.0  …  0.0017883064872300512, 0.0, 0.0, 0.0, 0.0, 0.002291709084994238, 0.0, 0.0, 0.0, 0.0], b_CFH_g = [0.0006092803753845975, 0.0, 0.0, 0.004372477702289994, 0.0, 0.0, 0.06710603871527036, 0.0, 0.0, 0.0  …  0.0041711096896454745, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], c_E_g = [0.005090338238241512, 0.0005933402816643566, 1.793599921320476e-5, 0.007268146142708006, 0.05434404438533037, 0.02138421321578873, 0.023894091259534518, 0.028037089231640524, 0.005923381894006229, 0.011927802553688313  …  0.0014618202435669027, 0.0009447261124040238, 0.0001280209174610526, 0.0010477673386531637, 0.0, 0.0013030104043795392, 5.5260305268213854e-5, 0.0, 1.307076865739618e-5, 8.641230390167474e-6], b_HH_g = [0.011287997598927976, 0.0020040637862256817, 0.0003326837475323491, 0.00034402684015257527, 0.06305103828047173, 0.03068200872784047, 0.0003505790613555631, 0.0020473225369636873, 0.0, 0.0191077565617325  …  0.005591228759882936, 0.0004356874830029748, 0.014434120586233577, 0.03514505772295519, 0.024907176866291014, 0.013342154173060372, 0.009686226103767459, 0.011051272187723254, 0.0021206651420422927, 0.01721782824162338], c_G_g = [0.0, 0.0, 0.0, 0.0, 8.57086390274792e-6, 0.0, 0.0, 0.0, 2.4536198623552867e-5, 0.0  …  0.008555738848801895, 0.3324338967920097, 0.22067672180252998, 0.2370889178393625, 0.0477595425645907, 0.012942508661614227, 0.004667927760053456, 0.021757222045203074, 0.0, 0.002000708524749294], c_I_g = [0.016810689305736877, 0.004087420487057966, 0.00036885674795364003, 0.05818437780960789, 0.04895082866561155, 0.04689140072807505, 0.010101572733480902, 0.016066325760592727, 0.00037371898454196314, 0.041008926225895866  …  0.0018123421762754539, 0.000401097116716159, 0.0003479865324437806, 0.0006664256271585853, 0.0028556289501379516, 0.001307065586721844, 6.418152296577174e-5, 0.0, 3.538212163497461e-5, 0.00020458795490837936]), J = 156, G = 62, H = 8873, L = 312, theta = 0.05, C = [4.3800671000101816e-5 0.00010629745355671226 9.959785873214212e-5; 0.00010629745355671226 0.0004129178961230129 0.0003596689472264872; 9.959785873214212e-5 0.0003596689472264872 0.0004506370179043619]))

Note that the it is very simple to inspect the model by typing

fieldnames(typeof(model))
(:w_act, :w_inact, :firms, :bank, :cb, :gov, :rotw, :agg, :prop)

and to inspect the specific attributes of one agent type by typing

fieldnames(typeof(model.bank))
(:E_k, :Pi_k, :Pi_e_k, :D_k, :r, :Y_h, :C_d_h, :I_d_h, :C_h, :I_h, :K_h, :D_h)

We can now define a data tracker, which will store the time series of the model.

data = Bit.init_data(model);

We can run now the model for a number of epochs and progressively update the data tracker.

for t in 1:T
     Bit.run_one_epoch!(model; multi_threading = true)
     Bit.update_data!(data, model)
-end

Note that we can equivalently run the model for a number of epochs in the single command data = BeforeIT.run_one_sim!(model), but writing the loop explicitely is more instructive.

We can then plot any time series stored in the data tracker, for example

plot(data.real_gdp, title = "gdp", titlefont = 10)
Example block output

Or we can plot multiple time series at once using the function plot_data

ps = Bit.plot_data(data, quantities = [:real_gdp, :real_household_consumption, :real_government_consumption, :real_capitalformation, :real_exports, :real_imports, :wages, :euribor, :gdp_deflator])
-plot(ps..., layout = (3, 3))
Example block output

To run multiple monte-carlo repetitions in parallel we can use

model = Bit.init_model(parameters, initial_conditions, T)
-data_vector = Bit.run_n_sims(model, 4)
BeforeIT.DataVector(BeforeIT.Data[BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72421.99999999999, 72998.26520087721, 72775.20321484287, 73458.38585263045, 73483.13565974677, 73863.85860723114, 76279.00748701031, 77129.59347410194, 78298.32622173321, 79398.19932177025, 79506.7067006456, 80208.87936161556, 82024.26209984519, 83035.83020115535, 83555.60895534405, 82354.75140411852, 81809.24392021431], [72421.99999999999, 72805.2867800712, 72521.20465892296, 73217.8978964182, 73575.34780371124, 73505.68305608681, 74572.24603631673, 75128.8379123711, 75822.35403799916, 76280.0579947256, 75829.91761494795, 76141.99040103858, 77144.14237555936, 77540.62252010441, 77612.30766660403, 77150.35784935897, 76796.59757749074], [64900.92049553803, 65421.39927998351, 65238.64881592737, 65894.06572977547, 65926.26270123813, 66267.16045359496, 68578.25727313968, 69342.21238928425, 70404.30312365742, 71405.58707422746, 71476.89593468532, 72056.65639965764, 73720.19159487064, 74661.13555331067, 75133.55785889224, 74006.71121653705, 73512.25021849414], [64900.92049553803, 65248.451083403335, 65010.95419114574, 65678.3418337228, 66008.99191485519, 65945.82228949432, 67043.80199211792, 67543.46289701361, 68177.95800798149, 68601.33314983163, 68171.44559271983, 68403.11551016734, 69334.13127722545, 69720.15471919806, 69789.31613971536, 69329.87054496122, 69007.98035184568], [40512.94792630534, 40805.920886580694, 40489.19156020103, 40588.8391533742, 40518.61702963574, 40743.98440421495, 41305.86167327164, 41660.99464163407, 42248.96661177292, 42736.32940182308, 42963.99397590303, 43664.02722894026, 44427.18771076274, 44824.80506747843, 45037.053581518594, 44640.53946794303, 44313.60186730374], [40512.94792630534, 40698.04623845648, 40347.876995179526, 40455.959471092545, 40569.46282592947, 40546.41147281158, 40381.632914741625, 40580.30092885731, 40912.95764236001, 41057.980068811434, 40977.12329940323, 41450.09840054814, 41783.9454615618, 41858.35537327174, 41833.572906329595, 41819.488685482254, 41598.402414419405], [14866.888022051655, 15035.3689190872, 15196.979169642907, 15448.067762709883, 15457.451826689952, 15555.325155985802, 15999.676987421299, 15891.825504963126, 16070.710797323538, 16194.971647229399, 16207.115874514348, 16444.98170407411, 16646.05947225815, 17066.496312949464, 17170.316033539875, 17088.495015134868, 17161.986844150244], [14866.888022051655, 14995.621375193432, 15143.938977476915, 15397.493901052552, 15476.8489953106, 15479.895341377814, 15641.68030123826, 15479.588685955554, 15562.518159918707, 15558.959611504348, 15457.617508515887, 15611.159874352923, 15655.684660189527, 15937.056872164036, 15948.993339754583, 16008.590676878779, 16110.431219554834], [15944.236265986641, 16295.297547868206, 15784.03098583507, 16164.19049960902, 16032.36933183083, 16174.962813775284, 18573.749060532267, 18609.593469726584, 18735.02015068725, 19058.53902993218, 18377.98853013202, 17756.367747099142, 19017.668869466135, 19172.46055358676, 19253.062030797628, 18076.120281664105, 17943.16226569052], [15944.236265986641, 16252.219253080002, 15728.941877184101, 16111.272196382546, 16052.487950009621, 16096.528294785843, 18158.156882084328, 18126.85725968021, 18142.57595688121, 18310.068426191036, 17528.09811901129, 16856.053760102088, 17886.19266250136, 17903.65102589868, 17883.593842958955, 16933.803144097645, 16843.74217086937], [15944.236265986641, 16070.97241189897, 15998.73036579299, 16091.796451984417, 16114.295654552783, 16173.75604076976, 18096.74918899262, 18595.720568433986, 18854.417471922607, 19098.733710545675, 17402.367751209276, 17604.535598790888, 19665.806253092862, 19826.86521454449, 18293.942137932005, 18074.13236027786, 17949.49167918318], [15944.236265986641, 16028.487143676088, 15942.891917668447, 16039.11515228522, 16134.517080019225, 16095.327373581109, 17691.82999934659, 18113.344223948523, 18258.19766169593, 18348.68457359069, 16597.594940610335, 16711.92006728567, 18495.76843095581, 18514.748002562785, 16992.696042740292, 16931.940849042283, 16849.68376619045], [3173.2320350842083, 3197.54996092362, 3171.5004343456567, 3143.8453530369998, 3137.427273063862, 3135.43696773483, 2728.159373797779, 3115.060398411828, 3231.24499151449, 3302.43951467848, 3367.1944951662676, 3418.145298057116, 3480.539267123832, 3473.4665600757385, 3524.829159965292, 3491.932831612633, 3467.433402735953], [3173.2320350842083, 3189.0969087831477, 3160.4313270833227, 3133.5530367163547, 3141.364351861389, 3120.232822092123, 2667.1161404895906, 3034.2551700095455, 3129.0656333611223, 3172.7454760384785, 3211.478524992039, 3244.83259890265, 3273.4609235482853, 3243.596875211238, 3274.1084489211485, 3271.2607706489566, 3254.9755369498707], [34195.564496956766, 34248.05925065131, 34832.2918978625, 33228.21693849553, 34132.26687672403, 34673.5109837227, 33405.13605992434, 34017.74743723792, 34047.87681367389, 35331.241899285196, 36421.577609382846, 36580.24462348844, 36029.023931271724, 36276.3852866257, 36514.53986394658, 36343.83221192235, 36826.05533579987], [34195.564496956766, 34157.52098413674, 34710.72093068403, 33119.43445046011, 34175.098602382066, 34505.37457518843, 32657.68796954428, 33135.320935074895, 32971.20506379351, 33943.706584340514, 34737.26109578004, 34725.48996018288, 33885.43926702035, 33875.6593519911, 33917.26465352801, 34047.09033736027, 34569.63561169191], [33097.63671130043, 33386.3814033104, 33527.290398697885, 31970.92850155804, 32657.56940513405, 33283.92475046787, 33005.41629413954, 33050.56757946, 32804.2481517245, 33922.88265649964, 34463.96928928702, 34236.74194198663, 34095.677883913915, 34304.317019484755, 34419.362554459105, 33794.235572545265, 34435.562392729866], [33097.63671130043, 33298.12107079557, 33410.27412160091, 31866.26212256939, 32698.550569920775, 33122.52662807712, 32266.91203129207, 32193.22989719712, 31766.902784954313, 32590.656696121776, 32870.18240776292, 32500.81159414762, 32067.11967571397, 32034.100103220866, 31971.11707596757, 31658.614994459433, 32325.613839044556], [29576.147776884874, 29813.33636105215, 29686.749258444303, 29946.91061088545, 29986.583238421124, 30130.218573876376, 31159.1969428925, 31480.879085861583, 31986.98568002566, 32442.33131950946, 32489.40095686151, 32797.320434494315, 33563.89416989872, 33987.689680023854, 34150.72815190432, 33655.11207744497, 33399.14905805293], [34346.71094688275, 34622.15749258405, 34566.40950384818, 34949.164828316425, 34949.40526371883, 35141.32012153505, 36386.23661108844, 36816.759153334264, 37356.867285415, 37886.1073112557, 37910.62500982342, 38174.64806784029, 39050.376663743635, 39556.35962511278, 39858.01582032214, 39244.92861267172, 39013.32587997295], [28335.32931213966, 28562.56704073638, 28516.57609791326, 28832.341359441656, 28832.53971369793, 28990.865519756182, 30017.895990072866, 30373.068222712573, 30818.646310534146, 31255.25843448841, 31275.4850309729, 31493.29861744631, 32215.756677298214, 32633.182201940122, 32882.04235170885, 32376.258029224497, 32185.19054358489], [978.0617717704339, 985.9054263472372, 985.4900536349026, 997.9902905735233, 990.2741990981837, 995.6217581835022, 1032.823719158774, 1044.5741500883812, 1060.4501582167325, 1077.1484434622848, 1076.8699680003892, 1084.6878973230207, 1105.9207612282462, 1117.0862481739919, 1124.8138866657494, 1106.670526420342, 1099.7752804682118], [0.0019383188997990075, 0.00702364541617162, 0.0025220800167031765, 0.006866622212144069, 0.006609513896386865, 0.005020375468921534, 0.004482222537426361, 0.0002075886403423155, 0.0016009112196766484, 1.8496107892840286e-5, 0.002851628780846216, 0.004215197367222201, 0.00495195128395709, 0.007854125651648003, 0.006565108085142546, 0.010555616504413612, 0.00796856772769483], [2.3548476e6, 2.3341465972868116e6, 2.346618764303523e6, 2.321424143081999e6, 2.348186935776065e6, 2.3372491823959094e6, 2.334934757248542e6, 2.352561302815468e6, 2.3402213905595327e6, 2.368972064263142e6, 2.3653438025664752e6, 2.3532671476842067e6, 2.333373929682377e6, 2.352023752202927e6, 2.3604610797605584e6, 2.349435026988878e6, 2.361510494525494e6], [0.0016459319014481277, 0.0008205944605890355, 0.0013432917627167335, 0.0003453715539657935, 0.0016054311458232355, 0.0011436274943957018, 0.0010644199461194931, 0.001732905607002076, 0.0011254226694294245, 0.0022509245238577823, 0.001999075043376984, 0.0014456148252754522, 0.0006207485937732071, 0.0015411850420938723, 0.001930585507445253, 0.0015704355031201987, 0.00214257789722567], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086172; 522.2382558977934 260.3142715401407 … 138.09588999100865 508.95375771544343; … ; 599.9579862897788 299.4578818465448 … 154.8482312050391 560.2848066902245; 593.946373542461 296.9994295522431 … 152.78177453253144 556.8736619469553], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086172; 520.8576653641655 259.6261039940103 … 137.7308193047818 507.60828611886654; … ; 562.043750332084 280.53369540153335 … 145.0626253631263 524.8777101104578; 557.5538710030767 278.8015703251374 … 143.42047296504347 522.7526923455271]), BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72421.99999999999, 72848.7007052287, 73388.03727101562, 74683.15475896224, 75446.02472888835, 75297.9214270922, 75325.84729999256, 74694.64744642773, 75381.74354979797, 76422.21870302739, 76686.27596135544, 76702.11243070566, 76836.38233683359, 77384.62146804467, 77303.21426411126, 78211.7779176809, 77063.96525623421], [72421.99999999999, 72615.18253944625, 73025.30775948212, 74019.28932838242, 74604.53060509881, 73933.1487130318, 73899.20318940208, 73520.70193088708, 73828.78696386106, 74644.67029977805, 74750.39602861209, 74710.20807597175, 74365.8462679575, 74598.4940786164, 74253.5885993855, 75306.75062588954, 74248.34394732749], [64900.92049553803, 65297.03409818487, 65788.8684359886, 66962.25240009035, 67657.7829678263, 67506.34505591108, 67536.71626955266, 66953.09772205967, 67571.01893420503, 68516.06002512311, 68754.08726195373, 68758.11615950635, 68864.49326633594, 69361.46402347315, 69276.76896260156, 70110.91207490275, 69056.63433842613], [64900.92049553803, 65087.722971342104, 65463.69876257163, 66367.0187805994, 66903.15570945661, 66282.79444505577, 66257.59546350516, 65900.82300747935, 66178.97287728381, 66922.4055204317, 67018.44869878271, 66972.51226071994, 66650.27899303069, 66864.19943755743, 66543.78800432193, 67506.7759914046, 66533.57014729401], [40512.94792630534, 40662.61203850261, 40929.50193487623, 41565.626450926524, 41920.39697084449, 41955.982236762575, 41892.88604889068, 41671.35569087652, 42031.722279648115, 42523.73975002615, 42654.46668916241, 42721.79455713705, 42852.13630774756, 43120.591266368385, 43216.33255653757, 43614.157113446316, 43216.08278265465], [40512.94792630534, 40532.26711145206, 40727.20277555518, 41196.145774993325, 41452.83399659029, 41195.531235418784, 41099.45004651475, 41016.42387431117, 41165.81712995719, 41534.65559393038, 41577.69088970866, 41612.33712599677, 41474.30271958368, 41568.093391513714, 41511.44048763263, 41994.192447045374, 41637.13309889868], [14866.888022051655, 14855.332160807642, 14842.308116257836, 15127.246318918655, 15166.14635526243, 15403.674014824453, 15425.904802695499, 15275.912350095043, 15441.875260481005, 15689.488010335717, 15779.656333105997, 15863.693856818923, 15956.282451619267, 15730.066813855492, 15745.106316819842, 15387.43923529447, 15478.700211632127], [14866.888022051655, 14807.713055941027, 14768.948160422548, 14992.778835275145, 14996.989357470318, 15124.482855317228, 15133.743784583776, 15035.827023873428, 15123.753647001226, 15324.557171714732, 15381.312305339668, 15451.723966105554, 15443.236806795814, 15163.727285972454, 15123.959049210012, 14815.902158406123, 14913.167955341662], [15944.236265986641, 16107.069427515296, 16279.720239563032, 16523.0079946202, 16857.397703916544, 16320.262855827099, 16731.010553232634, 16338.446565740294, 16539.168963989407, 16838.15408775105, 17277.307225461936, 17094.68840218241, 16851.407843864134, 17333.54826112429, 16799.18331799855, 17599.628229953178, 17079.756344617304], [15944.236265986641, 16055.437850391332, 16199.255695340487, 16376.133457085916, 16669.37717982392, 16024.458549283348, 16414.131307587573, 16081.661819677936, 16198.441751284612, 16446.505763215268, 16841.15627237004, 16650.75037763468, 16309.581047450107, 16709.47757821427, 16136.4525236752, 16945.923612891434, 16455.7276464451], [15944.236265986641, 16030.80026025335, 16151.495360647805, 16441.8250684017, 16605.492198244454, 16583.375103609396, 16571.40503346285, 16424.610043939265, 16582.014514695315, 16802.92427356255, 16861.925237694537, 16866.105895731802, 16887.304397422344, 16990.10705711791, 16990.712810601828, 17191.609129009426, 16977.593842943417], [15944.236265986641, 15979.413165678456, 16071.66458385419, 16295.672173364224, 16420.281325204152, 16282.801894953836, 16257.548658226271, 16166.471101394387, 16240.404630974786, 16412.095379567, 16436.260250239404, 16428.10401134483, 16344.323411708705, 16378.401504733669, 16320.426143450224, 16553.059603103662, 16357.297770204223], [3173.2320350842083, 3181.850008605848, 3200.512720819919, 3250.78399566084, 3283.155553136468, 3284.3054069838, 3281.8625884468647, 3263.4373504009145, 3292.226992560383, 3329.8721643645044, 3340.9694200405743, 3347.7307783043652, 3356.4951903600863, 3366.4961165812024, 3384.7849886379045, 3416.138484598423, 3384.958768397308], [3173.2320350842083, 3171.65051608764, 3184.6937882111506, 3221.8874777785063, 3246.5365779766794, 3224.777463593853, 3219.7053064327856, 3212.1472275644905, 3224.4030692901756, 3252.4207497204, 3256.629483394999, 3260.792370684819, 3248.573107349431, 3245.290031200474, 3251.254613876747, 3289.2525373087155, 3261.285375698396], [34195.564496956766, 34206.37391347268, 34469.75823827454, 35749.372979814885, 35754.17278755167, 36474.549723432676, 36937.84112704149, 36148.16578503447, 36866.52881365755, 36711.49651471926, 36618.63916667477, 36868.561215971655, 38036.498033460666, 39434.95020332757, 38877.54129684043, 39095.06477540428, 38570.38765659275], [34195.564496956766, 34096.724604466326, 34299.387166456996, 35431.59351585409, 35355.385357600244, 35813.449532660736, 36238.25187062132, 35580.03970680657, 36107.03299907771, 35857.602671827626, 35694.232708824886, 35911.1084769065, 36813.50265721485, 38015.148790877654, 37343.81532116228, 37642.95317315381, 37161.17382990215], [33097.63671130043, 32982.68683507009, 33133.25125795548, 34282.09898531792, 34252.08908868677, 34856.54740375482, 35661.795231867814, 34739.232945319105, 35497.55176797769, 35340.65965980483, 35643.79345304956, 35846.62560140459, 36859.94229985777, 38234.53507663122, 37334.94922408508, 37484.51143641723, 37280.961739262864], [33097.63671130043, 32876.96008280496, 32969.48603829258, 33977.36225482599, 33870.05528638607, 34224.77345964855, 34986.37381990541, 34193.25049378235, 34766.258563459276, 34518.65090090998, 34743.996147631064, 34915.71187067185, 35674.77696308682, 36857.95296796186, 35862.07878229463, 36092.220765607126, 35918.85858326015], [29576.147776884874, 29756.661617965397, 29998.668810861265, 30558.367786067873, 30864.68509813832, 30813.507511417807, 30784.241780486183, 30492.75878869189, 30785.66528529735, 31206.504877384912, 31303.644565367875, 31304.635540364736, 31332.508318159984, 31554.391776977096, 31563.7223749742, 31951.25690883132, 31560.279168091172], [34346.71094688275, 34556.34124655114, 34800.464742628625, 35399.04386965008, 35776.01418976917, 35679.77309492656, 35735.83235329774, 35445.01870056348, 35761.09876327079, 36268.40837941764, 36408.1807619457, 36410.563925896065, 36487.09972757897, 36756.82961223809, 36655.63672428978, 37090.830405006294, 36446.5233119784], [28335.32931213966, 28508.269992954563, 28709.6668505717, 29203.482305267087, 29514.47505732408, 29435.078135739845, 29481.325869602864, 29241.410594121753, 29502.170137580346, 29920.690125097255, 30035.999462687098, 30037.965523875395, 30101.10598434649, 30323.62758529284, 30240.145536356737, 30599.171362053265, 30067.63127696836], [978.0617717704339, 984.0312336681842, 989.7348824986959, 1004.8407443724761, 1017.0836799188901, 1013.0644495667538, 1016.6421357686755, 1015.3202328042123, 1024.2548856369142, 1041.1467683206174, 1042.2619346401618, 1042.916693245486, 1044.8852205970736, 1050.2426342579645, 1057.4098633376045, 1068.8247610651813, 1049.8318583563862], [0.0019383188997990075, 0.003394285662483565, 0.006480740613808544, 0.008460338410152035, 0.0062203247794234695, 0.003711036777418242, 0.007397361440984351, 0.003268316558617812, 0.0034426994460747817, 0.00476089810491942, 0.0041981250514033785, 0.008965986475472754, 0.008198192653084524, 0.008543994157529378, 0.003920321239273772, 0.007445801483767056, 0.005352518534590844], [2.3548476e6, 2.3612841430961387e6, 2.365007398090495e6, 2.3925451303350106e6, 2.4000650720185013e6, 2.3885994491694416e6, 2.393948551759325e6, 2.369158012492677e6, 2.3778320040728194e6, 2.3678521749581727e6, 2.3671140536709838e6, 2.3590929172024745e6, 2.3654903273685873e6, 2.368956245810877e6, 2.363509074657595e6, 2.363427586529819e6, 2.351894588006396e6], [0.0016459319014481277, 0.0018708193524350342, 0.0020361301617013695, 0.003224822941481771, 0.003437975722998339, 0.002798726229817517, 0.002981552858781353, 0.0018172541570149387, 0.002121836922136827, 0.0016611844919769093, 0.0016038791470957732, 0.0013575910057325596, 0.0017119500456709922, 0.0019253939208735357, 0.0016466460961562658, 0.0016922150038976252, 0.0012097903298634546], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086172; 521.2454881436383 259.81941768404533 … 137.83337160018547 507.9862436099363; … ; 541.8769210098392 280.76175583421144 … 148.40270954322088 544.3862848824479; 537.0072070453017 277.9849244172409 … 146.80518770181203 537.082194005011], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086172; 519.5746238847657 258.98656063560276 … 137.39154359490774 506.3578821607676; … ; 521.7499364784012 270.3333960026769 … 142.89057399437047 524.1660948168935; 517.387026197278 267.8284229428941 … 141.4414899816534 517.4592734214838]), BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72421.99999999999, 72697.12010245532, 73405.70395756184, 73983.17939701246, 74193.80036411695, 75804.39272626262, 76329.73991856792, 75647.01084705067, 76885.58349168987, 75883.00509971275, 76512.4425075362, 76209.30177564656, 77210.6782242477, 78627.53516640038, 80433.6767643113, 81120.07262689788, 81713.83321915388], [72421.99999999999, 72397.64787296124, 72381.95811641263, 72613.5948680023, 72069.96961833377, 72818.64947390713, 73739.98552267793, 73359.98542699523, 74057.51631089364, 73289.44791623825, 73242.82611634034, 72697.76566190545, 73733.41665083586, 74598.18037796683, 75799.23561755713, 75490.15168667304, 75866.01031981337], [64900.92049553803, 65149.285969119956, 65781.87216465702, 66304.82722164752, 66510.18320010534, 67961.31909981204, 68422.9775020748, 67792.66561332316, 68907.10090996753, 67996.62521717668, 68554.22897568451, 68300.46824522679, 69232.91991284606, 70531.29153599027, 72170.70310105165, 72771.62510809414, 73298.9390045159], [64900.92049553803, 64880.90667305399, 64864.45138642282, 65077.38516925679, 64606.29943495489, 65284.49467545198, 66101.48777926266, 65743.09950601897, 66372.50467284127, 65672.61161818575, 65624.69198276188, 65153.351617198765, 66114.94481452042, 66916.83768488711, 68012.3593637416, 67721.10576333702, 68053.32516997244], [40512.94792630534, 40652.67620614675, 41072.75491362693, 41334.1186140721, 41289.44791302933, 42097.14980884275, 42447.88226713211, 42235.48399776786, 42887.39400209025, 42386.49766483838, 42771.88079157864, 42435.26781303297, 42738.14823772481, 43350.09615768069, 44273.282685330385, 44836.4258221784, 45243.88429760393], [40512.94792630534, 40485.20949548204, 40499.93754712252, 40568.93698987728, 40107.51898468565, 40439.04957922896, 41007.6888403655, 40958.58456116569, 41309.87548770842, 40937.79639956151, 40944.10431581598, 40479.95564050547, 40813.39218061316, 41128.572652430994, 41722.337220285925, 41724.674014680386, 42006.02098575745], [14866.888022051655, 14821.649600586738, 15010.299815327522, 15247.903285147297, 15481.482893375593, 16105.423796058465, 15938.289328274002, 15752.694441630654, 15855.278158158468, 15886.587124383432, 16135.329237280865, 16308.411048766631, 16423.439444168645, 16570.61087516964, 16629.556980232242, 16482.35377396783, 16507.932978153844], [14866.888022051655, 14760.592540218853, 14800.960061304717, 14965.632468870066, 15038.318515787383, 15471.071897758145, 15397.526908607693, 15276.44545017723, 15272.076603782129, 15343.609522175986, 15445.816065010124, 15556.959808285907, 15683.793112911204, 15721.43163871221, 15671.392362850527, 15338.440243674866, 15326.548325306607], [15944.236265986641, 16127.8612787259, 16232.122941057209, 16120.576519343653, 16270.725856049641, 16969.60637754352, 17247.98298151808, 16987.92504529783, 17162.644576554118, 16484.486408614797, 16319.253954196172, 16020.628186246264, 16862.853486782973, 17202.12248029399, 17918.276701529026, 18414.078196543054, 18823.133073976114], [15944.236265986641, 16061.423343257427, 16005.743144147418, 15822.15068282832, 15804.969045376796, 16301.216513649446, 16662.784606752542, 16474.331501051307, 16531.354422296907, 15921.073585351261, 15621.881102512987, 15282.437268207952, 16103.41769634266, 16320.58073489266, 16885.85841400226, 17136.098516834525, 17476.0619075542], [15944.236265986641, 15998.011383969633, 16160.09180150972, 16280.23890436369, 16281.431109438308, 16595.35022611494, 16747.72625462775, 16634.19224987978, 16900.427776809443, 16674.577932291042, 16789.103821707493, 16717.585818658634, 16889.454760189557, 17186.942038228444, 17607.985712909063, 17813.17335850088, 17977.50038627281], [15944.236265986641, 15932.108358789592, 15934.716580206037, 15978.857380702028, 15815.367856095365, 15941.70136519698, 16179.500845562341, 16131.293059395153, 16278.782691132503, 16104.668091202497, 16071.652813088396, 15947.280816920034, 16128.820954294026, 16306.178231329164, 16593.445823871294, 16576.89786643942, 16690.946637780857], [3173.2320350842083, 3178.134556350448, 3217.167134316916, 3238.6202585518013, 3211.287794644063, 3256.259630323175, 3314.9412653525064, 3308.1520279096103, 3359.2137702807313, 3320.5566289688045, 3347.284455296932, 3314.6691805850814, 3321.745625826422, 3365.604140205348, 3435.1693392764364, 3505.713129173366, 3542.3533329729366], [3173.2320350842083, 3165.042386538479, 3172.2992113017854, 3178.6665739764353, 3119.3632440973556, 3128.0038014787488, 3202.4702452334463, 3208.1371337780433, 3235.652475879725, 3207.0654264672794, 3204.244503070134, 3161.9374239421036, 3172.1474266267214, 3193.130042809206, 3237.241173209127, 3262.408517660852, 3288.8460120942636], [34195.564496956766, 34840.5926314861, 35347.23142480172, 35881.99568819489, 36114.73041895151, 35851.70498253865, 35653.93328939398, 35704.332266615864, 37471.15474688783, 38910.26528203501, 38732.99533045117, 38838.64699303257, 38453.151312574395, 38207.44151419255, 38652.741553770655, 37775.6758330069, 37811.961553865774], [34195.564496956766, 34697.06851474613, 34854.2645405361, 35217.74434667249, 35080.930095164134, 34439.597024315146, 34444.2484330656, 34624.88822004337, 36092.86068766844, 37580.375962278726, 37077.81308476507, 37049.058211253956, 36721.37445850433, 36249.459019978574, 36425.641375116036, 35153.956429702615, 35105.96128521297], [33097.63671130043, 33745.65961449015, 34256.70513725147, 34601.41470974562, 34962.58671728899, 35219.49223872043, 34958.34794775033, 35033.424904261235, 36490.88799200051, 37784.83138015886, 37447.0168059702, 37393.65226543208, 37266.91425700319, 36702.73586093625, 37040.18115655107, 36388.46099879813, 36673.0786844454], [33097.63671130043, 33606.646020743145, 33778.94717669821, 33960.86962024593, 33961.7670226801, 33832.28554104425, 33772.26326611348, 33974.26430544202, 35148.65089056205, 36493.40755312918, 35846.788451763314, 35670.64526634809, 35588.560797535516, 34821.86366804739, 34905.993754697614, 33863.0175182192, 34048.58218401752], [29576.147776884874, 29689.33097818996, 29991.10524116877, 30218.888683860758, 30257.968538973404, 30851.986430198238, 31055.61310716767, 30828.32510607347, 31346.077466123686, 30945.80198793409, 31160.078923509343, 31046.211473699987, 31399.789609670748, 31978.197279758446, 32789.42080849077, 33118.35178284241, 33416.928026514885], [34346.71094688275, 34478.150332721496, 34797.52791527835, 35083.095336026294, 35244.54329842896, 36075.54777552207, 36325.59178905963, 35935.377266100455, 36512.5617124473, 36011.881677578946, 36339.901509954805, 36219.05989667974, 36769.53727721728, 37470.04013436076, 38283.11157979212, 38552.0340799113, 38778.71816957263], [28335.32931213966, 28443.764099042142, 28707.244028478734, 28942.831270594143, 29076.022515267556, 29761.584097997005, 29967.86526061176, 29645.946313917648, 30122.111597585576, 29709.060878116437, 29979.670485704683, 29879.978642952854, 30334.111147242347, 30912.011580618677, 31582.77878147888, 31804.634306804295, 31991.644013215777], [978.0617717704339, 981.8046582084597, 993.2390082099944, 1002.8432017604223, 1007.6713627030282, 1033.7848940917374, 1041.7726058475057, 1028.9632411491993, 1048.4617313966157, 1038.9415516636336, 1054.2485422202697, 1035.196874847074, 1063.5930259580273, 1083.0541218710878, 1098.1707127686993, 1101.239245340452, 1103.292808428421], [0.0019383188997990075, 0.0070779907552569465, 0.006841995984202542, 0.0029015095194866447, -0.00031233465852775755, 0.005541998914117441, 0.00550649912537482, 0.006280692971085466, 0.005708378210163456, 0.010578426893508963, 0.005536166960667055, -0.002290252330946485, 0.002656724612732475, 0.0003555638516905546, 0.006436071371883623, 0.006914665390534314, 0.005809623256580965], [2.3548476e6, 2.372907033419555e6, 2.375044241111603e6, 2.383473600925912e6, 2.3824322113126456e6, 2.3623555017721877e6, 2.353865244402328e6, 2.3712366698349533e6, 2.406350316856512e6, 2.441696822450004e6, 2.432291016330707e6, 2.44207932505647e6, 2.4207087235993077e6, 2.4156765039238944e6, 2.4191190775525765e6, 2.3840541136707882e6, 2.386151241723303e6], [0.0016459319014481277, 0.0024408311099309203, 0.0025057289679769213, 0.00273589887026426, 0.0024832086997831804, 0.0015976697736877444, 0.0012522490291869458, 0.0020295627241789242, 0.003466833184590803, 0.0048977203823325315, 0.004283272760367084, 0.004309443296896195, 0.0031906219668078745, 0.002758097029020173, 0.0028417740720941788, 0.0013643462619275495, 0.001483180950137853], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086172; 520.0660617467063 259.231522178718 … 137.52149491148322 506.83681901323604; … ; 575.6292398647461 289.9185206237936 … 152.81830030552453 560.3266485333703; 587.298784650852 295.81011436444453 … 154.7396039782713 566.8012152502307], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086172; 517.923675050012 258.16363060622365 … 136.95498184155065 504.74892953473056; … ; 535.6792372775245 269.7975037488937 … 142.21235628847776 521.4386812302195; 545.2689453159976 274.640563353448 … 143.66571643768646 526.2382775524627]), BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72421.99999999999, 73538.48152087457, 73854.94498769997, 73789.22743748009, 75167.94757261804, 74794.2876524721, 74973.10984435475, 75492.0517702461, 77158.00269437497, 77593.33303618887, 78117.54474093234, 77549.76103141898, 77545.65484780552, 78873.49799593177, 78563.79829286464, 79294.77491967373, 80900.1072698675], [72421.99999999999, 72635.28749715451, 72910.81747911953, 72843.56671172207, 73933.51335480096, 73903.80302373186, 74354.21293291429, 74980.41314174248, 76267.79916934896, 76178.31164360294, 76783.5777603535, 76201.92563318586, 76615.01600358656, 78021.13724942968, 77331.32377715556, 77893.39630662776, 78868.27254806382], [64900.92049553803, 65907.88788055893, 66190.08279737763, 66179.9212887554, 67429.31197604748, 67126.65665319479, 67306.39322012743, 67807.46509568309, 69310.79295128494, 69691.55163211156, 70166.81464328479, 69641.02133313566, 69667.51978886894, 70891.71959557684, 70597.19633991437, 71287.72387490758, 72738.86103111872], [64900.92049553803, 65098.412226199194, 65343.939347204745, 65331.779160562524, 66321.96432754766, 66327.46118246399, 66750.78442958089, 67347.9078624336, 68511.12590375934, 68420.63011626492, 68968.61756506182, 68430.64192675837, 68831.42780894869, 70125.6153835078, 69489.69839225776, 70027.85408257609, 70911.998886493], [40512.94792630534, 41112.610774400215, 41282.73344647805, 40889.64873341669, 41596.10525788913, 41146.87520485319, 41137.73373808493, 41194.993826807295, 42040.50152583834, 42319.90050603316, 42594.442840316515, 42369.448951906576, 42134.69564982277, 42648.864200605014, 42599.22299243824, 42731.72112062353, 43550.021989915454], [40512.94792630534, 40607.668823152264, 40754.99404754271, 40365.61919360348, 40912.999528433706, 40656.98939885605, 40798.145098811234, 40915.79953219587, 41555.46301595877, 41548.13878108937, 41867.08280239452, 41633.05670077028, 41629.02986444734, 42187.9715224412, 41930.9450085827, 41976.52230534535, 42456.24783063966], [14866.888022051655, 15021.948765330624, 15154.359561669758, 15146.33582785099, 15417.14563105595, 15292.573889604962, 15251.264449444423, 15361.968794288836, 15775.199073752572, 15932.442230603601, 16027.746510553945, 15993.127132264266, 16022.362587623862, 16093.105828505602, 16301.443338817839, 16478.58903541585, 16759.807708767246], [14866.888022051655, 14837.450335816255, 14960.633227712375, 14952.224906393276, 15163.959895345135, 15110.503808988104, 15125.366504395603, 15257.854831815719, 15593.194131516479, 15641.892183192578, 15754.050189336056, 15715.16234435765, 15830.075437177233, 15919.19276459878, 16045.713423501438, 16187.362504149456, 16338.879228167956], [15944.236265986641, 16501.748837344232, 16038.811587943535, 16158.129060449324, 16505.813658626976, 16394.058552056562, 16423.283335996264, 16557.268759380106, 17003.88521590048, 16998.615332278518, 17358.10836224723, 16863.740002265324, 16852.7271182517, 17506.49684701462, 16997.967033768502, 17335.954418962367, 17678.94979700022], [15944.236265986641, 16299.075616160237, 15833.778827745316, 15951.05129876461, 16234.749437358487, 16198.874433035271, 16287.710470558759, 16445.053789973826, 16807.704417671546, 16688.622148607756, 17061.694240716148, 16570.64373195647, 16650.47461915232, 17317.309716986136, 16731.310359279727, 17029.575647043486, 17234.936738738834], [15944.236265986641, 16187.993301057486, 16267.066217834417, 16232.565806377388, 16500.628373536456, 16410.43617077398, 16423.392668746827, 16539.924249769283, 16912.19506246514, 17030.465439469586, 17131.54801465181, 17028.235393336578, 16989.850511912453, 17277.155998459562, 17231.131376943522, 17323.288935380937, 17690.79774273221], [15944.236265986641, 15989.173601450528, 16059.115555861621, 16024.534085563111, 16229.64930682588, 16215.057063362785, 16287.818900776376, 16427.82683076601, 16717.072131144992, 16719.891425187892, 16839.002729805277, 16732.280149537888, 16785.952371199208, 17090.447281863282, 16960.816922189795, 17017.13400088177, 17246.487119135836], [3173.2320350842083, 3218.8411142202067, 3233.89334843928, 3205.9175199334068, 3227.537081218736, 3186.3566408263996, 3168.236967637779, 3179.889994270763, 3245.0694847768127, 3278.601666197754, 3304.3326511568357, 3296.0723682247376, 3259.6074680793295, 3302.238951639979, 3308.827413773468, 3285.1883967425297, 3351.791652957583], [3173.2320350842083, 3179.307553048667, 3192.5527493692352, 3164.831437399347, 3174.533343043218, 3148.4205671047807, 3142.083429681925, 3158.3386585034877, 3207.6297870989793, 3218.8118451666865, 3247.906522249298, 3238.785756970948, 3220.488353892282, 3266.55270810488, 3256.9199760862816, 3227.1291770312, 3267.6102236547404], [34195.564496956766, 33920.83393081291, 34787.03429924323, 34679.21643622916, 34813.25782674476, 35439.99018268574, 35744.2614099271, 34665.854567065384, 34868.58635034721, 36818.09844954177, 35536.54060342287, 36037.106131450644, 36124.79433917417, 36138.70071789997, 36998.42376364486, 36689.233851729026, 37532.68900114891], [34195.564496956766, 33504.22083448171, 34342.33291832261, 34234.77794401712, 34241.54238043027, 35018.049316733246, 35449.19544515323, 34430.91075681396, 34466.29316755571, 36146.66966949259, 34929.70417600852, 35410.77167667172, 35691.25442107769, 35748.16130093238, 36418.008669149116, 36040.82407061874, 36590.042281771865], [33097.63671130043, 33018.660787013825, 33407.99390763431, 33084.102620465914, 33164.37480169929, 33479.210176728324, 33583.43308909793, 32288.03417729544, 32530.169471463632, 34475.72348226798, 33399.29357560848, 33713.661186467856, 33588.92484706733, 33513.66959809318, 34333.258835805245, 33940.723507056544, 34621.36122696488], [33097.63671130043, 32613.128112456205, 32980.92154220315, 32660.106631056307, 32619.737886767183, 33080.6139338807, 33306.20458600449, 32069.20576905684, 32154.85556335359, 33847.01113877921, 32828.95364810206, 33127.70882057022, 33185.818338268335, 33151.49805552857, 33794.653683357836, 33340.888220528774, 33751.833531254975], [29576.147776884874, 30035.035200337115, 30179.620599229707, 30166.173691611166, 30729.51785766715, 30600.17906038357, 30685.283528429365, 30914.39555091114, 31579.701384509684, 31773.041609461856, 31956.77963156495, 31723.107704995768, 31712.322580216634, 32254.913767648413, 32170.002176826107, 32411.779752010974, 33087.13218978104], [34346.71094688275, 34879.615833934775, 35015.501292004505, 35018.87193020228, 35688.737554256666, 35522.70644522067, 35614.54795642681, 35878.19789033599, 36699.85954768616, 36885.61415036286, 37162.64459319482, 36881.036228214914, 36915.59913050572, 37578.03117097287, 37376.65803490076, 37811.34621807423, 38564.807971570735], [28335.32931213966, 28774.96487113161, 28887.067576077403, 28889.848283187137, 29442.473630103676, 29305.50138382745, 29381.268739501622, 29598.77450626904, 30276.62845508473, 30429.872177496163, 30658.416588612297, 30426.09548598623, 30454.60916870559, 31001.10196222453, 30834.973271356695, 31193.5820719887, 31815.17250440137], [978.0617717704339, 993.2368462869223, 994.9609061433653, 994.8756669419977, 1011.0565641236809, 1003.771147590453, 1006.5617352712663, 1014.8716544359955, 1031.2320190890894, 1032.8958722868665, 1047.390418525055, 1036.877399924902, 1039.5980781465757, 1058.774656955542, 1050.5361281874943, 1064.5979048223858, 1086.9208697668703], [0.0019383188997990075, 0.0011929493317586193, 0.0006466413446331032, 0.004435908615390227, 0.0028931523898745315, 0.004229168731186617, -0.0003910790573121714, 0.0021955412677587827, 0.006408213820023878, 0.0044650654235618426, 0.0008229671752246759, 0.0018854372134908814, 0.006675158251289837, 0.00835311480062062, 0.008125665168410956, 0.008811312799200888, 0.010076920792365884], [2.3548476e6, 2.3470227710231873e6, 2.3709522501873304e6, 2.3868592841351903e6, 2.3646089561258047e6, 2.389084788376763e6, 2.381073068032339e6, 2.381454540616725e6, 2.385463434709314e6, 2.4107033030581404e6, 2.3883825077566784e6, 2.3992245851179813e6, 2.4153397559361043e6, 2.4098052862332095e6, 2.4264988579710866e6, 2.427839359400001e6, 2.4532885685983375e6], [0.0016459319014481277, 0.001224617967877698, 0.002151640539855209, 0.002754053033193182, 0.001699641706559376, 0.0026889768105918207, 0.002151082011084415, 0.002057972286657964, 0.0022182472203537166, 0.003197204556189501, 0.002068672574413688, 0.0024052948198060413, 0.003041071417767443, 0.002782238597196384, 0.003444102692906453, 0.0034456654726730163, 0.00445285048065099], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086172; 526.1217399118136 262.2500284494269 … 139.12280285142342 512.7384551397362; … ; 577.3380778236512 288.0211543975216 … 147.35858742764964 537.4582684322764; 588.2073503388793 295.5822561931196 … 150.60968087722893 549.1939702961307], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086172; 519.659952811919 259.02909359304573 … 137.4141071930435 506.44104052311644; … ; 567.1347670055209 282.93094906827537 … 144.7543152914469 527.959754519491; 573.4343153161709 288.15860359796505 … 146.82706563266188 535.4007700704434])])

Note that this will use the number of threads specified when activating the Julia environment. To discover the number of threads available, you can use the command

Threads.nthreads()
2

To activate Julia with a specific number of threads, say 8, you can use the command julia -t 8 in the terminal.

We can then plot the results of the monte-carlo repetitions using the function plot_data_vector

ps = Bit.plot_data_vector(data_vector)
-plot(ps..., layout = (3, 3))
Example block output +end

Note that we can equivalently run the model for a number of epochs in the single command data = BeforeIT.run_one_sim!(model), but writing the loop explicitely is more instructive.

We can then plot any time series stored in the data tracker, for example

plot(data.real_gdp, title = "gdp", titlefont = 10)
Example block output

Or we can plot multiple time series at once using the function plot_data

ps = Bit.plot_data(data, quantities = [:real_gdp, :real_household_consumption, :real_government_consumption, :real_capitalformation, :real_exports, :real_imports, :wages, :euribor, :gdp_deflator])
+plot(ps..., layout = (3, 3))
Example block output

To run multiple monte-carlo repetitions in parallel we can use

model = Bit.init_model(parameters, initial_conditions, T)
+data_vector = Bit.run_n_sims(model, 4)
BeforeIT.DataVector(BeforeIT.Data[BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72422.0, 72705.62082353122, 72379.91143773707, 72488.90055508539, 73480.12004349437, 73452.86648317498, 72982.39701809816, 73903.19678840564, 73755.32805527914, 74296.6218939196, 74249.67875481225, 73792.77342761359, 74003.72729072448, 75062.1676605223, 74868.99801567016, 74861.03076742637, 75280.72991034553], [72422.0, 72640.68215605937, 72150.93717172733, 72227.1733612857, 72895.52230761334, 73128.3411443115, 72416.40788102927, 72891.14604865517, 72994.76318674302, 73046.04752207162, 72894.21981294392, 72384.89335725504, 72597.79077628408, 73305.54477260372, 72996.89961031215, 72908.76305862867, 73511.08758626135], [64900.92049553802, 65157.53730872307, 64892.019169815714, 64980.68846161786, 65866.03419306928, 65833.93238704342, 65400.91866887064, 66220.49261737922, 66086.44984819069, 66570.27638900388, 66530.79240746703, 66118.1378456113, 66302.6672598323, 67252.29835413536, 67078.85074336638, 67096.23184492408, 67533.10532363369], [64900.92049553802, 65099.34038253426, 64686.7328940501, 64746.07029094623, 65342.01307772627, 65543.06859588677, 64893.72500254412, 65313.65094540199, 65404.9664439933, 65449.75328234378, 65316.24496442581, 64856.680873088546, 65043.03690987461, 65678.44390473697, 65401.544877944994, 65346.45889269476, 65945.58828441442], [40512.94792630534, 40644.33286693388, 40245.95255567117, 40381.580262541735, 40992.06463857702, 41048.33828552139, 40839.005841805236, 41351.751269746484, 41273.83664989322, 41552.84209013655, 41524.10859256763, 41293.48153501042, 41390.82557008998, 41975.47292711868, 41902.69046835276, 41721.726995821, 41524.62140912566], [40512.94792630534, 40608.030462982715, 40118.634253351505, 40235.77921434844, 40665.937406304925, 40866.980817396674, 40522.293393056585, 40785.4689939967, 40848.2208879773, 40853.41702785628, 40766.06862204104, 40505.65005790939, 40604.47500151372, 40993.152821357, 40854.91419132024, 40633.684531881925, 40548.492091242115], [14866.888022051655, 14925.377753390325, 14858.024906234727, 14788.259784262607, 14748.694326449122, 14940.379954647, 15017.987572150025, 15296.648429262768, 15337.287262755819, 15489.34823401028, 15475.144136611636, 15469.521195135892, 15637.18313280668, 15678.131085786687, 15642.19440763722, 15928.41861407321, 15836.178284725627], [14866.888022051655, 14912.046815123946, 14811.021459011832, 14734.865544525532, 14631.355741463938, 14874.371205095445, 14901.520887390923, 15087.171910907797, 15179.129171967375, 15228.628682511173, 15192.638907653842, 15174.380769088832, 15340.105032091065, 15311.227694058953, 15251.061522424718, 15513.028430506622, 15463.91341192525], [15944.236265986641, 16032.725731967934, 15981.004750101929, 15962.680259986442, 16400.745185879674, 16167.83474718982, 16296.800762514962, 16422.188939541233, 16263.369079686085, 16108.916283358025, 16331.577646207737, 16393.56311178925, 16364.003072082782, 16511.61128663106, 16250.388709901912, 15660.155483103694, 16412.875090323134], [15944.236265986641, 16018.405740842338, 15930.448749685958, 15905.045677616234, 16270.263111316466, 16096.402925652636, 16170.41669488465, 16197.298959312498, 16095.661234135248, 15837.768048772408, 16033.437865314289, 16080.79304345874, 16053.116711574554, 16125.202590925812, 15844.047933391344, 15251.761215071312, 16027.053666243773], [15944.236265986641, 16003.261978572036, 15913.179096445496, 15917.924957272262, 16149.822059381848, 16164.598631378107, 16047.8193590008, 16242.84673940854, 16214.981995622604, 16328.42935283335, 16316.480618247984, 16207.841835975238, 16229.79937207132, 16488.20762581043, 16442.187174377996, 16407.500962660983, 16456.564621892354], [15944.236265986641, 15988.968303663294, 15862.837662874854, 15860.451967638284, 16021.33629472592, 16093.18110746647, 15923.366178481336, 16020.412720683507, 16047.77311763384, 16053.586233985518, 16018.616439914531, 15898.615113025513, 15921.462638306592, 16102.346628200507, 16031.050479543257, 15979.617002433626, 16069.716177428407], [3173.2320350842083, 3181.7614776339437, 3149.972080997379, 3151.913286597715, 3199.9957107358578, 3215.2572117450995, 3189.736836805974, 3235.250242713672, 3225.8234596991065, 3246.1105389875934, 3242.728274277048, 3222.2691619342227, 3219.479002075842, 3286.815989542853, 3275.1181362882726, 3236.8801737068607, 3202.0813518843706], [3173.2320350842083, 3178.919615502377, 3140.007126207152, 3140.533041990827, 3174.536984672018, 3201.051742494777, 3164.999962251243, 3190.945834464719, 3192.5587714353933, 3191.4714107908967, 3183.530913303508, 3160.7920236766645, 3158.3147438390797, 3209.8971318072226, 3193.2238462241653, 3152.467007395977, 3126.809251146188], [34195.564496956766, 34810.802829630506, 35769.648783062745, 36237.30775675217, 36583.13108626386, 36262.87445173952, 36011.40822152916, 36076.51172572252, 35114.93740187635, 36220.22604011769, 36379.68000268403, 35864.68861652507, 35550.16704794557, 36890.51705412191, 36847.743324232535, 36438.0804859824, 35515.69579277263], [34195.564496956766, 34779.710774796615, 35656.49129346599, 36106.46994851665, 36292.08072336552, 36102.659851778204, 35732.1344966763, 35582.47003380264, 34752.83220279575, 35610.56054963302, 35715.5537278111, 35180.43217802233, 34874.77839149572, 36027.19630781067, 35926.3659404468, 35487.827902306984, 34680.81974256641], [33097.63671130043, 33707.618358391104, 34474.71955733303, 34880.927508457804, 35244.51519367551, 34966.560955922316, 35182.80537990134, 35243.903575867094, 34234.10233893169, 35074.71075370292, 35460.831623259415, 35228.481030847055, 34938.45153220079, 35993.564693135966, 35774.01889445455, 34887.35081155416, 34008.640666601874], [33097.63671130043, 33677.511637685806, 34365.65858378756, 34754.9870237214, 34964.114674837816, 34812.07365561101, 34909.957590979175, 34761.26384936417, 33881.080310132, 34484.3267867012, 34813.47930987695, 34556.36269122422, 34274.68436039125, 35151.23464154867, 34879.48997727126, 33977.53902113829, 33209.191325716565], [29576.147776884878, 29693.091215141816, 29567.21470244751, 29586.527593462193, 30025.135734366922, 30042.09370445437, 29813.25515676527, 30138.738059404695, 30087.954630113374, 30282.00712270505, 30274.368952251607, 30082.694805991712, 30110.90781863675, 30549.109008378906, 30508.666655830813, 30517.336038105448, 30667.32113559765], [34346.71094688275, 34482.517087061904, 34344.79061471612, 34407.966766790814, 34845.85800081238, 34792.13813378586, 34594.706116049885, 35070.569499437246, 34999.60673091254, 35281.97517434735, 35249.36221572373, 35034.243574830776, 35186.36430155494, 35675.85110780679, 35553.54664847891, 35557.044580166745, 35839.90936857264], [28335.329312139664, 28447.36658145893, 28333.745077642965, 28385.86410227035, 28747.11535389934, 28702.797569726205, 28539.920220335727, 28932.497713322544, 28873.954890454923, 29106.90304215583, 29079.998022811396, 28902.52957349442, 29028.026040786357, 29431.842577122057, 29330.943916497512, 29333.829638115505, 29567.18726419752], [978.0617717704337, 981.9290065192387, 980.013852652198, 986.1941013648342, 995.040457890071, 999.7005488032207, 992.9573960553404, 1011.1850585372322, 998.8884871647397, 1006.294091951469, 1007.0612394916318, 1001.1994647887752, 1005.3951396406679, 1027.3382379497236, 1016.6374390566294, 1021.8512266517712, 1025.874819463431], [0.0019383188997990075, 0.0019760209024990427, -0.0018352454429555465, 0.002044154682809829, 0.0015401729973802958, 0.0021303838109523188, 0.0031342681620059043, -0.0006580234658519757, -0.001530567538648775, -0.002183683491345012, 0.003928099540584817, 0.002263314218355017, 0.006665471090642638, 0.0033966225515351667, 0.005032599321467934, 0.003947761773559932, -0.0026961522414817862], [2.3548476e6, 2.372504846811841e6, 2.389586475293066e6, 2.397225591930019e6, 2.4207953242023876e6, 2.4070491943672085e6, 2.3900259930119785e6, 2.3796953480563406e6, 2.3681557395176487e6, 2.380164441817812e6, 2.3773139324294836e6, 2.36014172562176e6, 2.335217325916028e6, 2.369935797916113e6, 2.359416076514633e6, 2.34524375025757e6, 2.3466571179718855e6], [0.0016459319014481277, 0.0023069519487733544, 0.0028022203870667443, 0.002956113112975168, 0.0037396901281827972, 0.0029531948829949993, 0.0021108620340981104, 0.0015143371383568873, 0.000890135954455787, 0.0012728993832306795, 0.0011510079474399602, 0.00040724415831953356, 0.0, 0.001540296351045618, 0.0011051495051718893, 0.0005231057171914829, 0.0004817840483820261], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 520.1319295705457 259.26435457731566 … 137.538912394121 506.9010113164178; … ; 522.8950225608193 264.35173613286264 … 141.4419475893568 522.3266832682004; 528.9194946288251 264.8424461253309 … 141.43983838081 522.8185857017029], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 519.6673619892058 259.03278676290927 … 137.41606640786554 506.4482612285691; … ; 509.25867455476646 257.45782413450775 … 137.75334560088018 508.7051567311714; 516.4860561533576 258.6167306940973 … 138.11497789382474 510.52856276784667]), BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72422.0, 72726.72371664987, 73036.78164117207, 74174.62517366228, 74934.12290605856, 76391.94646282544, 78145.95083815511, 78471.83061304266, 79288.26932974494, 81322.88248414738, 81725.90382537815, 82848.06310426789, 83138.90893410926, 82851.91733738924, 82205.42208883124, 82978.71898138418, 83532.45549359568], [72422.0, 72291.2307728586, 71870.6649127546, 72548.13435656099, 73105.99273619957, 74025.10027998534, 75221.05980792148, 75343.61552602284, 75902.5356510082, 77247.93080494826, 76743.31125176225, 77348.13662982972, 77993.35704788004, 77845.81641527875, 77224.51692179713, 77787.7409789958, 78283.77587311839], [64900.92049553802, 65186.103860359435, 65496.96888430265, 66547.20544594257, 67241.25198286053, 68586.07930261656, 70173.8885447655, 70450.52932003525, 71301.06552159114, 73107.64701990716, 73437.77268469521, 74435.09771667326, 74716.34131172186, 74447.03673774701, 73838.19768228811, 74515.53328329447, 75034.39003203166], [64900.92049553802, 64795.764700093794, 64451.23399072721, 65087.967622924734, 65600.80092209256, 66461.0817405717, 67547.3803897072, 67642.07682203992, 68256.39799502045, 69444.34685289525, 68960.48355512513, 69493.67181943661, 70092.07072773603, 69948.77778082313, 69364.27064663867, 69853.99477247945, 70319.67799024015], [40512.94792630534, 40602.763766080985, 40525.98824546849, 40909.378057102214, 41267.19042930053, 41843.295383537334, 42759.9671729228, 43113.479437952235, 42996.50887381319, 44164.64303139106, 44636.764598668546, 45300.61615642155, 45390.05979791868, 45332.23686604411, 45174.14121073341, 45652.69039300627, 45842.5659749958], [40512.94792630534, 40359.6314453202, 39878.94395125429, 40012.32293093984, 40260.4155058962, 40546.86757220815, 41159.52283645051, 41394.795984564065, 41160.49038844613, 41951.627693216346, 41915.38984000236, 42293.303145452315, 42580.82269337189, 42593.1602089246, 42436.99677846314, 42796.75197302288, 42962.093464502], [14866.888022051655, 14949.846032355883, 15157.620250188897, 15538.735315166196, 15619.610540932896, 15803.476898235343, 15647.966381866818, 15588.870357400887, 15546.100999710872, 15659.726840392284, 15479.503286306433, 15731.873111626595, 15554.997351586815, 15541.908695676657, 15654.59114329163, 15807.33246294769, 15811.099355514956], [14866.888022051655, 14860.325260277315, 14915.611304291138, 15198.004098253194, 15238.546745642674, 15313.838910147259, 15062.2854090099, 14967.432842044756, 14882.258060866217, 14875.044494725362, 14535.762629948425, 14687.50173857176, 14592.282697414701, 14602.831291638428, 14706.06448979219, 14818.458254007332, 14817.624490275348], [15944.236265986641, 16029.924016463356, 16065.838373729637, 16247.012494301054, 16492.182773957706, 16829.863192288092, 17592.289426456176, 17438.616187248066, 19061.584350786634, 19481.670296865184, 19082.937303162675, 19229.954108803995, 20190.00342914694, 19595.149280256832, 19012.80434994523, 19436.843081041865, 19460.324926124365], [15944.236265986641, 15933.935658375345, 15809.328674607073, 15890.750274364747, 16089.83127204319, 16308.42475147322, 16933.835226426236, 16743.44007337989, 18247.62474929578, 18505.476848418613, 17919.505670853334, 17953.3601880489, 18940.423520536922, 18411.165879108437, 17860.800345585063, 18220.914152418634, 18237.55456406495], [15944.236265986641, 16007.081011192326, 16062.22773467794, 16274.053246846526, 16404.067388589916, 16757.887297728663, 17162.456170581972, 17280.84832719507, 18626.674476899392, 19248.401162687158, 17964.831912085385, 19719.38880537188, 19689.86921226307, 19699.190824182562, 18097.812253661017, 19798.157635966534, 19866.13710849227], [15944.236265986641, 15911.22943869154, 15805.77568358564, 15917.198081066546, 16003.865593486826, 16238.678880878126, 16520.090013772675, 16591.961499510347, 17831.286210357357, 18283.89643481944, 16869.567939689663, 18410.30342079373, 18471.243120536725, 18508.92099677244, 17001.248495751417, 18559.625611880027, 18617.867937392108], [3173.2320350842083, 3179.959271772144, 3173.613418743656, 3177.553741180794, 3165.1554972073263, 3244.300110699246, 3317.3996385661694, 3360.5846848888345, 2931.681363899135, 3384.9305615328544, 3486.6175865688915, 3540.687843004326, 3547.279622495377, 3544.509858470953, 3529.033123733842, 3567.3626614429722, 3584.427989161268], [3173.2320350842083, 3160.917442941846, 3122.943008383719, 3107.8767867131887, 3087.93678786187, 3143.7821937126296, 3193.234120807761, 3226.6177361079854, 2806.493963379668, 3215.317433538043, 3274.0485713519306, 3305.6368101159337, 3327.7348679812244, 3330.3425266678337, 3315.205630680574, 3344.1957901124256, 3359.2039845919103], [34195.564496956766, 33872.637730431044, 33289.46129683203, 33556.18228938442, 33847.338270095315, 33392.85554268741, 34438.19001340117, 35659.798461955754, 35283.13978124888, 35950.929548251086, 36320.83174959663, 37677.4788785884, 36886.94879651094, 36772.666062649216, 36672.557381753984, 36891.32317284214, 37333.31966051469], [34195.564496956766, 33669.80589688555, 32757.956528604984, 32820.36701262526, 33021.58175408785, 32358.247101157485, 33149.21787873108, 34238.24987977918, 33776.49427544091, 34149.489458372664, 34106.45542492767, 35176.23315467044, 34603.977906099644, 34550.77810397891, 34450.53204681016, 34583.47786720198, 34987.5172665945], [33097.63671130043, 32728.447828681743, 32002.126525047686, 32076.682982291433, 32292.19910822823, 31477.54455392271, 32292.462156491754, 33328.933831514434, 33599.0646758152, 33934.087232752216, 33794.13311235607, 35091.85915117256, 34883.10044105388, 34390.0435672376, 34308.67199689322, 34809.470128453606, 34914.85442355421], [33097.63671130043, 32532.46748800028, 31491.17554600355, 31373.30995962202, 31504.382541470615, 30502.278055000766, 31083.801542696197, 32000.303253745107, 32164.331823041415, 32233.70768978472, 31733.802313969423, 32762.261596913657, 32724.149769542884, 32312.119068371736, 32229.87673885364, 32631.86126765482, 32721.013912318533], [29576.147776884878, 29706.10934410252, 29831.16652006497, 30269.777696553294, 30582.306560906683, 31227.531017024696, 31974.87944684919, 32187.560967363966, 32596.648551127342, 33401.388999100884, 33590.47123682162, 34115.6232104767, 34230.48268413442, 34125.48258777391, 33857.47357557312, 34166.91839832718, 34382.23350412461], [34346.71094688275, 34497.6350096479, 34679.016312017826, 35279.44396559105, 35653.78549573499, 36335.11036309484, 37159.481249919685, 37222.82200053074, 37651.06653582703, 38622.292529882376, 38761.0490680856, 39219.33091807162, 39383.179347426085, 39223.75987663997, 38894.8223140529, 39255.03489974251, 39548.20697763546], [28335.329312139664, 28459.838556305433, 28609.474396012618, 29104.814847050955, 29413.63890150679, 29975.717888197756, 30655.80689554541, 30708.061710576112, 31061.35463438796, 31862.596081367512, 31977.067368306194, 32355.140458251037, 32490.31203873267, 32358.794257875066, 32087.427541759178, 32384.595507963484, 32626.45643563915], [978.0617717704337, 982.3595066091244, 986.7860522198481, 997.983783798327, 1005.1599262187806, 1023.4379224970752, 1039.5278479966712, 1040.1463521404257, 1053.350434636769, 1083.9654909239312, 1086.2523797879876, 1100.1435881249847, 1102.6792801613158, 1097.794273333185, 1085.9017926620834, 1093.5799852247692, 1103.9495502716304], [0.0019383188997990075, 0.004559949240877881, 0.006919555573772884, 0.006560176064074996, 0.004180834904259578, 0.0036963737504611682, 0.0014749045727358023, -0.00015807265786538238, 0.006869138045157319, 0.006457817733342086, 0.006518271006086485, 0.0023082479313993876, 0.0005065705807745235, 0.0035499155156475393, 0.0034592076459738497, 0.0030705338435843554, 0.0034568215030443827], [2.3548476e6, 2.351543045677174e6, 2.3270582817337764e6, 2.3253059420288145e6, 2.3457857309163325e6, 2.3386033591338582e6, 2.356958236684844e6, 2.3838813662934927e6, 2.4034925807977957e6, 2.4033763441814203e6, 2.410882961622167e6, 2.438343718309395e6, 2.414902153084729e6, 2.417378627364133e6, 2.42294528918969e6, 2.4241839718491277e6, 2.4338860150498776e6], [0.0016459319014481277, 0.0014906919170246012, 0.0005149771437655743, 0.0005533271481569195, 0.0014745950695766396, 0.0011490903662589075, 0.0018698583141921825, 0.0028513479272078866, 0.0036070536707776806, 0.0034834495379360017, 0.0036823541095505163, 0.004583059797502744, 0.003309781034924626, 0.003247078910816189, 0.003312569547828168, 0.0031880768901684686, 0.0034250358423354612], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 520.3599672809579 259.3780219883086 … 137.59921259276615 507.1232482902585; … ; 626.6852911026845 310.6840130483292 … 158.29007635430563 570.3253156762729; 629.2657114911998 309.5619821811689 … 157.83408352719817 571.5624121904776], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 517.2440137166894 257.824847411236 … 136.77525843818512 504.08655716797693; … ; 587.4811481553324 291.24826015620044 … 148.38777472277647 534.6469368795974; 589.726419891873 290.11095973069837 … 147.91673424384763 535.6488506057228]), BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72422.0, 72251.70366805026, 72234.56753912597, 73345.12713154189, 73488.31535650713, 74048.47104158929, 74206.09776477393, 74393.25834497562, 75045.9550693026, 75569.52288778606, 76849.99842295384, 78743.59818716744, 80172.5642325506, 82105.60930835399, 82927.07239485034, 84344.88788445681, 83482.8974958576], [72422.0, 72144.4570989933, 71688.32969853858, 72534.13140958776, 72645.19494545141, 73372.16449948623, 73162.69476518175, 73557.66261578501, 74445.39280482489, 75206.2934271268, 76230.84594063488, 77128.87849148302, 77869.70537154004, 78195.22259565284, 78450.9469959959, 79346.13863890398, 78569.31801882008], [64900.92049553802, 64759.67607079595, 64745.14691456675, 65739.88433957838, 65897.47590747116, 66439.71396140671, 66599.40297718588, 66822.48644894952, 67432.31134517748, 67986.98496525019, 69136.59141256403, 70832.72062026164, 72120.85574133434, 73862.61503705008, 74571.9263800619, 75833.19714392064, 75045.09713664769], [64900.92049553802, 64663.550267261366, 64255.54407697837, 65012.981721146214, 65141.444057984474, 65832.90044351088, 65662.95679647279, 66071.9267136612, 66892.67797569037, 67660.20142954565, 68579.58304469693, 69380.22172869982, 70049.27235994407, 70344.81167575339, 70546.78375689089, 71338.89824188978, 70628.1439617628], [40512.94792630534, 40345.44076782202, 40358.67662142684, 40888.563595674794, 40753.832902873415, 40814.131960660976, 40743.05709715637, 40465.7080051248, 40700.434062711174, 40617.55123798219, 41196.35518253153, 42247.3596275877, 43005.487631591895, 44083.7703806875, 44738.798791384506, 45603.24355443916, 45170.885569850434], [40512.94792630534, 40285.55415090126, 40053.48428598841, 40436.44835026161, 40286.27029536941, 40441.36444680171, 40170.17388043629, 40011.19137902196, 40374.72503784294, 40422.320532987855, 40864.45113442243, 41381.03340867167, 41770.207592684514, 41984.223329096836, 42323.94839571575, 42900.54058061112, 42512.24837644632], [14866.888022051655, 14774.470013773702, 14881.577800358415, 15432.643100859203, 15501.88953730094, 15597.856942245142, 15666.433077512942, 15609.077396231145, 15686.579001659667, 15798.307501588492, 15984.402215171496, 16056.526400427887, 16275.497658881008, 16411.58966057881, 16475.0792477418, 16790.696411125136, 17032.940266795158], [14866.888022051655, 14752.539579774624, 14769.043300614956, 15262.000441657125, 15324.038685564527, 15455.397110942165, 15446.149249655507, 15433.754004044007, 15561.04568812604, 15722.371985604736, 15855.621701014039, 15727.27056223997, 15808.003892654515, 15629.966301546005, 15585.809693912284, 15795.585941212641, 16030.427078597724], [15944.236265986641, 15947.028649487374, 16067.80395501113, 16129.653026362368, 15927.266976304456, 16292.733465377507, 16188.974163326215, 16274.34098171539, 16387.180244727933, 17882.848899477573, 18177.758086680762, 18854.57368377496, 18909.47005392836, 19580.269216442215, 19677.17738632059, 19880.983509708425, 19046.061714911568], [15944.236265986641, 15923.35773209047, 15946.299212415233, 15951.303351168217, 15744.535833062027, 16143.927121689625, 15961.34294822204, 16091.545253685139, 16256.040304312888, 17796.89390978613, 18031.306502122246, 18467.94096464825, 18366.318651855298, 18647.733361461393, 18615.06930830596, 18702.725362562116, 17925.061596708627], [15944.236265986641, 15899.55174698221, 15890.867076274786, 16110.052889186632, 16126.649201526323, 16246.035849714672, 16280.73675009562, 16275.962042890442, 16388.288584551698, 17768.530971009674, 18253.023201000346, 18659.9234560031, 18948.801348875048, 19362.726367759547, 19582.455356867067, 19795.25663011335, 18289.19320010225], [15944.236265986641, 15875.95130176305, 15770.700330455971, 15931.91993769344, 15941.630575942372, 16097.656009133863, 16051.81527231534, 16093.148106868972, 16257.139774543699, 17683.125457322767, 18105.965232794217, 18277.282243027854, 18404.520203454624, 18440.55127463285, 18525.460056496984, 18622.079136761808, 17212.74033304578], [3173.2320350842083, 3156.341161103601, 3145.5569165018464, 3177.5641204974763, 3171.3522988754607, 3168.9287529561643, 3163.860492444782, 3112.1713471684952, 3104.363370013746, 2671.2361649030463, 3056.0757498563653, 3225.1014626882725, 3341.5097553742407, 3406.0894675917907, 3478.970249149587, 3561.265046277322, 3526.7470102567145], [3173.2320350842083, 3151.656056903748, 3121.770213320107, 3142.428985980136, 3134.967849989145, 3139.9859913172477, 3119.3738312734504, 3077.2149930033884, 3079.5204122082846, 2658.396707481674, 3031.4540592186577, 3158.967389922058, 3245.528974130967, 3243.8700150045584, 3291.1870965027492, 3350.2045847627014, 3319.1721386351232], [34195.564496956766, 33844.01228311545, 32968.32865183797, 34051.81295884632, 33220.69606688902, 32085.92485591915, 32563.926002262586, 33796.08609304223, 33854.74276070672, 33489.66821708516, 34636.608490250284, 35858.05351366596, 36513.71976968615, 36490.09619706308, 38075.11277513411, 38621.554098665016, 39753.45394872156], [34195.564496956766, 33793.776039314725, 32719.022131925623, 33675.29340377243, 32839.56000753599, 31792.874633757274, 32106.048562365904, 33416.48361519743, 33583.81701984692, 33328.698110892896, 34357.553935065785, 35122.74668758217, 35464.90782354238, 34752.207780958684, 36019.9458141501, 36332.62504492973, 37413.67225303366], [33097.63671130043, 32659.248046148583, 32041.81948950878, 33157.54555020093, 31915.370126860616, 30742.176182613523, 30956.29257548443, 31751.954131137387, 31582.981000503, 32218.852968347815, 33145.12555167998, 34272.91503828931, 34531.610881536406, 34460.11614641727, 36039.09580573064, 36551.58968948061, 37520.44400442103], [33097.63671130043, 32610.77040308812, 31799.519232405997, 32790.91413727173, 31549.209876080426, 30461.39881370459, 30521.019875498238, 31395.31163616291, 31330.23524530403, 32063.991112145177, 32878.08733198936, 33570.113131659324, 33539.73258919624, 32818.90817740976, 34093.82621608819, 34385.33829041131, 35312.09128596623], [29576.147776884878, 29511.78095516743, 29518.65241335741, 29894.71107134556, 29948.878553308066, 30211.63862742545, 30269.4961583225, 30385.031426022957, 30677.949713859532, 30910.797211001212, 31409.1383229012, 32166.214661402966, 32792.16220204917, 33596.04518985131, 33964.369380475706, 34555.49272051139, 34196.14288481178], [34346.71094688275, 34271.961908002624, 34253.06751582634, 34856.6999908851, 34953.47859927511, 35230.29221790559, 35332.1215495574, 35436.74870156787, 35750.22745571112, 36066.16805767543, 36695.56250870669, 37604.57487449186, 38243.166094307395, 39154.86246038379, 39487.858329044335, 40137.066311366274, 39721.23694762853], [28335.329312139664, 28273.66289419036, 28258.075409691606, 28756.059772466357, 28835.900131659484, 29064.26566727394, 29148.272769160674, 29234.588015234538, 29493.201532690262, 29753.846023907452, 30273.08348640523, 31022.999971077184, 31549.824578455096, 32301.955308102155, 32576.67004316575, 33112.25326100604, 32769.202598094285], [978.0617717704337, 975.9332076258702, 973.4269853829624, 988.4732773476607, 995.1187548879878, 997.7831160756906, 997.7852693059524, 1000.7063213586418, 1004.1341756068181, 1010.0196965734932, 1031.8905809561093, 1061.9310843668231, 1085.5274449777892, 1111.7073868150032, 1119.6986705418622, 1140.6381120429971, 1127.7173042074494], [0.0019383188997990075, -0.003633882894030771, 0.0043226587216909085, 0.004274837161295286, 0.004972019117970516, 0.00492064280418214, 0.002334611375924167, 0.004438764003921403, 0.005317652643080706, 0.009313722514974865, 0.008045004420508706, 0.007947235068632708, 0.00433398024338727, 0.007212132015357531, 0.0057335070788890885, 0.004082474764521393, 0.0012614443656289165], [2.3548476e6, 2.3586821681268746e6, 2.3259835952804177e6, 2.3644776210508444e6, 2.3539143831565953e6, 2.3361165004106946e6, 2.3433448980354923e6, 2.374966064341885e6, 2.369528687015088e6, 2.3910190819801204e6, 2.4175285775958784e6, 2.434817920283994e6, 2.4403530287874835e6, 2.4254475687275515e6, 2.434112567586815e6, 2.461350660473918e6, 2.4966555697618383e6], [0.0016459319014481277, 0.001600854481056932, 0.00021796431298404424, 0.0019277412032162168, 0.0014597023026245554, 0.0007208583073011438, 0.0010254103333037616, 0.0023786286758740883, 0.002099370397461976, 0.0030497524900002697, 0.004099114246798815, 0.00468145411680197, 0.004657930796472506, 0.003877820086811578, 0.004073699976944507, 0.004966458587776321, 0.006038570337541099], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 516.9559296489443 257.68124936304486 … 136.69908013206071 503.80580127320746; … ; 606.8708317023218 305.9864246106343 … 158.7294718422229 570.129903668333; 601.6322905602548 303.34436288167535 … 157.2521256014954 564.4790328662872], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 516.1885878840596 257.2987610824713 … 136.49617132032162 503.05797885637156; … ; 570.9042759547386 287.8519597066424 … 149.32227660467336 536.3408205678456; 566.2218272882208 285.4903271373553 … 147.99668717933966 531.2553107111302]), BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72422.0, 72967.06149304994, 72829.53922609493, 72587.08533224667, 73997.07940476925, 74403.94828033452, 74371.34706600914, 74563.76710652435, 74767.00845855626, 75215.94297090342, 75134.11889681006, 76623.37565228408, 77437.43201050363, 77055.40033533175, 77482.0010764979, 76330.04242419676, 77179.4415862701], [72422.0, 72844.00395556036, 72665.86157412115, 72009.99503289897, 72781.76764559282, 72917.80870481969, 72914.39540077257, 73037.53038953045, 72988.98928733187, 73142.13939159927, 73049.05949538929, 73689.31954439881, 74524.76529061928, 73878.33830720176, 74211.88932902762, 73207.12405486706, 73785.60523041562], [64900.92049553802, 65396.67157550652, 65267.423486902815, 65043.53953938754, 66310.9126481616, 66669.52643626298, 66633.21428776234, 66804.69771157409, 66972.69676169404, 67371.21792718678, 67301.33367061907, 68669.58011093231, 69436.3927149362, 69071.55080907348, 69459.5169449726, 68425.41610384695, 69187.66812261422], [64900.92049553802, 65286.381354146, 65120.740990484046, 64526.42281632849, 65221.83680150276, 65337.87369460396, 65327.85440997964, 65437.280446169316, 65380.03254727794, 65513.70385023735, 65433.64319179938, 66040.09009910206, 66824.67038687419, 66223.66992928347, 66527.99247245528, 65625.90254282746, 66145.25658626159], [40512.94792630534, 40782.84242626552, 40780.74779615747, 40689.00742372378, 41455.22510924109, 41717.48884103186, 41751.97401163582, 41898.25319521704, 42111.37830485587, 42363.5807867578, 42260.86951068254, 42860.1401524111, 43066.161857865816, 43052.99656838136, 43228.19670595167, 42575.86196519554, 43023.75011359148], [40512.94792630534, 40714.06295155308, 40689.096838099234, 40365.51693823534, 40774.373608616545, 40884.22645925399, 40934.04331032455, 41040.64292569975, 41109.93609797368, 41195.56052406288, 41088.08110803299, 41218.9431295904, 41446.30731026746, 41277.88359772172, 41403.759650815235, 40833.940472708564, 41131.85294124032], [14866.888022051655, 14728.484430987002, 14690.568955088089, 14740.13192836601, 15006.980729676874, 15026.696964196404, 14999.866159193933, 14956.158473118014, 14968.132091546373, 15140.575276110096, 15401.788510364235, 15640.17844547418, 15683.394121507676, 15768.397554827883, 15864.25409720264, 15674.381366098625, 15886.475231778266], [14866.888022051655, 14703.645126951122, 14657.553260381246, 14622.94321486374, 14760.509378412475, 14726.55470610523, 14706.015357223572, 14650.022676971306, 14612.177956629488, 14723.129479911424, 14974.370921607553, 15041.285996457, 15093.49206863036, 15118.252634447372, 15194.706551097115, 15033.089786250768, 15187.894157597737], [15944.236265986641, 16303.94513481021, 16144.15449208621, 16045.801299956483, 16455.611413893457, 16749.206745557996, 16467.86465641442, 16999.062776352435, 16628.005339974065, 16307.335271639298, 15808.930470114574, 16518.323857086158, 17076.732709722764, 16928.23770102948, 17017.51444851139, 16640.927512462527, 17002.850787131403], [15944.236265986641, 16276.448846778314, 16107.871998355691, 15918.23210175708, 16185.34807084514, 16414.6591902419, 16145.255428794044, 16651.111019479846, 16232.578093609336, 15857.720350660096, 15370.21421727087, 15885.805534938005, 16434.42278599981, 16230.271549805162, 16299.293789033614, 15960.091283883703, 16255.178972351125], [15944.236265986641, 16063.309315571176, 16047.381831728038, 15993.91412830657, 16299.697700900624, 16398.593286105697, 16391.447838634125, 16439.354471062616, 16493.322531125355, 16597.85447169348, 16560.031680350676, 16867.424286125715, 17052.191891260023, 16962.591971953465, 17049.067204355928, 16792.97110527559, 16964.627257789514], [15944.236265986641, 16036.218855192763, 16011.316825599268, 15866.75744954203, 16031.995050386948, 16071.04886099765, 16070.335633917182, 16102.859315693531, 16101.098149514808, 16140.229549999909, 16100.471493182376, 16221.538238562578, 16410.805025331723, 16263.20936387886, 16329.514867377333, 16105.91426271759, 16218.636258532948], [3173.2320350842083, 3194.7527064988953, 3193.1188282791613, 3183.9457943836946, 3247.533034013222, 3267.579349062264, 3270.280447197481, 3281.727506493911, 3298.23357471697, 3318.185384039448, 3308.7730584225524, 3361.111550854038, 3379.184160885605, 3351.330785549361, 3359.348712815206, 3306.7153284297974, 3333.085432300552], [3173.2320350842083, 3189.3648178693497, 3185.94258910698, 3158.6324177247816, 3194.1962656394135, 3202.312933784415, 3206.214906753446, 3214.554223679158, 3219.798946290273, 3226.6986000623087, 3216.950748213425, 3232.408138988977, 3252.0823576590133, 3213.1524653260326, 3217.5680987758246, 3171.426499636699, 3186.5185968218825], [34195.564496956766, 34323.96413627895, 34477.37805174122, 34610.19434572471, 34455.130413643135, 35017.236357634894, 35286.5544386229, 34342.60589362775, 34944.95537099587, 36561.6999336776, 37123.30862075496, 36315.50636578915, 35983.793542554035, 35207.22902097098, 35250.88660572437, 35038.232389558674, 35692.599598803616], [34195.564496956766, 34266.077434840496, 34399.893334060886, 34335.03234791153, 33889.246928882756, 34317.804378835106, 34595.282782561866, 33639.65125351113, 34113.93642469617, 35553.64524217107, 36093.09352289955, 34924.91593099783, 34630.329265841414, 33755.603957037376, 33763.130264941334, 33604.70063609663, 34123.077460994784], [33097.63671130043, 33172.174635291434, 33263.31006897805, 33498.04966552401, 33375.86826168492, 34106.680628086746, 34134.91219985789, 33632.31323179096, 33885.46264881558, 35157.24829728153, 35460.77821510568, 34710.773168476415, 34372.6502211464, 33901.46050987795, 33878.85078089209, 33599.36080911875, 34426.23414503445], [33097.63671130043, 33116.230404562346, 33188.55385677594, 33231.72956986846, 32827.71034116382, 33425.43602961645, 33466.20147813135, 32943.89748613172, 33079.63928557646, 34187.91620520639, 34476.70027442128, 33381.63104758433, 33079.786140119366, 32503.67343180994, 32449.000926859488, 32224.698124072645, 32912.398301768124], [29576.147776884878, 29802.067641961414, 29786.939772797734, 29689.396181154036, 30248.194321114355, 30420.301864018784, 30417.764621024377, 30498.694258329317, 30594.0747210981, 30780.59135031591, 30734.884067099316, 31309.353324267777, 31670.07002798206, 31520.678668495013, 31682.864669256585, 31197.829611731286, 31525.406013423195], [34346.71094688275, 34609.07115557123, 34499.165295007915, 34376.703537654714, 35063.844392102896, 35248.11345772267, 35215.484597712064, 35303.91145732868, 35374.31794362653, 35577.62813135867, 35556.7150629078, 36327.62892228401, 36723.800637348264, 36515.6462931246, 36738.883328510165, 36205.297899313766, 36627.40577299099], [28335.329312139664, 28551.771082156203, 28461.101010217968, 28360.07258196139, 28926.949638245627, 29078.96782317319, 29052.049685511905, 29125.000023934415, 29183.083925419058, 29350.810644021385, 29333.55779316183, 29969.5458535761, 30296.3793610948, 30124.656313131014, 30308.82227074186, 29868.625278493568, 30216.85558282717], [978.0617717704337, 985.532777973873, 981.3184190972321, 977.4398205787926, 998.8739349444937, 1001.1111145214413, 999.9650690259082, 1002.0919959161502, 1004.3040969693907, 1012.9984455121911, 1009.7345406121399, 1032.5978643805784, 1042.522049605794, 1035.2258474538783, 1037.7689472058435, 1022.2885928018299, 1034.85633619996], [0.0019383188997990075, -0.00044604598674891083, 0.005168655105243669, 0.010964943156015483, 0.008422556846757079, 0.006624603907801063, 0.00214344960522439, 0.0024801768374456135, 0.003864439129886099, 0.006808425935994844, 0.01058285750657828, 0.00705525606828572, 0.002449083441797617, 0.0033908204531143404, -0.0003838636576761756, -0.00024435233585085037, 0.0020382531629303813], [2.3548476e6, 2.362879270711679e6, 2.3710762383463797e6, 2.3629271167465947e6, 2.3394840549498973e6, 2.3559017744565615e6, 2.362547838105314e6, 2.3595744527825317e6, 2.380517639230825e6, 2.396051669376409e6, 2.3987983566223406e6, 2.38457273420895e6, 2.3927132603470464e6, 2.3729028625598033e6, 2.368915261535302e6, 2.3712183495349702e6, 2.3744825037183645e6], [0.0016459319014481277, 0.001849318376733881, 0.00217223438675116, 0.0019249889695026284, 0.0009999090626799417, 0.0017681614700476183, 0.001963922928515428, 0.0017516518111409902, 0.0025836789798444025, 0.003190487233581325, 0.003309895023592931, 0.0026434523167432724, 0.0028397349593036114, 0.0018929450636242023, 0.0015787042016964848, 0.0015518470700746677, 0.001619132436113542], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 522.0408624852336 260.21587905009 … 138.04369308915767 508.7613855214562; … ; 554.2158292349023 274.71529796068654 … 143.9415059615598 531.139093800644; 558.7330361885581 276.35617852515344 … 145.15070708148437 536.7865720540233], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 521.1604506707532 259.77703000455693 … 137.810885071541 507.90336928795386; … ; 531.5409984772793 263.47577256425757 … 138.05237556414477 509.4084097865959; 534.1636890611361 264.20387958949345 … 138.76794845242023 513.1822838377749])])

Note that this will use the number of threads specified when activating the Julia environment. To discover the number of threads available, you can use the command

Threads.nthreads()
2

To activate Julia with a specific number of threads, say 8, you can use the command julia -t 8 in the terminal.

We can then plot the results of the monte-carlo repetitions using the function plot_data_vector

ps = Bit.plot_data_vector(data_vector)
+plot(ps..., layout = (3, 3))
Example block output diff --git a/dev/examples/change_expectations-ee7f7e29.svg b/dev/examples/change_expectations-aa540a9f.svg similarity index 86% rename from dev/examples/change_expectations-ee7f7e29.svg rename to dev/examples/change_expectations-aa540a9f.svg index fbdb553..e721351 100644 --- a/dev/examples/change_expectations-ee7f7e29.svg +++ b/dev/examples/change_expectations-aa540a9f.svg @@ -1,82 +1,82 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/examples/change_expectations-f9f023d7.svg b/dev/examples/change_expectations-daa1e8be.svg similarity index 85% rename from dev/examples/change_expectations-f9f023d7.svg rename to dev/examples/change_expectations-daa1e8be.svg index 23bb2ba..9a81f02 100644 --- a/dev/examples/change_expectations-f9f023d7.svg +++ b/dev/examples/change_expectations-daa1e8be.svg @@ -1,284 +1,284 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/examples/change_expectations.html b/dev/examples/change_expectations.html index 9bcdd01..a14cad9 100644 --- a/dev/examples/change_expectations.html +++ b/dev/examples/change_expectations.html @@ -35,7 +35,7 @@ p2 = plot(data.real_household_consumption, title = "consumption", titlefont = 10) plot!(p2, data_back.real_household_consumption, titlefont = 10, label = "backward looking") -plot(p1, p2, layout = (2, 1), legend = true)Example block output

Plot all time series

p1 = plot(data.real_gdp, title = "gdp", titlefont = 10)
+plot(p1, p2, layout = (2, 1), legend = true)
Example block output

Plot all time series

p1 = plot(data.real_gdp, title = "gdp", titlefont = 10)
 plot!(p1, data_back.real_gdp, titlefont = 10)
 p2 = plot(data.real_household_consumption, title = "household cons.", titlefont = 10)
 plot!(p2, data_back.real_household_consumption, titlefont = 10)
@@ -54,4 +54,4 @@
 p9 = plot(data.nominal_gdp ./ data.real_gdp, title = "gdp deflator", titlefont = 10)
 plot!(p9, data_back.nominal_gdp ./ data_back.real_gdp, titlefont = 10)
 
-plot(p1, p2, p3, p4, p5, p6, p7, p8, p9, layout = (3, 3), legend = false)
Example block output

Note that, importantly, once the function estimate_next_value has been changed, the model will use the new expectations in all the simulations, unless the function is changed again. To restore the original expectations you could close the Julia session.

+plot(p1, p2, p3, p4, p5, p6, p7, p8, p9, layout = (3, 3), legend = false)Example block output

Note that, importantly, once the function estimate_next_value has been changed, the model will use the new expectations in all the simulations, unless the function is changed again. To restore the original expectations you could close the Julia session.

diff --git a/dev/examples/get_parameters_and_initial_conditions.html b/dev/examples/get_parameters_and_initial_conditions.html index 4ad3eb8..e029a2a 100644 --- a/dev/examples/get_parameters_and_initial_conditions.html +++ b/dev/examples/get_parameters_and_initial_conditions.html @@ -31,4 +31,4 @@ ".jld2", init_conds, ) -end +end diff --git a/dev/examples/multithreading_speedup.html b/dev/examples/multithreading_speedup.html index 539c115..75cf4b9 100644 --- a/dev/examples/multithreading_speedup.html +++ b/dev/examples/multithreading_speedup.html @@ -7,5 +7,5 @@ @time data = Bit.run_one_sim!(model; multi_threading = false); model = Bit.init_model(parameters, initial_conditions, T); -@time data = Bit.run_one_sim!(model; multi_threading = true);
  5.257994 seconds (3.52 M allocations: 6.415 GiB, 18.29% gc time)
-  2.779143 seconds (3.43 M allocations: 6.257 GiB, 14.86% gc time)

Is the speedup in line to what we would expect? Yes!

+@time data = Bit.run_one_sim!(model; multi_threading = true);
  5.274227 seconds (3.52 M allocations: 6.415 GiB, 17.90% gc time)
+  2.776573 seconds (3.43 M allocations: 6.257 GiB, 14.42% gc time)

Is the speedup in line to what we would expect? Yes!

diff --git a/dev/examples/scenario_analysis_via_overload-5466a8b9.svg b/dev/examples/scenario_analysis_via_overload-5cec78a5.svg similarity index 86% rename from dev/examples/scenario_analysis_via_overload-5466a8b9.svg rename to dev/examples/scenario_analysis_via_overload-5cec78a5.svg index e35f382..73aaf84 100644 --- a/dev/examples/scenario_analysis_via_overload-5466a8b9.svg +++ b/dev/examples/scenario_analysis_via_overload-5cec78a5.svg @@ -1,48 +1,48 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/examples/scenario_analysis_via_overload.html b/dev/examples/scenario_analysis_via_overload.html index 5b89362..56046cd 100644 --- a/dev/examples/scenario_analysis_via_overload.html +++ b/dev/examples/scenario_analysis_via_overload.html @@ -56,4 +56,4 @@ titlefont = 10, xlabel = "quarters", ylabel = "GDP", -)Example block output

Note that, importantly, once the function central_bank_rate has been changed, the model will use the new interest rate in all the simulations, unless the function is changed again. To restore the original interest rate, you could close and restart the Julia session.

+)Example block output

Note that, importantly, once the function central_bank_rate has been changed, the model will use the new interest rate in all the simulations, unless the function is changed again. To restore the original interest rate, you could close and restart the Julia session.

diff --git a/dev/examples/scenario_analysis_via_shock-f9751c5e.svg b/dev/examples/scenario_analysis_via_shock-1a271efb.svg similarity index 86% rename from dev/examples/scenario_analysis_via_shock-f9751c5e.svg rename to dev/examples/scenario_analysis_via_shock-1a271efb.svg index fe0a367..d35d2e7 100644 --- a/dev/examples/scenario_analysis_via_shock-f9751c5e.svg +++ b/dev/examples/scenario_analysis_via_shock-1a271efb.svg @@ -1,52 +1,52 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/examples/scenario_analysis_via_shock.html b/dev/examples/scenario_analysis_via_shock.html index 6a54d0e..08b452a 100644 --- a/dev/examples/scenario_analysis_via_shock.html +++ b/dev/examples/scenario_analysis_via_shock.html @@ -50,4 +50,4 @@ titlefont = 10, xlabel = "quarters", ylabel = "GDP", -)Example block output

Note that, importantly, once the function central_bank_rate has been changed, the model will use the new interest rate in all the simulations, unless the function is changed again. To restore the original interest rate, we can simply re-import the function central_bank_rate.

+)Example block output

Note that, importantly, once the function central_bank_rate has been changed, the model will use the new interest rate in all the simulations, unless the function is changed again. To restore the original interest rate, we can simply re-import the function central_bank_rate.

diff --git a/dev/index.html b/dev/index.html index dc132a0..73d2cb9 100644 --- a/dev/index.html +++ b/dev/index.html @@ -32,7 +32,7 @@ [79e6a3ab] Adapt v4.1.1 [66dad0bd] AliasTables v1.1.3 [7d9fca2a] Arpack v0.5.4 - [4c555306] ArrayLayouts v1.10.4 + [4c555306] ArrayLayouts v1.11.0 [13072b0f] AxisAlgorithms v1.1.0 [ca9fcad7] BeforeIT v0.2.0 `~/work/BeforeIT.jl/BeforeIT.jl` [d1d4a3ce] BitFlags v0.1.9 @@ -64,7 +64,7 @@ [1a297f60] FillArrays v1.13.0 [53c48c17] FixedPointNumbers v0.8.5 [1fa38f19] Format v1.3.7 - [28b8d3ca] GR v0.73.8 + [28b8d3ca] GR v0.73.9 [d7ba0133] Git v1.3.1 [42e2da0e] Grisu v1.0.2 [f67ccb44] HDF5 v0.17.2 @@ -156,10 +156,10 @@ [d7e528f0] FreeType2_jll v2.13.3+1 [559328eb] FriBidi_jll v1.0.14+0 [0656b61e] GLFW_jll v3.4.0+1 - [d2c73de3] GR_jll v0.73.8+0 + [d2c73de3] GR_jll v0.73.9+0 [78b55507] Gettext_jll v0.21.0+0 [f8c6e375] Git_jll v2.47.1+0 - [7746bdde] Glib_jll v2.82.2+0 + [7746bdde] Glib_jll v2.82.2+1 [3b182d85] Graphite2_jll v1.3.14+1 ⌃ [0234f1f7] HDF5_jll v1.14.2+1 [2e76f6c2] HarfBuzz_jll v8.3.1+0 @@ -289,4 +289,4 @@ [8e850b90] libblastrampoline_jll v5.11.0+0 [8e850ede] nghttp2_jll v1.52.0+1 [3f19e933] p7zip_jll v17.4.0+2 -Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated -m`

You can also download the manifest file and the project file.

+Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated -m`

You can also download the manifest file and the project file.

diff --git a/dev/search_index.js b/dev/search_index.js index 3aa09d2..08fe654 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"EditURL = \"../../../examples/scenario_analysis_via_shock.jl\"","category":"page"},{"location":"examples/scenario_analysis_via_shock.html#Scenario-analysis-via-custom-shocks","page":"Shocked simulations","title":"Scenario analysis via custom shocks","text":"","category":"section"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"In this tutorial we will illustrate how to perform a scenario analysis by running the model multiple times under a specific shock and comparing the results with the unshocked model.","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"import BeforeIT as Bit\nusing Plots, StatsPlots\n\nparameters = Bit.AUSTRIA2010Q1.parameters\ninitial_conditions = Bit.AUSTRIA2010Q1.initial_conditions","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"Initialise the model and the data collector","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"T = 20\nmodel = Bit.init_model(parameters, initial_conditions, T);\nnothing #hide","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"Simulate the model for T quarters","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"data_vec_baseline = Bit.run_n_sims(model, 4)","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"Now, apply a shock to the model and simulate it again. A shock is simply a function that takes the model and changes some of its parameters for a specific time period.","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"In this case, let's define an interest rate shock that sets the interest rate for a number of epochs.","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"We do this by first defining a \"struct\" with some useful attributes","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"struct CustomShock\n rate::Float64 # target rate for the first 10 epochs\n final_time::Int # number of epochs for the shock\nend","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"and then by making the struct a callable function that changes the interest rate in the model, this is done in Julia using the syntax below","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"function (s::CustomShock)(model::Bit.Model)\n if model.agg.t <= s.final_time\n model.cb.r_bar = s.rate\n end\nend","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"Now we define a specific shock with a rate of 0.01 for the first 10 epochs, and run a shocked simulation","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"custom_shock = CustomShock(0.0, 10)\ndata_vec_shocked = Bit.run_n_sims(model, 4; shock = custom_shock)","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"Finally, we can plot baseline and shocked simulations","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"Te = T + 1\nStatsPlots.errorline(\n 1:Te,\n data_vec_baseline.real_gdp,\n errortype = :sem,\n label = \"baseline\",\n titlefont = 10,\n xlabel = \"quarters\",\n ylabel = \"GDP\",\n)\nStatsPlots.errorline!(\n 1:Te,\n data_vec_shocked.real_gdp,\n errortype = :sem,\n label = \"shock\",\n titlefont = 10,\n xlabel = \"quarters\",\n ylabel = \"GDP\",\n)","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"Note that, importantly, once the function central_bank_rate has been changed, the model will use the new interest rate in all the simulations, unless the function is changed again. To restore the original interest rate, we can simply re-import the function central_bank_rate.","category":"page"},{"location":"api.html","page":"API","title":"API","text":"CurrentModule = BeforeIT ","category":"page"},{"location":"api.html","page":"API","title":"API","text":"Pages = [\"api.md\"]","category":"page"},{"location":"api.html#Code-reference","page":"API","title":"Code reference","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"In this page we document the functions which constitute the bulk of BeforeIT.jl functionality.","category":"page"},{"location":"api.html#Agent-types","page":"API","title":"Agent types","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"agents.jl\"]","category":"page"},{"location":"api.html#BeforeIT.Aggregates","page":"API","title":"BeforeIT.Aggregates","text":"This is a Aggregates type. It is used to store the aggregate variables of the economy. Note that t is an integer, while the rest are floats or vectors of floats.\n\nFields\n\nY [vector]: GDP data + predictions\npi_ [vector]: inflation data + predictions\nP_bar: Global price index\nP_bar_g [vector]: Producer price index for principal good g\nP_bar_HH: Consumer price index\nP_bar_CF: Capital price index\nP_bar_h: CPI_h\nP_bar_CF_h: Capital price index _h\nY_e: Expected GDP\ngamma_e: Expected growth\npi_e: Expected inflation\nt: Time index\n\n\n\n\n\n","category":"type"},{"location":"api.html#BeforeIT.Bank","page":"API","title":"BeforeIT.Bank","text":"This is a Bank type. It represents the bank of the model.\n\nFields\n\nE_k: equity capital (common equity) of the bank\nPi_k: Profits of the bank\nPi_e_k: Expected profits of the bank\nD_k: Residual and balancing item on the bank’s balance sheet\nr: Rate for loans and morgages\n\nHousehold fields (bank' owner)\n\nY_h: Net disposable income of bank owner (investor)\nC_d_h: Consumption budget\nI_d_h: Investment budget\nC_h: Realised consumption\nI_h: Realised investment\nK_h: Capital stock\nD_h: Deposits\n\n\n\n\n\n","category":"type"},{"location":"api.html#BeforeIT.CentralBank","page":"API","title":"BeforeIT.CentralBank","text":"This is a CentralBank type. It represents the central bank of the model.\n\nFields\n\nr_bar: Nominal interest rate\nr_G: Interest rate on government bonds\nrho: Parameter for gradual adjustment of the policy rate\nr_star: Real equilibrium interest rate\npi_star: Inflation target by CB\nxi_pi: Weight the CB puts on inflation targeting\nxi_gamma: Weight placed on economic\nE_CB: Central bank equity\n\n\n\n\n\n","category":"type"},{"location":"api.html#BeforeIT.Firms","page":"API","title":"BeforeIT.Firms","text":"This is a Firms type. Each field is an array which stores the values for all the firms in the economy. Note that the G_i, N_i and V_i fields are integers, while the rest are floats.\n\nFor all fields the entry at index i corresponds to the ith firm.\n\nFields\n\nG_i: Principal product\nalpha_bar_i: Average productivity of labor\nbeta_i: Productivity of intermediate consumption\nkappa_i: Productivity of capital\nw_i: Wages\nw_bar_i: Average wage rate\ndelta_i: Depreciation rate for capital\ntau_Y_i: Net tax rate on products\ntau_K_i: Net tax rate on production\nN_i: Number of persons employed\nY_i: Production of goods\nQ_i: Sales of goods\nQ_d_i: Demand for goods\nP_i: Price\nS_i: Inventories\nK_i: Capital, in real terms\nM_i: Intermediate goods/services and raw materials, in real terms\nL_i: Outstanding loans\npi_bar_i: Operating margin\nD_i: Deposits of the firm\nPi_i: Profits\nV_i: Vacancies\nI_i: Investments\nE_i: Equity\nP_bar_i: Price index\nP_CF_i: Price index\nDS_i: Differnece in stock of final goods\nDM_i: Difference in stock of intermediate goods\nDL_i: Obtained loans\nDL_d_i: Target loans\nK_e_i: Expected capital \nL_e_i: Expected loans\nQ_s_i: Expected sales\nI_d_i: Desired investments\nDM_d_i: Desired materials\nN_d_i: Desired employment\nPi_e_i: Expected profits\n\nHousehold fields (firms' owners)\n\nY_h: Net disposable income of firm owner (investor)\nC_d_h: Consumption budget\nI_d_h: Investment budget\nC_h: Realised consumption\nI_h: Realised investment\nK_h: Capital stock\nD_h: Deposits of the owner of the firms\n\n\n\n\n\n","category":"type"},{"location":"api.html#BeforeIT.Government","page":"API","title":"BeforeIT.Government","text":"This is a Government type. It represents the government of the model.\n\nFields\n\nalpha_G: Autoregressive coefficient for government consumption\nbeta_G: Scalar constant for government consumption\nsigma_G: Variance coefficient for government consumption\nY_G: Government revenues\nC_G: Consumption demand of the general government\nL_G: Loans taken out by the government\nsb_inact: Social benefits for inactive persons\nsb_other: Social benefits for all\nC_d_j [vector]: Local governments consumption demand\nC_j: Realised government consumption\nP_j: Price inflation of government goods <- ??\n\n\n\n\n\n","category":"type"},{"location":"api.html#BeforeIT.Model","page":"API","title":"BeforeIT.Model","text":"This is a Model type. It is used to store all the agents of the economy.\n\nFields\n\nw_act: Workers that are active\nw_inact: Workers that are inactive\nfirms: Firms\nbank: Bank\ncb: CentralBank\ngov: Government\nrotw: RestOfTheWorld\nagg: Aggregates\n\n\n\n\n\n","category":"type"},{"location":"api.html#BeforeIT.RestOfTheWorld","page":"API","title":"BeforeIT.RestOfTheWorld","text":"This is a RestOfTheWorld type. It represents the rest of the world of the model.\n\nFields\n\nalpha_E: Autoregressive coefficient for exports\nbeta_E: Scalar constant for exports\nsigma_E: Variance coefficient for exports\nalpha_I: Autoregressive coefficient for imports\nbeta_I: Scalar constant for imports\nsigma_I: Variance coefficient for imports\nY_EA: GDP euro area\ngamma_EA: Growth euro area\npi_EA: Inflation euro area\nalpha_pi_EA: Autoregressive coefficient for euro area inflation\nbeta_pi_EA: Autoregressive coefficient for euro area inflation Scalar constant for euro area inflation\nsigma_pi_EA: Variance coefficient for euro area inflation\nalpha_Y_EA: Autoregressive coefficient for euro area GDP\nbeta_Y_EA: Autoregressive coefficient for euro area GDP Scalar constant for euro area GDP\nsigma_Y_EA: Variance coefficient for euro area GDP\nD_RoW: Net creditor/debtor position of the national economy to the rest of the world\nY_I: Supply of imports (in real terms)\nC_E: Total demand for exports\nC_d_l [vector]: Demand for exports of specific product\nC_l: Realised consumption by foreign consumers\nY_m [vector]: Supply of imports per sector\nQ_m [vector]: Sales for imports per sector\nQ_d_m [vector]: Demand for goods\nP_m [vector]: Price of imports per sector\nP_l: Price inflation of exports <- ??\n\n\n\n\n\n","category":"type"},{"location":"api.html#BeforeIT.Workers","page":"API","title":"BeforeIT.Workers","text":"This is a Workers. Each field is an array which stores the values for all the workers in the economy. Note that the O_h field is an integer, while the rest are floats.\n\nFor all fields the entry at index i corresponds to the ith worker.\n\nFields\n\nY_h: Net disposable income of worker owner (investor)\nD_h: Deposits\nK_h: Capital stock\nw_h: Wages (0 if inactive or unemployed)\nO_h: Occupation (0 if unemployed, -1 if inactive)\nC_d_h: Consumption budget\nI_d_h: Investment budget\nC_h: Realised consumption\nI_h: Realised investment\n\n\n\n\n\n","category":"type"},{"location":"api.html#Initialisation-function","page":"API","title":"Initialisation function","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"init.jl\"]","category":"page"},{"location":"api.html#BeforeIT.init_model","page":"API","title":"BeforeIT.init_model","text":"init_model(parameters, initial_conditions, T, typeInt = Int64, typeFloat = Float64)\n\nInitializes the model with given parameters and initial conditions.\n\nParameters:\n\nparameters: A dictionary containing the model parameters.\ninitial_conditions: A dictionary containing the initial conditions.\nT (integer): The time horizon of the model.\ntypeInt: (optional, default: Int64): The data type to be used for integer values.\ntypeFloat: (optional, default: Float64): The data type to be used for floating-point values.\n\nReturns:\n\nmodel::Model: The initialized model.\n\n\n\n\n\n","category":"function"},{"location":"api.html#BeforeIT.update_variables_with_totals!-Tuple{Model}","page":"API","title":"BeforeIT.update_variables_with_totals!","text":"update_variables_with_totals!(model::Model)\n\nUpdate the variables in the given model with some global quantities obtained from all agents. This is the last step in the initialization process and it must be performed after all agents have been initialized.\n\nArguments\n\nmodel::Model: The model object to update.\n\nReturns\n\nNothing\n\n\n\n\n\n","category":"method"},{"location":"api.html#Functions-to-run-an-entire-simulation","page":"API","title":"Functions to run an entire simulation","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"one_epoch.jl\", \"one_simulation.jl\"]","category":"page"},{"location":"api.html#BeforeIT.run_one_epoch!-Tuple{Any}","page":"API","title":"BeforeIT.run_one_epoch!","text":"run_one_epoch!(model; multi_threading = false)\n\nThis function simulates a single epoch the economic model, updating various components of the model based the interactions between different economic agents. It accepts a model object, which encapsulates the state for the simulation, and an optional boolean parameter multi_threading to enable or disable multi-threading.\n\nKey operations performed include:\n\nFinancial adjustments for firms and banks, including insolvency checks and profit calculations.\nEconomic expectations and adjustments, such as growth, inflation, and central bank rates.\nLabor and credit market operations, including wage updates and loan processing.\nHousehold economic activities, including consumption and investment budgeting.\nGovernment and international trade financial activities, including budgeting and trade balances.\nGeneral market matching and accounting updates to reflect changes in economic indicators and positions.\n\nThe function updates the model in-place and does not return any value.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.run_n_sims-Tuple{Any, Any}","page":"API","title":"BeforeIT.run_n_sims","text":"run_n_sims(model, n_sims; shock = NoShock(), multi_threading = true)\n\nA function that runs n_sims simulations in parallel with multiple threading and returns a vector of data objects of dimension n_sims.\n\nArguments\n\nmodel: The model configuration used to simulate.\nn_sims: The number of simulations to run in parallel.\n\nReturns\n\ndata_vector: A vector containing the data objects collected during each simulation.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.run_one_sim!-Tuple{Any}","page":"API","title":"BeforeIT.run_one_sim!","text":"run_one_sim!(model; shock = NoShock())\n\nRun a single simulation based on the provided model. The simulation runs for a number of epochs specified by model.prop.T.\n\nArguments\n\nmodel::Model: The model configuration used for the simulation.\n\nReturns\n\ndata::Data: The data collected during the simulation.\n\nDetails\n\nThe function initializes the data using BeforeIT.init_data(model), then iteratively updates the model and data for each epoch using BeforeIT.run_one_epoch!(model) and BeforeIT.update_data!(data, model) respectively.\n\nExample\n\n```julia model = BeforeIT.initializemodel(parameters, initialconditions, T) data = runonesim!(model)\n\n\n\n\n\n","category":"method"},{"location":"api.html#Firms-actions","page":"API","title":"Firms actions","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"firms.jl\"]","category":"page"},{"location":"api.html#BeforeIT.firms_deposits-Tuple{Any, Any}","page":"API","title":"BeforeIT.firms_deposits","text":"firms_deposits(firms, model)\n\nCalculate the new deposits of firms.\n\nArguments\n\nfirms: Firms object\nmodel: Model object\n\nReturns\n\nDD_i: Vector of new deposits\n\nThe new deposits DD_i are calculated as follows:\n\nDD_i = sales + labour_cost + material_cost + taxes_products + taxes_production + corporate_tax + dividend_payments + interest_payments + interest_received + investment_cost + new_credit + debt_installment\n\nwhere:\n\nsales = P_i * Q_i\nlabour_cost = (1 + tau_SIF) * w_i * N_i * P_bar_HH\nmaterial_cost = -DM_i * P_bar_i\ntaxes_products = -tau_Y_i * P_i * Y_i\ntaxes_production = -tau_K_i * P_i * Y_i\ncorporate_tax = -tau_FIRM * pos(Pi_i)\ndividend_payments = -theta_DIV * (1 - tau_FIRM) * pos(Pi_i)\ninterest_payments = -r * (L_i + pos(-D_i))\ninterest_received = r_bar * pos(D_i)\ninvestment_cost = -P_CF_i * I_i\nnew_credit = DL_i\ndebt_installment = -theta * L_i\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.firms_equity-Tuple{Any, Any}","page":"API","title":"BeforeIT.firms_equity","text":"firms_equity(firms, model)\n\nCalculate the equity of firms.\n\nArguments\n\nfirms: Firms object\nmodel: Model object\n\nReturns\n\nE_i: Vector of equity\n\nThe equity E_i is calculated as follows:\n\nE_i = D_i + M_i * sum(a_sg G_i * barP_g) + P_i * S_i + barP_CF * K_i - L_i\n\nwhere:\n\nD_i: Deposits\nM_i: Intermediate goods\na_sg: Technology coefficient of the gth product in the sth industry\nG_i: Vector of goods\nP_bar_g: Producer price index for principal good g\nP_i: Price\nS_i: Stock\nP_bar_CF: Capital price index\nK_i: Capital stock\nL_i: Loans\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.firms_expectations_and_decisions-Tuple{Any, Any}","page":"API","title":"BeforeIT.firms_expectations_and_decisions","text":"firms_expectations_and_decisions(firms, model)\n\nCalculate the expectations and decisions of firms. That is: compute firm quantity, price, investment and intermediate-goods, employment decisions, expected profits, and desired/expected loans and capital.\n\nArguments\n\nfirms: Firms object\nmodel: Model object\n\nReturns\n\nQ_s_i: Vector of desired quantities\nI_d_i: Vector of desired investments\nDM_d_i: Vector of desired intermediate goods\nN_d_i: Vector of desired employment\nPi_e_i: Vector of expected profits\nDL_d_i: Vector of desired new loans\nK_e_i: Vector of expected capital\nL_e_i: Vector of expected loans\nP_i: Vector of prices\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.firms_loans-Tuple{Any, Any}","page":"API","title":"BeforeIT.firms_loans","text":"firms_loans(firms, model)\n\nCalculate the new loans of firms.\n\nArguments\n\nfirms: Firms object\nmodel: Model object\n\nReturns\n\nL_i: Vector of new loans\n\nThe new loans L_i are calculated as follows:\n\nL_i = (1 - theta) * L_i + DL_i\n\nwhere:\n\ntheta: Rate of repayment\nL_i: Loans\nDL_i: Acquired new loans\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.firms_production-Tuple{AbstractFirms}","page":"API","title":"BeforeIT.firms_production","text":"firms_production(firms)\n\nCalculate the production of firms.\n\nArguments\n\nfirms: Firms object\n\nReturns\n\nY_i: Vector of production\n\nThe production Y_i is computed using a Leontief technology.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.firms_profits-Tuple{AbstractFirms, Model}","page":"API","title":"BeforeIT.firms_profits","text":"firms_profits(firms, model)\n\nCalculate the profits of firms.\n\nArguments\n\nfirms: Firms object\nmodel: Model object\n\nReturns\n\nPi_i: Vector of profits\n\nThe profits Pi_i are calculated as follows:\n\nPi_i = in_sales + in_deposits - out_wages - out_expenses - out_depreciation - out_taxes_prods - out_taxes_capital - out_loans\n\nwhere:\n\nin_sales = P_i * Q_i + P_i * DS_i\nin_deposits = r_bar * pos(D_i)\nout_wages = (1 + tau_SIF) * w_i * N_i * P_bar_HH\nout_expenses = 1 / beta_i * P_bar_i * Y_i\nout_depreciation = delta_i / kappa_i * P_CF_i * Y_i\nout_taxes_prods = tau_Y_i * P_i * Y_i\nout_taxes_capital = tau_K_i * P_i * Y_i\nout_loans = r * (L_i + pos(-D_i))\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.firms_stocks-Tuple{Any}","page":"API","title":"BeforeIT.firms_stocks","text":"firms_stocks(firms)\n\nCalculate the stocks of firms.\n\nArguments\n\nfirms: Firms object\n\nReturns\n\nK_i: Vector of capital stock\nM_i: Vector of intermediate goods\nDS_i: Vector of differneces in stock of final goods\nS_i: Vector of stock of final goods\n\nThe stocks are calculated as follows:\n\nK_i = K_i - delta_i / kappa_i * Y_i + I_i\nM_i = M_i - Y_i / beta_i + DM_i\nDS_i = Y_i - Q_i\nS_i = S_i + DS_i\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.firms_wages-Tuple{AbstractFirms}","page":"API","title":"BeforeIT.firms_wages","text":"firms_wages(firms)\n\nCalculate the wages set by firms.\n\nArguments\n\nfirms: Firms object\n\nReturns\n\nw_i: Vector of wages\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.init_firms-Tuple{Any, Any}","page":"API","title":"BeforeIT.init_firms","text":"init_firms(parameters, initial_conditions; typeInt = Int64, typeFloat = Float64)\n\nInitialize firms with given parameters and initial conditions.\n\nArguments\n\nparameters: The parameters for initializing the firms.\ninitial_conditions: The initial conditions for the firms.\ntypeInt: (optional) The integer type to be used. Default is Int64.\ntypeFloat: (optional) The floating-point type to be used. Default is Float64.\n\nReturns\n\nfirms::Firms: The initialized firms.\nfirms_args::Tuple: The arguments used to initialize the firms.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.leontief_production-NTuple{7, Any}","page":"API","title":"BeforeIT.leontief_production","text":"leontief_production(Q_s_i, N_i, alpha_i, K_i, kappa_i, M_i, beta_i)\n\nCalculate the production function of firms.\n\nArguments\n\nQ_s_i: Vector of desired quantities\nN_i: Vector of employment\nalpha_i: Vector of labour productivity\nK_i: Vector of capital stock\nkappa_i: Vector of capital productivity\nM_i: Vector of intermediate goods\nbeta_i: Vector of intermediate goods productivity\n\nReturns\n\nY_i: Vector of production\n\nThe Leontief production function Y_i is calculated as follows:\n\nY_i = min(Q_s_i min(N_i cdot alpha_i min(K_i cdot kappa_i M_i cdot beta_i)))\n\n\n\n\n\n","category":"method"},{"location":"api.html#Households-actions","page":"API","title":"Households actions","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"households.jl\"]","category":"page"},{"location":"api.html#Government-actions","page":"API","title":"Government actions","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"government.jl\"]","category":"page"},{"location":"api.html#BeforeIT.gov_expenditure-Tuple{Any, Any}","page":"API","title":"BeforeIT.gov_expenditure","text":"gov_expenditure(gov::AbstractGovernment, model)\n\nComputes government expenditure on consumption and transfers to households.\n\nArguments\n\ngov: government object\nmodel: model object\n\nReturns\n\nC_G: government consumption\nC_d_j: local government consumptions\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.gov_loans-Tuple{Any, Any}","page":"API","title":"BeforeIT.gov_loans","text":"gov_loans(gov::AbstractGovernment, model, Y_G)\n\nComputes government new government debt.\n\nArguments\n\ngov::AbstractGovernment: government object\nmodel: model object\n\nReturns\n\nL_G: new government debt\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.gov_revenues-Tuple{Model}","page":"API","title":"BeforeIT.gov_revenues","text":"gov_revenues(model)\n\nComputes government revenues from taxes and social security contributions. The government collects taxes on labour income, capital income, value added, and corporate income. It also collects social security contributions from workers and firms. The government also collects taxes on consumption and capital formation. Finally, the government collects taxes on exports and imports.\n\nArguments\n\nmodel: model object\n\nReturns\n\nY_G: government revenues\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.gov_social_benefits-Tuple{AbstractGovernment, Any}","page":"API","title":"BeforeIT.gov_social_benefits","text":"gov_social_benefits(gov::AbstractGovernment, model)\n\nComputes social benefits paid by the government households.\n\nArguments\n\ngov: government object\nmodel: model object\n\nReturns\n\nsb_other: social benefits for other households\nsb_inact: social benefits for inactive households\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.init_government-Tuple{Any, Any}","page":"API","title":"BeforeIT.init_government","text":"init_government(parameters, initial_conditions; typeInt = Int64, typeFloat = Float64)\n\nInitialize the government agent.\n\nArguments\n\nparameters: The parameters.\ninitial_conditions: The initial conditions.\ntypeInt: The integer type to be used (default: Int64).\ntypeFloat: The floating-point type to be used (default: Float64).\n\nReturns\n\nThe initialized government model.\nThe arguments used to initialize the government model.\n\n\n\n\n\n","category":"method"},{"location":"api.html#Bank-and-Central-Bank-actions","page":"API","title":"Bank and Central Bank actions","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"bank.jl\"]","category":"page"},{"location":"api.html#BeforeIT._bank_deposits-NTuple{7, Any}","page":"API","title":"BeforeIT._bank_deposits","text":"_deposit_bank(waD_h, wiD_h, fD_h, bD_h, fD_i, bE_k, fL_i)\n\nHelper function to calculate the new deposits of a bank.\n\nArguments\n\nwaD_h: Array of deposits from active workers\nwiD_h: Array of deposits from inactive workers\nfD_h: Array of deposits from firms\nbD_h: Deposits from the bank owner\nfD_i: Array of deposits from firms\nbE_k: Bank equity\nfL_i: Array of loans to firms\n\nReturns\n\nD_k: New deposits of the bank\n\nThe new deposits D_k are calculated as the sum of the deposits of the active workers, the inactive workers, the firms, and the bank owner itself, plus the bank's equity, minus the loans of the firms.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT._bank_profits-Union{Tuple{T}, Tuple{AbstractVector{T}, AbstractVector{T}, AbstractVector{T}, T, T, T}} where T","page":"API","title":"BeforeIT._bank_profits","text":"_bank_profits(L_i, D_i, D_h, D_k, r_bar, r)\n\nHelper function to calculate the total profits of a bank.\n\nArguments\n\nL_i: Array of loans provided by the bank\nD_i: Array of deposits from firms\nD_h: Array of deposits from households\nD_k: Residual and balancing item on the bank’s balance sheet\nr_bar: Base interest rate\nr: Interest rate set by the bank\n\nReturns\n\nPi_k: Total profits of the bank\n\nThe total profits Pi_k are calculated as follows:\n\nPi_k = r cdot sum_i(L_i + max(0 -D_i)) + r cdot sum_h(max(0 -D_h)) + r_bar \ncdot max(0 D_k) - r_bar cdot sum_i(max(0 D_i)) - r_bar cdot \nsum_h(max(0 D_h)) - r_bar cdot max(0 -D_k)\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT._central_bank_profits-NTuple{4, Any}","page":"API","title":"BeforeIT._central_bank_profits","text":"_central_bank_profits(r_bar, D_k, L_G, r_G)\n\nHelper function to calculate the profits of a central bank.\n\nArguments\n\nr_bar: The base interest rate\nD_k: Deposits from commercial banks\nL_G: Loans provided to the government\nr_G: Interest rate on government loans\n\nReturns\n\nPi_CB: Profits of the central bank\n\nThe profits Pi_CB are calculated as follows:\n\nPi_CB = r_G cdot L_G - r_bar cdot D_k\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.bank_deposits-Tuple{Any, Any}","page":"API","title":"BeforeIT.bank_deposits","text":"deposits_bank(bank, w_act, w_inact, firms)\n\nCalculate the new deposits of a bank.\n\nArguments\n\nbank: The Bank object containing the bank of the model\nw_act: The Workers object containing the active workers of the model\nw_inact: The Workers object containing the inactive workers of the model\nfirms: The Firms object containing the firms of the model\n\nReturns\n\nD_k: New deposits of the bank\n\nThe new deposits D_k are calculated as the sum of the deposits of the active workers, the inactive workers, the firms, and the bank owner itself, plus the bank's equity, minus the loans of the firms.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.bank_equity-Tuple{Any, Any}","page":"API","title":"BeforeIT.bank_equity","text":"bank_equity(bank, model)\n\nCalculate the net profits of a bank.\n\nArguments\n\nbank: The bank object.\nmodel: The model object.\n\nReturns\n\nE_k: The updated equity of the bank.\n\nThe net profits DE_k are calculated as:\n\nDE_k = Pi_k - theta_DIV cdot (1 - tau_FIRM) cdot max(0 Pi_k) - tau_FIRM cdot max(0 Pi_k)\n\nand the equity E_k is updated as:\n\nE_k = E_k + DE_k\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.bank_expected_profits-Tuple{Any, Any}","page":"API","title":"BeforeIT.bank_expected_profits","text":"bank_expected_profits(Pi_k, pi_e, gamma_e)\n\nCalculate the expected profits of a bank.\n\nArguments\n\nPi_k: Past profits of the bank\npi_e: Expected inflation rate\ngamma_e: Expected growth rate\n\nReturns\n\nE_Pi_k: Expected profits of the bank\n\nThe expected profits E_Pi_k are calculated as follows:\n\nE_Pi_k = Pi_k cdot (1 + pi_e) cdot (1 + gamma_e)\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.bank_profits-Tuple{Any, Any}","page":"API","title":"BeforeIT.bank_profits","text":"bank_profits(bank, model)\n\nCalculate the total profits of a bank.\n\nArguments\n\nbank: The bank object.\nmodel: The model object.\n\nReturns\n\nPi_k: The total profits of the bank.\n\nThe total profits Pi_k are calculated as:\n\nPi_k = r cdot sum_i(L_i + max(0 -D_i)) + r cdot sum_h(max(0 -D_h)) + r_bar\ncdot max(0 D_k) - r_bar cdot sum_i(max(0 D_i)) - r_bar cdot\nsum_h(max(0 D_h)) - r_bar cdot max(0 -D_k)\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.bank_rate-Tuple{Any, Any}","page":"API","title":"BeforeIT.bank_rate","text":"bank_rate(bank, model)\n\nUpdate the interest rate set by the bank.\n\nArguments\n\nbank: The bank whose interest rate is to be updated\nmodel: Model object\n\nReturns\n\nr: The updated interest rate\n\nr = barr + mu\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.central_bank_equity-Tuple{Any, Any}","page":"API","title":"BeforeIT.central_bank_equity","text":"central_bank_equity(cb, model)\n\nCalculate the equity of the central bank.\n\nArguments\n\ncb: The central bank\nmodel: The model object\n\nReturns\n\nE_CB: The equity of the central bank\n\nThe equity E_CB is calculated as follows:\n\nE_CB = E_CB + Pi_CB\n\nwhere \\Pi_{CB} are the profits of the central bank.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.central_bank_rate-Tuple{AbstractCentralBank, Model}","page":"API","title":"BeforeIT.central_bank_rate","text":"central_bank_rate(cb, model)\n\nUpdate the base interest rate set by the central bank according to the Taylor rule.\n\nArguments\n\ncb: The central bank whose base interest rate is to be updated\nmodel: The model object\n\nReturns\n\nr_bar: The updated base interest rate\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.finance_insolvent_firms!-Tuple{AbstractFirms, AbstractBank, Any}","page":"API","title":"BeforeIT.finance_insolvent_firms!","text":"finance_insolvent_firms!(firms, bank, P_bar_CF, zeta_b, insolvent)\n\nRifinance insolvent firms using bank equity.\n\nArguments\n\nfirms: The Firms object containing the firms of the model\nbank: The Bank object containing the bank of the model\nP_bar_CF: Capital price index\nzeta_b: Parameter of loan-to-capital ratio for new firms after bankruptcy\n\nReturns\n\nThis function does not return a value. It modifies the banks and firms collections in-place.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.taylor_rule-Union{Tuple{T}, NTuple{8, T}} where T","page":"API","title":"BeforeIT.taylor_rule","text":"taylor_rule(rho, r_bar, r_star, pi_star, xi_pi, xi_gamma, gamma_EA, pi_EA)\n\nCalculate the interest rate according to the Taylor rule.\n\nArguments\n\nrho: Parameter for gradual adjustment of the policy rate.\nr_bar: Nominal interest rate.\nr_star: Real equilibrium interest rate.\npi_star: The target inflation rate.\nxi_pi: Weight the CB puts on inflation targeting.\nxi_gamma: Weight placed on economic growth.\ngamma_EA: The output growth rate.\npi_EA: The inflation rate.\n\nReturns\n\nrate: The calculated interest rate.\n\nThe Taylor rule is given by the following equation:\n\nr_t = ρ * r_t-1 + (1 - ρ) * (r^* + π^* + ξ_π * (π_t - π^*) + ξ_γ * γ_t)\n\n\n\n\n\n","category":"method"},{"location":"api.html#Rest-Of-The-World-actions","page":"API","title":"Rest Of The World actions","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"rotw.jl\"]","category":"page"},{"location":"api.html#BeforeIT.rotw_deposits-Tuple{Any, Any}","page":"API","title":"BeforeIT.rotw_deposits","text":"rotw_deposits(rotw, tau_EXPORT)\n\nCalculate the deposits of the rest of the world.\n\nArguments\n\nrotw: The rest of the world object.\ntau_EXPORT: The export tax.\n\nReturns\n\nD_RoW: The deposits of the rest of the world.\n\nThe deposits D_RoW are calculated as follows:\n\nD_RoW = D_RoW + left( sum_m P_m cdot Q_m right) - (1 + tau_EXPORT) cdot C_l\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.rotw_import_export-Tuple{Any, Any}","page":"API","title":"BeforeIT.rotw_import_export","text":"rotw_import_export(rotw, model, pi_e, epsilon_E, epsilon_I)\n\nCalculate the demand for exports and supply of imports of the rest of the world.\n\nArguments\n\nrotw: The rest of the world object.\nmodel: The model object.\n\nReturns\n\nC_E: Total demand for exports.\nY_I: Supply of imports (in real terms).\nC_d_l: TDemand for exports of specific product.\nY_m: Supply of imports per sector.\nP_m: Price of imports per sector.\n\n\n\n\n\n","category":"method"},{"location":"api.html#Markets","page":"API","title":"Markets","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"search_and_matching_credit.jl\", \"search_and_matching_labour.jl\", \"search_and_matching.jl\"]","category":"page"},{"location":"api.html#BeforeIT.search_and_matching_credit-Tuple{AbstractFirms, Any}","page":"API","title":"BeforeIT.search_and_matching_credit","text":"search_and_matching_credit(firms::Firms, model)\n\nThis function calculates the credit allocation for each firm in the given firms object.\n\nParameters:\n\nfirms::Firms: The firms object.\nmodel: The model object.\n\nReturns:\n\nDL_i: An array of credit allocations for each firm.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.search_and_matching_labour-Tuple{AbstractFirms, Any}","page":"API","title":"BeforeIT.search_and_matching_labour","text":"search_and_matching_labour(firms::Firms, model)\n\nThis function implements a labor search and matching algorithm. It takes in a Firms object and a Model object as input. The Firms object contains information about the number of desired employees (N_d_i) and the current number of employees (N_i) for each firm. The model object contains information about the current employment status (O_h) of each worker.\n\nThe function performs the following steps:\n\nCalculates the vacancies (V_i) for each firm as the difference between desired and current employees.\nIdentifies employed workers and shuffles them randomly.\nFires workers from firms with negative vacancies to adjust the workforce.\nIdentifies unemployed workers and firms with positive vacancies.\nRandomly matches unemployed workers to firms with vacancies until all vacancies are filled or there are no more unemployed workers.\n\nThe function returns:\n\nN_i: An updated array of the number of employed workers for each firm.\nO_h: An updated array where each element represents the firm a worker is employed with (0 if unemployed).\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.perform_firms_market!-NTuple{15, Any}","page":"API","title":"BeforeIT.perform_firms_market!","text":"Perform the firms market exchange process\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.perform_retail_market!-NTuple{31, Any}","page":"API","title":"BeforeIT.perform_retail_market!","text":"Perform the retail market exchange process\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.search_and_matching!","page":"API","title":"BeforeIT.search_and_matching!","text":"search_and_matching!(model, multi_threading::Bool = false)\n\nThis function performs a search and matching algorithm for firms and for retail markets. It takes in a model object and an optional boolean argument for multi-threading. The function loops over all goods and performs the firms market and retail market operations for each good. Finally, it updates the aggregate variables based on the results of markets.\n\nArgs:\n\nmodel: The model object\nmulti_threading: A boolean indicating whether to use multi-threading for the algorithm. Default is false.\n\nThis function updates the model in-place and does not return any value.\n\n\n\n\n\n","category":"function"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"EditURL = \"../../../examples/basic_example.jl\"","category":"page"},{"location":"examples/basic_example.html#Essential-use-of-BeforeIT","page":"Essentials","title":"Essential use of BeforeIT","text":"","category":"section"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"We start by importing the BeforeIT library and other useful libraries.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"import BeforeIT as Bit\nusing FileIO, Plots","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"We then initialise the model loading some precomputed set of parameters and by specifying a number of epochs. In another tutorial we will illustrate how to compute parameters and initial conditions.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"parameters = Bit.AUSTRIA2010Q1.parameters\ninitial_conditions = Bit.AUSTRIA2010Q1.initial_conditions","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"We can now initialise the model, by specifying in advance the maximum number of epochs.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"T = 16\nmodel = Bit.init_model(parameters, initial_conditions, T)","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"Note that the it is very simple to inspect the model by typing","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"fieldnames(typeof(model))","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"and to inspect the specific attributes of one agent type by typing","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"fieldnames(typeof(model.bank))","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"We can now define a data tracker, which will store the time series of the model.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"data = Bit.init_data(model);\nnothing #hide","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"We can run now the model for a number of epochs and progressively update the data tracker.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"for t in 1:T\n Bit.run_one_epoch!(model; multi_threading = true)\n Bit.update_data!(data, model)\nend","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"Note that we can equivalently run the model for a number of epochs in the single command data = BeforeIT.run_one_sim!(model), but writing the loop explicitely is more instructive.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"We can then plot any time series stored in the data tracker, for example","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"plot(data.real_gdp, title = \"gdp\", titlefont = 10)","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"Or we can plot multiple time series at once using the function plot_data","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"ps = Bit.plot_data(data, quantities = [:real_gdp, :real_household_consumption, :real_government_consumption, :real_capitalformation, :real_exports, :real_imports, :wages, :euribor, :gdp_deflator])\nplot(ps..., layout = (3, 3))","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"To run multiple monte-carlo repetitions in parallel we can use","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"model = Bit.init_model(parameters, initial_conditions, T)\ndata_vector = Bit.run_n_sims(model, 4)","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"Note that this will use the number of threads specified when activating the Julia environment. To discover the number of threads available, you can use the command","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"Threads.nthreads()","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"To activate Julia with a specific number of threads, say 8, you can use the command julia -t 8 in the terminal.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"We can then plot the results of the monte-carlo repetitions using the function plot_data_vector","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"ps = Bit.plot_data_vector(data_vector)\nplot(ps..., layout = (3, 3))","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"EditURL = \"../../../examples/change_expectations.jl\"","category":"page"},{"location":"examples/change_expectations.html#Changing-expectations-via-function-overloading","page":"Experimentations (advanced)","title":"Changing expectations via function overloading","text":"","category":"section"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"In this tutorial we will illustrate how to experiment with different expectations of the agents in the model.","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"import BeforeIT as Bit\nusing Random, Plots","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Import standard parameters and initial conditions","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"par = Bit.AUSTRIA2010Q1.parameters\ninit = Bit.AUSTRIA2010Q1.initial_conditions","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Set the seed, initialise the model and run one simulation","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Random.seed!(1234)\nT = 40\nmodel = Bit.init_model(par, init, T)\ndata = Bit.run_one_sim!(model)","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Now we can experiment with changing expectations of the agents in the model. We will change the function estimate_next_value to make the agents expect the last value of the time series (so to represent backward looking expectations)","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"import BeforeIT: estimate_next_value\nfunction estimate_next_value(data)\n return data[end]\nend","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Run the model again, with the same seed","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Random.seed!(1234)\nmodel = Bit.init_model(par, init, T)\ndata_back = Bit.run_one_sim!(model)","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Plot the results, comparing the two cases as different lines","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"p1 = plot(data.real_gdp, title = \"gdp\", titlefont = 10, label = \"forward looking\")\nplot!(p1, data_back.real_gdp, titlefont = 10, label = \"backward looking\")\n\np2 = plot(data.real_household_consumption, title = \"consumption\", titlefont = 10)\nplot!(p2, data_back.real_household_consumption, titlefont = 10, label = \"backward looking\")\n\nplot(p1, p2, layout = (2, 1), legend = true)","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Plot all time series","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"p1 = plot(data.real_gdp, title = \"gdp\", titlefont = 10)\nplot!(p1, data_back.real_gdp, titlefont = 10)\np2 = plot(data.real_household_consumption, title = \"household cons.\", titlefont = 10)\nplot!(p2, data_back.real_household_consumption, titlefont = 10)\np3 = plot(data.real_government_consumption, title = \"gov. cons.\", titlefont = 10)\nplot!(p3, data_back.real_government_consumption, titlefont = 10)\np4 = plot(data.real_capitalformation, title = \"capital form.\", titlefont = 10)\nplot!(p4, data_back.real_capitalformation, titlefont = 10)\np5 = plot(data.real_exports, title = \"exports\", titlefont = 10)\nplot!(p5, data_back.real_exports, titlefont = 10)\np6 = plot(data.real_imports, title = \"imports\", titlefont = 10)\nplot!(p6, data_back.real_imports, titlefont = 10)\np7 = plot(data.wages, title = \"wages\", titlefont = 10)\nplot!(p7, data_back.wages, titlefont = 10)\np8 = plot(data.euribor, title = \"euribor\", titlefont = 10)\nplot!(p8, data_back.euribor, titlefont = 10)\np9 = plot(data.nominal_gdp ./ data.real_gdp, title = \"gdp deflator\", titlefont = 10)\nplot!(p9, data_back.nominal_gdp ./ data_back.real_gdp, titlefont = 10)\n\nplot(p1, p2, p3, p4, p5, p6, p7, p8, p9, layout = (3, 3), legend = false)","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Note that, importantly, once the function estimate_next_value has been changed, the model will use the new expectations in all the simulations, unless the function is changed again. To restore the original expectations you could close the Julia session.","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"EditURL = \"../../../examples/scenario_analysis_via_overload.jl\"","category":"page"},{"location":"examples/scenario_analysis_via_overload.html#Scenario-analysis-via-function-overloading","page":"Shocked simulations (advanced)","title":"Scenario analysis via function overloading","text":"","category":"section"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"In this tutorial we will illustrate how to perform a scenario analysis by running the model multiple times under a specific shock and comparing the results with the unshocked model.","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"import BeforeIT as Bit\nusing Plots, StatsPlots\n\nparameters = Bit.AUSTRIA2010Q1.parameters\ninitial_conditions = Bit.AUSTRIA2010Q1.initial_conditions","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"Initialise the model and the data collector","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"T = 20\nmodel = Bit.init_model(parameters, initial_conditions, T);\ndata = Bit.init_data(model);\nnothing #hide","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"Simulate the model for T quarters","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"data_vec_baseline = Bit.run_n_sims(model, 4)","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"Now, apply a shock to the model and simulate it again Here, we do this by overloading the centralbankrate function with the wanted behaviour","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"import BeforeIT: central_bank_rate\n\nfunction central_bank_rate(cb::Bit.CentralBank, model::Bit.Model)\n gamma_EA = model.rotw.gamma_EA\n pi_EA = model.rotw.pi_EA\n taylor_rate = Bit.taylor_rule(cb.rho, cb.r_bar, cb.r_star, cb.pi_star, cb.xi_pi, cb.xi_gamma, gamma_EA, pi_EA)\n if model.agg.t < 10\n return 0.01\n else\n return taylor_rate\n end\nend\n\ndata_vec_shocked = Bit.run_n_sims(model, 4)","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"Finally, we can plot baseline and shocked simulations","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"Te = T + 1\nStatsPlots.errorline(\n 1:Te,\n data_vec_baseline.real_gdp,\n errortype = :sem,\n label = \"baseline\",\n titlefont = 10,\n xlabel = \"quarters\",\n ylabel = \"GDP\",\n)\nStatsPlots.errorline!(\n 1:Te,\n data_vec_shocked.real_gdp,\n errortype = :sem,\n label = \"shock\",\n titlefont = 10,\n xlabel = \"quarters\",\n ylabel = \"GDP\",\n)","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"Note that, importantly, once the function central_bank_rate has been changed, the model will use the new interest rate in all the simulations, unless the function is changed again. To restore the original interest rate, you could close and restart the Julia session.","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"EditURL = \"../../../examples/get_parameters_and_initial_conditions.jl\"","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"In this tutorial we illustrate how to calibrate the model to the Italian data for a specific quarter","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"import BeforeIT as Bit\nusing Dates, FileIO","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"We start from loading the calibration object for italy, which contains 4 datasets: calibration_data, figaro, data, and ea. These are saved within BeforeIT.jl for the Italian case, and would need to be appropriately generated for other countries.","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"cal = Bit.ITALY_CALIBRATION\nfieldnames(typeof(cal))","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"These are essentially 4 dictionaries with well defined keys, such as","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"println(keys(cal.calibration))\nprintln(keys(cal.figaro))\nprintln(keys(cal.data))\nprintln(keys(cal.ea))","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"The object also contains two time variables related to the data","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"println(cal.max_calibration_date)\nprintln(cal.estimation_date)","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"We can calibrate the model on a specific quarter as follows","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"calibration_date = DateTime(2010, 03, 31)\nparameters, initial_conditions = Bit.get_params_and_initial_conditions(cal, calibration_date; scale = 0.01)","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"In general, we might want to repeat this operation for multiple quarters. In the following, we loop over all quarters from 2010Q1 to 2019Q4 and save the parameters and initial conditions in separate files. We can then load these files later to run the model for each quarter.","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"start_calibration_date = DateTime(2010, 03, 31)\nend_calibration_date = DateTime(2019, 12, 31)\n\nfor calibration_date in collect(start_calibration_date:Dates.Month(3):end_calibration_date)\n params, init_conds = Bit.get_params_and_initial_conditions(cal, calibration_date; scale = 0.0005)\n save(\n \"data/italy/parameters/\" *\n string(year(calibration_date)) *\n \"Q\" *\n string(Dates.quarterofyear(calibration_date)) *\n \".jld2\",\n params,\n )\n save(\n \"data/italy/initial_conditions/\" *\n string(year(calibration_date)) *\n \"Q\" *\n string(Dates.quarterofyear(calibration_date)) *\n \".jld2\",\n init_conds,\n )\nend","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"CurrentModule = BeforeIT ","category":"page"},{"location":"index.html#Behavioural-agent-based-economic-forecasting-in-Julia","page":"Home","title":"Behavioural agent-based economic forecasting in Julia","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"Welcome to BeforeIT.jl, a Julia implementation of the agent-based model presented in Economic forecasting with an agent-based model, the first ABM matching the performance of traditional economic forecasting tools.","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"With BeforeIT.jl, you can perform economic forecasting and explore different counterfactual scenarios. Thanks to its modular design, the package is also a great starting point for anyone looking to extend its capabilities or integrate it with other tools.","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"Developed in Julia, a language known for its efficiency, BeforeIT.jl is both fast and user-friendly, making it accessible whether you’re an expert programmer or just starting out.","category":"page"},{"location":"index.html#Julia-installation","page":"Home","title":"Julia installation","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"To run this software, you will need a working Julia installation on your machine. If you don't have it installed already, simply follow the short instructions available here.","category":"page"},{"location":"index.html#BeforeIT.jl-Installation","page":"Home","title":"BeforeIT.jl Installation","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"To install BeforeIT.jl, simply open a Julia REPL by writing julia in your terminal, and then execute the following","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"using Pkg\nPkg.add(\"BeforeIT\")","category":"page"},{"location":"index.html#Quick-example","page":"Home","title":"Quick example","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"To check that the installation worked, try running the model in your terminal following","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"using BeforeIT\n\nparameters = BeforeIT.AUSTRIA2010Q1.parameters\ninitial_conditions = BeforeIT.AUSTRIA2010Q1.initial_conditions\n\nT = 20\nmodel = BeforeIT.initialise_model(parameters, initial_conditions, T)\ndata = BeforeIT.run_one_sim!(model)","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"To plot the results of the simulation, you can use the Plots package","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"using Plots\n\nplot(data.real_gdp)","category":"page"},{"location":"index.html#License","page":"Home","title":"License","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"BeforeIT.jl is released under the GNU Affero General Public License v3 or later (AGPLv3+).","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"Copyright 2024 - Banca d'Italia and the authors.","category":"page"},{"location":"index.html#Main-developers-and-maintainers","page":"Home","title":"Main developers and maintainers","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"Aldo Glielmo \nMitja Devetak \nAdriano Meligrana ","category":"page"},{"location":"index.html#Other-collaborators-and-contributors","page":"Home","title":"Other collaborators and contributors","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"Sebastian Poledna \nMarco Benedetti\nSara Corbo for the logo design\nAndrea Gentili for suggesting the name of the pakege\nArnau Quera-Bofarull for help in the deployment of the documentation\nSteven Hoekstra for fixing a bug in a script","category":"page"},{"location":"index.html#Disclaimer","page":"Home","title":"Disclaimer","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"This package is an outcome of a research project. All errors are those of the authors. All views expressed are personal views, not those of Bank of Italy.","category":"page"},{"location":"index.html#Reproducibility","page":"Home","title":"Reproducibility","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"
The documentation of BeforeIT.jl was built using these direct dependencies,","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"using Pkg # hide\nPkg.status() # hide","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"
","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"
and using this machine and Julia version.","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"using InteractiveUtils # hide\nversioninfo() # hide","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"
","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"
A more complete overview of all dependencies and their versions is also provided.","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"using Pkg # hide\nPkg.status(; mode = PKGMODE_MANIFEST) # hide","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"
","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"using TOML\nusing Markdown\nversion = TOML.parse(read(\"../../Project.toml\", String))[\"version\"]\nname = TOML.parse(read(\"../../Project.toml\", String))[\"name\"]\nlink_manifest = \"https://github.com/BeforeIT/\" * name * \".jl/tree/gh-pages/v\" * version *\n \"/assets/Manifest.toml\"\nlink_project = \"https://github.com/BeforeIT/\" * name * \".jl/tree/gh-pages/v\" * version *\n \"/assets/Project.toml\"\nMarkdown.parse(\"\"\"You can also download the\n[manifest]($link_manifest)\nfile and the\n[project]($link_project)\nfile.\n\"\"\")","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"EditURL = \"../../../examples/multithreading_speedup.jl\"","category":"page"},{"location":"examples/multithreading_speedup.html#Multithreading-speedup-for-large-models","page":"Multithreading within the model","title":"Multithreading speedup for large models","text":"","category":"section"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"In this tutorial we illustrate how to make use of multi threading in BeforeIT.jl to allow for faster executions of single simulation runs.","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"import BeforeIT as Bit\nusing FileIO, Plots, StatsPlots","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"First, we initialise the model, this time we use the Italy 2010Q1 scenario, and we want to simulate the model for a large number of epochs","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"parameters = Bit.ITALY2010Q1.parameters\ninitial_conditions = Bit.ITALY2010Q1.initial_conditions\nT = 50\nmodel = Bit.init_model(parameters, initial_conditions, T);\nnothing #hide","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"The model is in scale 1:2000, so it has around 30,000 households","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"model.prop.H","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Note that the households number is actually the sum of active and inactive households, the owners of firms and of the bank","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"length(model.w_act) + length(model.w_inact) + length(model.firms) + 1","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Let's fist check how many threads we have available in this Julia session","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Threads.nthreads()","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Then we need to first compile the code not to count compilation time, we can do that just by executing the function one time","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Bit.run_one_sim!(model; multi_threading = false);\nnothing #hide","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Let's now compare the performance of single threading and multi threading","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"model = Bit.init_model(parameters, initial_conditions, T);\n@time data = Bit.run_one_sim!(model; multi_threading = false);\n\nmodel = Bit.init_model(parameters, initial_conditions, T);\n@time data = Bit.run_one_sim!(model; multi_threading = true);\nnothing #hide","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Is the speedup in line to what we would expect? Yes!","category":"page"}] +[{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"EditURL = \"../../../examples/scenario_analysis_via_shock.jl\"","category":"page"},{"location":"examples/scenario_analysis_via_shock.html#Scenario-analysis-via-custom-shocks","page":"Shocked simulations","title":"Scenario analysis via custom shocks","text":"","category":"section"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"In this tutorial we will illustrate how to perform a scenario analysis by running the model multiple times under a specific shock and comparing the results with the unshocked model.","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"import BeforeIT as Bit\nusing Plots, StatsPlots\n\nparameters = Bit.AUSTRIA2010Q1.parameters\ninitial_conditions = Bit.AUSTRIA2010Q1.initial_conditions","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"Initialise the model and the data collector","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"T = 20\nmodel = Bit.init_model(parameters, initial_conditions, T);\nnothing #hide","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"Simulate the model for T quarters","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"data_vec_baseline = Bit.run_n_sims(model, 4)","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"Now, apply a shock to the model and simulate it again. A shock is simply a function that takes the model and changes some of its parameters for a specific time period.","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"In this case, let's define an interest rate shock that sets the interest rate for a number of epochs.","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"We do this by first defining a \"struct\" with some useful attributes","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"struct CustomShock\n rate::Float64 # target rate for the first 10 epochs\n final_time::Int # number of epochs for the shock\nend","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"and then by making the struct a callable function that changes the interest rate in the model, this is done in Julia using the syntax below","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"function (s::CustomShock)(model::Bit.Model)\n if model.agg.t <= s.final_time\n model.cb.r_bar = s.rate\n end\nend","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"Now we define a specific shock with a rate of 0.01 for the first 10 epochs, and run a shocked simulation","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"custom_shock = CustomShock(0.0, 10)\ndata_vec_shocked = Bit.run_n_sims(model, 4; shock = custom_shock)","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"Finally, we can plot baseline and shocked simulations","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"Te = T + 1\nStatsPlots.errorline(\n 1:Te,\n data_vec_baseline.real_gdp,\n errortype = :sem,\n label = \"baseline\",\n titlefont = 10,\n xlabel = \"quarters\",\n ylabel = \"GDP\",\n)\nStatsPlots.errorline!(\n 1:Te,\n data_vec_shocked.real_gdp,\n errortype = :sem,\n label = \"shock\",\n titlefont = 10,\n xlabel = \"quarters\",\n ylabel = \"GDP\",\n)","category":"page"},{"location":"examples/scenario_analysis_via_shock.html","page":"Shocked simulations","title":"Shocked simulations","text":"Note that, importantly, once the function central_bank_rate has been changed, the model will use the new interest rate in all the simulations, unless the function is changed again. To restore the original interest rate, we can simply re-import the function central_bank_rate.","category":"page"},{"location":"api.html","page":"API","title":"API","text":"CurrentModule = BeforeIT ","category":"page"},{"location":"api.html","page":"API","title":"API","text":"Pages = [\"api.md\"]","category":"page"},{"location":"api.html#Code-reference","page":"API","title":"Code reference","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"In this page we document the functions which constitute the bulk of BeforeIT.jl functionality.","category":"page"},{"location":"api.html#Agent-types","page":"API","title":"Agent types","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"agents.jl\"]","category":"page"},{"location":"api.html#BeforeIT.Aggregates","page":"API","title":"BeforeIT.Aggregates","text":"This is a Aggregates type. It is used to store the aggregate variables of the economy. Note that t is an integer, while the rest are floats or vectors of floats.\n\nFields\n\nY [vector]: GDP data + predictions\npi_ [vector]: inflation data + predictions\nP_bar: Global price index\nP_bar_g [vector]: Producer price index for principal good g\nP_bar_HH: Consumer price index\nP_bar_CF: Capital price index\nP_bar_h: CPI_h\nP_bar_CF_h: Capital price index _h\nY_e: Expected GDP\ngamma_e: Expected growth\npi_e: Expected inflation\nt: Time index\n\n\n\n\n\n","category":"type"},{"location":"api.html#BeforeIT.Bank","page":"API","title":"BeforeIT.Bank","text":"This is a Bank type. It represents the bank of the model.\n\nFields\n\nE_k: equity capital (common equity) of the bank\nPi_k: Profits of the bank\nPi_e_k: Expected profits of the bank\nD_k: Residual and balancing item on the bank’s balance sheet\nr: Rate for loans and morgages\n\nHousehold fields (bank' owner)\n\nY_h: Net disposable income of bank owner (investor)\nC_d_h: Consumption budget\nI_d_h: Investment budget\nC_h: Realised consumption\nI_h: Realised investment\nK_h: Capital stock\nD_h: Deposits\n\n\n\n\n\n","category":"type"},{"location":"api.html#BeforeIT.CentralBank","page":"API","title":"BeforeIT.CentralBank","text":"This is a CentralBank type. It represents the central bank of the model.\n\nFields\n\nr_bar: Nominal interest rate\nr_G: Interest rate on government bonds\nrho: Parameter for gradual adjustment of the policy rate\nr_star: Real equilibrium interest rate\npi_star: Inflation target by CB\nxi_pi: Weight the CB puts on inflation targeting\nxi_gamma: Weight placed on economic\nE_CB: Central bank equity\n\n\n\n\n\n","category":"type"},{"location":"api.html#BeforeIT.Firms","page":"API","title":"BeforeIT.Firms","text":"This is a Firms type. Each field is an array which stores the values for all the firms in the economy. Note that the G_i, N_i and V_i fields are integers, while the rest are floats.\n\nFor all fields the entry at index i corresponds to the ith firm.\n\nFields\n\nG_i: Principal product\nalpha_bar_i: Average productivity of labor\nbeta_i: Productivity of intermediate consumption\nkappa_i: Productivity of capital\nw_i: Wages\nw_bar_i: Average wage rate\ndelta_i: Depreciation rate for capital\ntau_Y_i: Net tax rate on products\ntau_K_i: Net tax rate on production\nN_i: Number of persons employed\nY_i: Production of goods\nQ_i: Sales of goods\nQ_d_i: Demand for goods\nP_i: Price\nS_i: Inventories\nK_i: Capital, in real terms\nM_i: Intermediate goods/services and raw materials, in real terms\nL_i: Outstanding loans\npi_bar_i: Operating margin\nD_i: Deposits of the firm\nPi_i: Profits\nV_i: Vacancies\nI_i: Investments\nE_i: Equity\nP_bar_i: Price index\nP_CF_i: Price index\nDS_i: Differnece in stock of final goods\nDM_i: Difference in stock of intermediate goods\nDL_i: Obtained loans\nDL_d_i: Target loans\nK_e_i: Expected capital \nL_e_i: Expected loans\nQ_s_i: Expected sales\nI_d_i: Desired investments\nDM_d_i: Desired materials\nN_d_i: Desired employment\nPi_e_i: Expected profits\n\nHousehold fields (firms' owners)\n\nY_h: Net disposable income of firm owner (investor)\nC_d_h: Consumption budget\nI_d_h: Investment budget\nC_h: Realised consumption\nI_h: Realised investment\nK_h: Capital stock\nD_h: Deposits of the owner of the firms\n\n\n\n\n\n","category":"type"},{"location":"api.html#BeforeIT.Government","page":"API","title":"BeforeIT.Government","text":"This is a Government type. It represents the government of the model.\n\nFields\n\nalpha_G: Autoregressive coefficient for government consumption\nbeta_G: Scalar constant for government consumption\nsigma_G: Variance coefficient for government consumption\nY_G: Government revenues\nC_G: Consumption demand of the general government\nL_G: Loans taken out by the government\nsb_inact: Social benefits for inactive persons\nsb_other: Social benefits for all\nC_d_j [vector]: Local governments consumption demand\nC_j: Realised government consumption\nP_j: Price inflation of government goods <- ??\n\n\n\n\n\n","category":"type"},{"location":"api.html#BeforeIT.Model","page":"API","title":"BeforeIT.Model","text":"This is a Model type. It is used to store all the agents of the economy.\n\nFields\n\nw_act: Workers that are active\nw_inact: Workers that are inactive\nfirms: Firms\nbank: Bank\ncb: CentralBank\ngov: Government\nrotw: RestOfTheWorld\nagg: Aggregates\n\n\n\n\n\n","category":"type"},{"location":"api.html#BeforeIT.RestOfTheWorld","page":"API","title":"BeforeIT.RestOfTheWorld","text":"This is a RestOfTheWorld type. It represents the rest of the world of the model.\n\nFields\n\nalpha_E: Autoregressive coefficient for exports\nbeta_E: Scalar constant for exports\nsigma_E: Variance coefficient for exports\nalpha_I: Autoregressive coefficient for imports\nbeta_I: Scalar constant for imports\nsigma_I: Variance coefficient for imports\nY_EA: GDP euro area\ngamma_EA: Growth euro area\npi_EA: Inflation euro area\nalpha_pi_EA: Autoregressive coefficient for euro area inflation\nbeta_pi_EA: Autoregressive coefficient for euro area inflation Scalar constant for euro area inflation\nsigma_pi_EA: Variance coefficient for euro area inflation\nalpha_Y_EA: Autoregressive coefficient for euro area GDP\nbeta_Y_EA: Autoregressive coefficient for euro area GDP Scalar constant for euro area GDP\nsigma_Y_EA: Variance coefficient for euro area GDP\nD_RoW: Net creditor/debtor position of the national economy to the rest of the world\nY_I: Supply of imports (in real terms)\nC_E: Total demand for exports\nC_d_l [vector]: Demand for exports of specific product\nC_l: Realised consumption by foreign consumers\nY_m [vector]: Supply of imports per sector\nQ_m [vector]: Sales for imports per sector\nQ_d_m [vector]: Demand for goods\nP_m [vector]: Price of imports per sector\nP_l: Price inflation of exports <- ??\n\n\n\n\n\n","category":"type"},{"location":"api.html#BeforeIT.Workers","page":"API","title":"BeforeIT.Workers","text":"This is a Workers. Each field is an array which stores the values for all the workers in the economy. Note that the O_h field is an integer, while the rest are floats.\n\nFor all fields the entry at index i corresponds to the ith worker.\n\nFields\n\nY_h: Net disposable income of worker owner (investor)\nD_h: Deposits\nK_h: Capital stock\nw_h: Wages (0 if inactive or unemployed)\nO_h: Occupation (0 if unemployed, -1 if inactive)\nC_d_h: Consumption budget\nI_d_h: Investment budget\nC_h: Realised consumption\nI_h: Realised investment\n\n\n\n\n\n","category":"type"},{"location":"api.html#Initialisation-function","page":"API","title":"Initialisation function","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"init.jl\"]","category":"page"},{"location":"api.html#BeforeIT.init_model","page":"API","title":"BeforeIT.init_model","text":"init_model(parameters, initial_conditions, T, typeInt = Int64, typeFloat = Float64)\n\nInitializes the model with given parameters and initial conditions.\n\nParameters:\n\nparameters: A dictionary containing the model parameters.\ninitial_conditions: A dictionary containing the initial conditions.\nT (integer): The time horizon of the model.\ntypeInt: (optional, default: Int64): The data type to be used for integer values.\ntypeFloat: (optional, default: Float64): The data type to be used for floating-point values.\n\nReturns:\n\nmodel::Model: The initialized model.\n\n\n\n\n\n","category":"function"},{"location":"api.html#BeforeIT.update_variables_with_totals!-Tuple{Model}","page":"API","title":"BeforeIT.update_variables_with_totals!","text":"update_variables_with_totals!(model::Model)\n\nUpdate the variables in the given model with some global quantities obtained from all agents. This is the last step in the initialization process and it must be performed after all agents have been initialized.\n\nArguments\n\nmodel::Model: The model object to update.\n\nReturns\n\nNothing\n\n\n\n\n\n","category":"method"},{"location":"api.html#Functions-to-run-an-entire-simulation","page":"API","title":"Functions to run an entire simulation","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"one_epoch.jl\", \"one_simulation.jl\"]","category":"page"},{"location":"api.html#BeforeIT.run_one_epoch!-Tuple{Any}","page":"API","title":"BeforeIT.run_one_epoch!","text":"run_one_epoch!(model; multi_threading = false)\n\nThis function simulates a single epoch the economic model, updating various components of the model based the interactions between different economic agents. It accepts a model object, which encapsulates the state for the simulation, and an optional boolean parameter multi_threading to enable or disable multi-threading.\n\nKey operations performed include:\n\nFinancial adjustments for firms and banks, including insolvency checks and profit calculations.\nEconomic expectations and adjustments, such as growth, inflation, and central bank rates.\nLabor and credit market operations, including wage updates and loan processing.\nHousehold economic activities, including consumption and investment budgeting.\nGovernment and international trade financial activities, including budgeting and trade balances.\nGeneral market matching and accounting updates to reflect changes in economic indicators and positions.\n\nThe function updates the model in-place and does not return any value.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.run_n_sims-Tuple{Any, Any}","page":"API","title":"BeforeIT.run_n_sims","text":"run_n_sims(model, n_sims; shock = NoShock(), multi_threading = true)\n\nA function that runs n_sims simulations in parallel with multiple threading and returns a vector of data objects of dimension n_sims.\n\nArguments\n\nmodel: The model configuration used to simulate.\nn_sims: The number of simulations to run in parallel.\n\nReturns\n\ndata_vector: A vector containing the data objects collected during each simulation.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.run_one_sim!-Tuple{Any}","page":"API","title":"BeforeIT.run_one_sim!","text":"run_one_sim!(model; shock = NoShock())\n\nRun a single simulation based on the provided model. The simulation runs for a number of epochs specified by model.prop.T.\n\nArguments\n\nmodel::Model: The model configuration used for the simulation.\n\nReturns\n\ndata::Data: The data collected during the simulation.\n\nDetails\n\nThe function initializes the data using BeforeIT.init_data(model), then iteratively updates the model and data for each epoch using BeforeIT.run_one_epoch!(model) and BeforeIT.update_data!(data, model) respectively.\n\nExample\n\n```julia model = BeforeIT.initmodel(parameters, initialconditions, T) data = runonesim!(model)\n\n\n\n\n\n","category":"method"},{"location":"api.html#Firms-actions","page":"API","title":"Firms actions","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"firms.jl\"]","category":"page"},{"location":"api.html#BeforeIT.firms_deposits-Tuple{Any, Any}","page":"API","title":"BeforeIT.firms_deposits","text":"firms_deposits(firms, model)\n\nCalculate the new deposits of firms.\n\nArguments\n\nfirms: Firms object\nmodel: Model object\n\nReturns\n\nDD_i: Vector of new deposits\n\nThe new deposits DD_i are calculated as follows:\n\nDD_i = sales + labour_cost + material_cost + taxes_products + taxes_production + corporate_tax + dividend_payments + interest_payments + interest_received + investment_cost + new_credit + debt_installment\n\nwhere:\n\nsales = P_i * Q_i\nlabour_cost = (1 + tau_SIF) * w_i * N_i * P_bar_HH\nmaterial_cost = -DM_i * P_bar_i\ntaxes_products = -tau_Y_i * P_i * Y_i\ntaxes_production = -tau_K_i * P_i * Y_i\ncorporate_tax = -tau_FIRM * pos(Pi_i)\ndividend_payments = -theta_DIV * (1 - tau_FIRM) * pos(Pi_i)\ninterest_payments = -r * (L_i + pos(-D_i))\ninterest_received = r_bar * pos(D_i)\ninvestment_cost = -P_CF_i * I_i\nnew_credit = DL_i\ndebt_installment = -theta * L_i\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.firms_equity-Tuple{Any, Any}","page":"API","title":"BeforeIT.firms_equity","text":"firms_equity(firms, model)\n\nCalculate the equity of firms.\n\nArguments\n\nfirms: Firms object\nmodel: Model object\n\nReturns\n\nE_i: Vector of equity\n\nThe equity E_i is calculated as follows:\n\nE_i = D_i + M_i * sum(a_sg G_i * barP_g) + P_i * S_i + barP_CF * K_i - L_i\n\nwhere:\n\nD_i: Deposits\nM_i: Intermediate goods\na_sg: Technology coefficient of the gth product in the sth industry\nG_i: Vector of goods\nP_bar_g: Producer price index for principal good g\nP_i: Price\nS_i: Stock\nP_bar_CF: Capital price index\nK_i: Capital stock\nL_i: Loans\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.firms_expectations_and_decisions-Tuple{Any, Any}","page":"API","title":"BeforeIT.firms_expectations_and_decisions","text":"firms_expectations_and_decisions(firms, model)\n\nCalculate the expectations and decisions of firms. That is: compute firm quantity, price, investment and intermediate-goods, employment decisions, expected profits, and desired/expected loans and capital.\n\nArguments\n\nfirms: Firms object\nmodel: Model object\n\nReturns\n\nQ_s_i: Vector of desired quantities\nI_d_i: Vector of desired investments\nDM_d_i: Vector of desired intermediate goods\nN_d_i: Vector of desired employment\nPi_e_i: Vector of expected profits\nDL_d_i: Vector of desired new loans\nK_e_i: Vector of expected capital\nL_e_i: Vector of expected loans\nP_i: Vector of prices\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.firms_loans-Tuple{Any, Any}","page":"API","title":"BeforeIT.firms_loans","text":"firms_loans(firms, model)\n\nCalculate the new loans of firms.\n\nArguments\n\nfirms: Firms object\nmodel: Model object\n\nReturns\n\nL_i: Vector of new loans\n\nThe new loans L_i are calculated as follows:\n\nL_i = (1 - theta) * L_i + DL_i\n\nwhere:\n\ntheta: Rate of repayment\nL_i: Loans\nDL_i: Acquired new loans\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.firms_production-Tuple{AbstractFirms}","page":"API","title":"BeforeIT.firms_production","text":"firms_production(firms)\n\nCalculate the production of firms.\n\nArguments\n\nfirms: Firms object\n\nReturns\n\nY_i: Vector of production\n\nThe production Y_i is computed using a Leontief technology.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.firms_profits-Tuple{AbstractFirms, Model}","page":"API","title":"BeforeIT.firms_profits","text":"firms_profits(firms, model)\n\nCalculate the profits of firms.\n\nArguments\n\nfirms: Firms object\nmodel: Model object\n\nReturns\n\nPi_i: Vector of profits\n\nThe profits Pi_i are calculated as follows:\n\nPi_i = in_sales + in_deposits - out_wages - out_expenses - out_depreciation - out_taxes_prods - out_taxes_capital - out_loans\n\nwhere:\n\nin_sales = P_i * Q_i + P_i * DS_i\nin_deposits = r_bar * pos(D_i)\nout_wages = (1 + tau_SIF) * w_i * N_i * P_bar_HH\nout_expenses = 1 / beta_i * P_bar_i * Y_i\nout_depreciation = delta_i / kappa_i * P_CF_i * Y_i\nout_taxes_prods = tau_Y_i * P_i * Y_i\nout_taxes_capital = tau_K_i * P_i * Y_i\nout_loans = r * (L_i + pos(-D_i))\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.firms_stocks-Tuple{Any}","page":"API","title":"BeforeIT.firms_stocks","text":"firms_stocks(firms)\n\nCalculate the stocks of firms.\n\nArguments\n\nfirms: Firms object\n\nReturns\n\nK_i: Vector of capital stock\nM_i: Vector of intermediate goods\nDS_i: Vector of differneces in stock of final goods\nS_i: Vector of stock of final goods\n\nThe stocks are calculated as follows:\n\nK_i = K_i - delta_i / kappa_i * Y_i + I_i\nM_i = M_i - Y_i / beta_i + DM_i\nDS_i = Y_i - Q_i\nS_i = S_i + DS_i\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.firms_wages-Tuple{AbstractFirms}","page":"API","title":"BeforeIT.firms_wages","text":"firms_wages(firms)\n\nCalculate the wages set by firms.\n\nArguments\n\nfirms: Firms object\n\nReturns\n\nw_i: Vector of wages\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.init_firms-Tuple{Any, Any}","page":"API","title":"BeforeIT.init_firms","text":"init_firms(parameters, initial_conditions; typeInt = Int64, typeFloat = Float64)\n\nInitialize firms with given parameters and initial conditions.\n\nArguments\n\nparameters: The parameters for initializing the firms.\ninitial_conditions: The initial conditions for the firms.\ntypeInt: (optional) The integer type to be used. Default is Int64.\ntypeFloat: (optional) The floating-point type to be used. Default is Float64.\n\nReturns\n\nfirms::Firms: The initialized firms.\nfirms_args::Tuple: The arguments used to initialize the firms.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.leontief_production-NTuple{7, Any}","page":"API","title":"BeforeIT.leontief_production","text":"leontief_production(Q_s_i, N_i, alpha_i, K_i, kappa_i, M_i, beta_i)\n\nCalculate the production function of firms.\n\nArguments\n\nQ_s_i: Vector of desired quantities\nN_i: Vector of employment\nalpha_i: Vector of labour productivity\nK_i: Vector of capital stock\nkappa_i: Vector of capital productivity\nM_i: Vector of intermediate goods\nbeta_i: Vector of intermediate goods productivity\n\nReturns\n\nY_i: Vector of production\n\nThe Leontief production function Y_i is calculated as follows:\n\nY_i = min(Q_s_i min(N_i cdot alpha_i min(K_i cdot kappa_i M_i cdot beta_i)))\n\n\n\n\n\n","category":"method"},{"location":"api.html#Households-actions","page":"API","title":"Households actions","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"households.jl\"]","category":"page"},{"location":"api.html#Government-actions","page":"API","title":"Government actions","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"government.jl\"]","category":"page"},{"location":"api.html#BeforeIT.gov_expenditure-Tuple{Any, Any}","page":"API","title":"BeforeIT.gov_expenditure","text":"gov_expenditure(gov::AbstractGovernment, model)\n\nComputes government expenditure on consumption and transfers to households.\n\nArguments\n\ngov: government object\nmodel: model object\n\nReturns\n\nC_G: government consumption\nC_d_j: local government consumptions\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.gov_loans-Tuple{Any, Any}","page":"API","title":"BeforeIT.gov_loans","text":"gov_loans(gov::AbstractGovernment, model, Y_G)\n\nComputes government new government debt.\n\nArguments\n\ngov::AbstractGovernment: government object\nmodel: model object\n\nReturns\n\nL_G: new government debt\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.gov_revenues-Tuple{Model}","page":"API","title":"BeforeIT.gov_revenues","text":"gov_revenues(model)\n\nComputes government revenues from taxes and social security contributions. The government collects taxes on labour income, capital income, value added, and corporate income. It also collects social security contributions from workers and firms. The government also collects taxes on consumption and capital formation. Finally, the government collects taxes on exports and imports.\n\nArguments\n\nmodel: model object\n\nReturns\n\nY_G: government revenues\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.gov_social_benefits-Tuple{AbstractGovernment, Any}","page":"API","title":"BeforeIT.gov_social_benefits","text":"gov_social_benefits(gov::AbstractGovernment, model)\n\nComputes social benefits paid by the government households.\n\nArguments\n\ngov: government object\nmodel: model object\n\nReturns\n\nsb_other: social benefits for other households\nsb_inact: social benefits for inactive households\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.init_government-Tuple{Any, Any}","page":"API","title":"BeforeIT.init_government","text":"init_government(parameters, initial_conditions; typeInt = Int64, typeFloat = Float64)\n\nInitialize the government agent.\n\nArguments\n\nparameters: The parameters.\ninitial_conditions: The initial conditions.\ntypeInt: The integer type to be used (default: Int64).\ntypeFloat: The floating-point type to be used (default: Float64).\n\nReturns\n\nThe initialized government model.\nThe arguments used to initialize the government model.\n\n\n\n\n\n","category":"method"},{"location":"api.html#Bank-and-Central-Bank-actions","page":"API","title":"Bank and Central Bank actions","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"bank.jl\"]","category":"page"},{"location":"api.html#BeforeIT._bank_deposits-NTuple{7, Any}","page":"API","title":"BeforeIT._bank_deposits","text":"_deposit_bank(waD_h, wiD_h, fD_h, bD_h, fD_i, bE_k, fL_i)\n\nHelper function to calculate the new deposits of a bank.\n\nArguments\n\nwaD_h: Array of deposits from active workers\nwiD_h: Array of deposits from inactive workers\nfD_h: Array of deposits from firms\nbD_h: Deposits from the bank owner\nfD_i: Array of deposits from firms\nbE_k: Bank equity\nfL_i: Array of loans to firms\n\nReturns\n\nD_k: New deposits of the bank\n\nThe new deposits D_k are calculated as the sum of the deposits of the active workers, the inactive workers, the firms, and the bank owner itself, plus the bank's equity, minus the loans of the firms.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT._bank_profits-Union{Tuple{T}, Tuple{AbstractVector{T}, AbstractVector{T}, AbstractVector{T}, T, T, T}} where T","page":"API","title":"BeforeIT._bank_profits","text":"_bank_profits(L_i, D_i, D_h, D_k, r_bar, r)\n\nHelper function to calculate the total profits of a bank.\n\nArguments\n\nL_i: Array of loans provided by the bank\nD_i: Array of deposits from firms\nD_h: Array of deposits from households\nD_k: Residual and balancing item on the bank’s balance sheet\nr_bar: Base interest rate\nr: Interest rate set by the bank\n\nReturns\n\nPi_k: Total profits of the bank\n\nThe total profits Pi_k are calculated as follows:\n\nPi_k = r cdot sum_i(L_i + max(0 -D_i)) + r cdot sum_h(max(0 -D_h)) + r_bar \ncdot max(0 D_k) - r_bar cdot sum_i(max(0 D_i)) - r_bar cdot \nsum_h(max(0 D_h)) - r_bar cdot max(0 -D_k)\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT._central_bank_profits-NTuple{4, Any}","page":"API","title":"BeforeIT._central_bank_profits","text":"_central_bank_profits(r_bar, D_k, L_G, r_G)\n\nHelper function to calculate the profits of a central bank.\n\nArguments\n\nr_bar: The base interest rate\nD_k: Deposits from commercial banks\nL_G: Loans provided to the government\nr_G: Interest rate on government loans\n\nReturns\n\nPi_CB: Profits of the central bank\n\nThe profits Pi_CB are calculated as follows:\n\nPi_CB = r_G cdot L_G - r_bar cdot D_k\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.bank_deposits-Tuple{Any, Any}","page":"API","title":"BeforeIT.bank_deposits","text":"deposits_bank(bank, w_act, w_inact, firms)\n\nCalculate the new deposits of a bank.\n\nArguments\n\nbank: The Bank object containing the bank of the model\nw_act: The Workers object containing the active workers of the model\nw_inact: The Workers object containing the inactive workers of the model\nfirms: The Firms object containing the firms of the model\n\nReturns\n\nD_k: New deposits of the bank\n\nThe new deposits D_k are calculated as the sum of the deposits of the active workers, the inactive workers, the firms, and the bank owner itself, plus the bank's equity, minus the loans of the firms.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.bank_equity-Tuple{Any, Any}","page":"API","title":"BeforeIT.bank_equity","text":"bank_equity(bank, model)\n\nCalculate the net profits of a bank.\n\nArguments\n\nbank: The bank object.\nmodel: The model object.\n\nReturns\n\nE_k: The updated equity of the bank.\n\nThe net profits DE_k are calculated as:\n\nDE_k = Pi_k - theta_DIV cdot (1 - tau_FIRM) cdot max(0 Pi_k) - tau_FIRM cdot max(0 Pi_k)\n\nand the equity E_k is updated as:\n\nE_k = E_k + DE_k\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.bank_expected_profits-Tuple{Any, Any}","page":"API","title":"BeforeIT.bank_expected_profits","text":"bank_expected_profits(Pi_k, pi_e, gamma_e)\n\nCalculate the expected profits of a bank.\n\nArguments\n\nPi_k: Past profits of the bank\npi_e: Expected inflation rate\ngamma_e: Expected growth rate\n\nReturns\n\nE_Pi_k: Expected profits of the bank\n\nThe expected profits E_Pi_k are calculated as follows:\n\nE_Pi_k = Pi_k cdot (1 + pi_e) cdot (1 + gamma_e)\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.bank_profits-Tuple{Any, Any}","page":"API","title":"BeforeIT.bank_profits","text":"bank_profits(bank, model)\n\nCalculate the total profits of a bank.\n\nArguments\n\nbank: The bank object.\nmodel: The model object.\n\nReturns\n\nPi_k: The total profits of the bank.\n\nThe total profits Pi_k are calculated as:\n\nPi_k = r cdot sum_i(L_i + max(0 -D_i)) + r cdot sum_h(max(0 -D_h)) + r_bar\ncdot max(0 D_k) - r_bar cdot sum_i(max(0 D_i)) - r_bar cdot\nsum_h(max(0 D_h)) - r_bar cdot max(0 -D_k)\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.bank_rate-Tuple{Any, Any}","page":"API","title":"BeforeIT.bank_rate","text":"bank_rate(bank, model)\n\nUpdate the interest rate set by the bank.\n\nArguments\n\nbank: The bank whose interest rate is to be updated\nmodel: Model object\n\nReturns\n\nr: The updated interest rate\n\nr = barr + mu\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.central_bank_equity-Tuple{Any, Any}","page":"API","title":"BeforeIT.central_bank_equity","text":"central_bank_equity(cb, model)\n\nCalculate the equity of the central bank.\n\nArguments\n\ncb: The central bank\nmodel: The model object\n\nReturns\n\nE_CB: The equity of the central bank\n\nThe equity E_CB is calculated as follows:\n\nE_CB = E_CB + Pi_CB\n\nwhere \\Pi_{CB} are the profits of the central bank.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.central_bank_rate-Tuple{AbstractCentralBank, Model}","page":"API","title":"BeforeIT.central_bank_rate","text":"central_bank_rate(cb, model)\n\nUpdate the base interest rate set by the central bank according to the Taylor rule.\n\nArguments\n\ncb: The central bank whose base interest rate is to be updated\nmodel: The model object\n\nReturns\n\nr_bar: The updated base interest rate\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.finance_insolvent_firms!-Tuple{AbstractFirms, AbstractBank, Any}","page":"API","title":"BeforeIT.finance_insolvent_firms!","text":"finance_insolvent_firms!(firms, bank, P_bar_CF, zeta_b, insolvent)\n\nRifinance insolvent firms using bank equity.\n\nArguments\n\nfirms: The Firms object containing the firms of the model\nbank: The Bank object containing the bank of the model\nP_bar_CF: Capital price index\nzeta_b: Parameter of loan-to-capital ratio for new firms after bankruptcy\n\nReturns\n\nThis function does not return a value. It modifies the banks and firms collections in-place.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.taylor_rule-Union{Tuple{T}, NTuple{8, T}} where T","page":"API","title":"BeforeIT.taylor_rule","text":"taylor_rule(rho, r_bar, r_star, pi_star, xi_pi, xi_gamma, gamma_EA, pi_EA)\n\nCalculate the interest rate according to the Taylor rule.\n\nArguments\n\nrho: Parameter for gradual adjustment of the policy rate.\nr_bar: Nominal interest rate.\nr_star: Real equilibrium interest rate.\npi_star: The target inflation rate.\nxi_pi: Weight the CB puts on inflation targeting.\nxi_gamma: Weight placed on economic growth.\ngamma_EA: The output growth rate.\npi_EA: The inflation rate.\n\nReturns\n\nrate: The calculated interest rate.\n\nThe Taylor rule is given by the following equation:\n\nr_t = ρ * r_t-1 + (1 - ρ) * (r^* + π^* + ξ_π * (π_t - π^*) + ξ_γ * γ_t)\n\n\n\n\n\n","category":"method"},{"location":"api.html#Rest-Of-The-World-actions","page":"API","title":"Rest Of The World actions","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"rotw.jl\"]","category":"page"},{"location":"api.html#BeforeIT.rotw_deposits-Tuple{Any, Any}","page":"API","title":"BeforeIT.rotw_deposits","text":"rotw_deposits(rotw, tau_EXPORT)\n\nCalculate the deposits of the rest of the world.\n\nArguments\n\nrotw: The rest of the world object.\ntau_EXPORT: The export tax.\n\nReturns\n\nD_RoW: The deposits of the rest of the world.\n\nThe deposits D_RoW are calculated as follows:\n\nD_RoW = D_RoW + left( sum_m P_m cdot Q_m right) - (1 + tau_EXPORT) cdot C_l\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.rotw_import_export-Tuple{Any, Any}","page":"API","title":"BeforeIT.rotw_import_export","text":"rotw_import_export(rotw, model, pi_e, epsilon_E, epsilon_I)\n\nCalculate the demand for exports and supply of imports of the rest of the world.\n\nArguments\n\nrotw: The rest of the world object.\nmodel: The model object.\n\nReturns\n\nC_E: Total demand for exports.\nY_I: Supply of imports (in real terms).\nC_d_l: TDemand for exports of specific product.\nY_m: Supply of imports per sector.\nP_m: Price of imports per sector.\n\n\n\n\n\n","category":"method"},{"location":"api.html#Markets","page":"API","title":"Markets","text":"","category":"section"},{"location":"api.html","page":"API","title":"API","text":"Modules = [BeforeIT]\nOrder = [:type, :function]\nPages = [\"search_and_matching_credit.jl\", \"search_and_matching_labour.jl\", \"search_and_matching.jl\"]","category":"page"},{"location":"api.html#BeforeIT.search_and_matching_credit-Tuple{AbstractFirms, Any}","page":"API","title":"BeforeIT.search_and_matching_credit","text":"search_and_matching_credit(firms::Firms, model)\n\nThis function calculates the credit allocation for each firm in the given firms object.\n\nParameters:\n\nfirms::Firms: The firms object.\nmodel: The model object.\n\nReturns:\n\nDL_i: An array of credit allocations for each firm.\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.search_and_matching_labour-Tuple{AbstractFirms, Any}","page":"API","title":"BeforeIT.search_and_matching_labour","text":"search_and_matching_labour(firms::Firms, model)\n\nThis function implements a labor search and matching algorithm. It takes in a Firms object and a Model object as input. The Firms object contains information about the number of desired employees (N_d_i) and the current number of employees (N_i) for each firm. The model object contains information about the current employment status (O_h) of each worker.\n\nThe function performs the following steps:\n\nCalculates the vacancies (V_i) for each firm as the difference between desired and current employees.\nIdentifies employed workers and shuffles them randomly.\nFires workers from firms with negative vacancies to adjust the workforce.\nIdentifies unemployed workers and firms with positive vacancies.\nRandomly matches unemployed workers to firms with vacancies until all vacancies are filled or there are no more unemployed workers.\n\nThe function returns:\n\nN_i: An updated array of the number of employed workers for each firm.\nO_h: An updated array where each element represents the firm a worker is employed with (0 if unemployed).\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.perform_firms_market!-NTuple{15, Any}","page":"API","title":"BeforeIT.perform_firms_market!","text":"Perform the firms market exchange process\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.perform_retail_market!-NTuple{31, Any}","page":"API","title":"BeforeIT.perform_retail_market!","text":"Perform the retail market exchange process\n\n\n\n\n\n","category":"method"},{"location":"api.html#BeforeIT.search_and_matching!","page":"API","title":"BeforeIT.search_and_matching!","text":"search_and_matching!(model, multi_threading::Bool = false)\n\nThis function performs a search and matching algorithm for firms and for retail markets. It takes in a model object and an optional boolean argument for multi-threading. The function loops over all goods and performs the firms market and retail market operations for each good. Finally, it updates the aggregate variables based on the results of markets.\n\nArgs:\n\nmodel: The model object\nmulti_threading: A boolean indicating whether to use multi-threading for the algorithm. Default is false.\n\nThis function updates the model in-place and does not return any value.\n\n\n\n\n\n","category":"function"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"EditURL = \"../../../examples/basic_example.jl\"","category":"page"},{"location":"examples/basic_example.html#Essential-use-of-BeforeIT","page":"Essentials","title":"Essential use of BeforeIT","text":"","category":"section"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"We start by importing the BeforeIT library and other useful libraries.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"import BeforeIT as Bit\nusing FileIO, Plots","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"We then initialise the model loading some precomputed set of parameters and by specifying a number of epochs. In another tutorial we will illustrate how to compute parameters and initial conditions.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"parameters = Bit.AUSTRIA2010Q1.parameters\ninitial_conditions = Bit.AUSTRIA2010Q1.initial_conditions","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"We can now initialise the model, by specifying in advance the maximum number of epochs.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"T = 16\nmodel = Bit.init_model(parameters, initial_conditions, T)","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"Note that the it is very simple to inspect the model by typing","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"fieldnames(typeof(model))","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"and to inspect the specific attributes of one agent type by typing","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"fieldnames(typeof(model.bank))","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"We can now define a data tracker, which will store the time series of the model.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"data = Bit.init_data(model);\nnothing #hide","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"We can run now the model for a number of epochs and progressively update the data tracker.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"for t in 1:T\n Bit.run_one_epoch!(model; multi_threading = true)\n Bit.update_data!(data, model)\nend","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"Note that we can equivalently run the model for a number of epochs in the single command data = BeforeIT.run_one_sim!(model), but writing the loop explicitely is more instructive.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"We can then plot any time series stored in the data tracker, for example","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"plot(data.real_gdp, title = \"gdp\", titlefont = 10)","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"Or we can plot multiple time series at once using the function plot_data","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"ps = Bit.plot_data(data, quantities = [:real_gdp, :real_household_consumption, :real_government_consumption, :real_capitalformation, :real_exports, :real_imports, :wages, :euribor, :gdp_deflator])\nplot(ps..., layout = (3, 3))","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"To run multiple monte-carlo repetitions in parallel we can use","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"model = Bit.init_model(parameters, initial_conditions, T)\ndata_vector = Bit.run_n_sims(model, 4)","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"Note that this will use the number of threads specified when activating the Julia environment. To discover the number of threads available, you can use the command","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"Threads.nthreads()","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"To activate Julia with a specific number of threads, say 8, you can use the command julia -t 8 in the terminal.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"We can then plot the results of the monte-carlo repetitions using the function plot_data_vector","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"ps = Bit.plot_data_vector(data_vector)\nplot(ps..., layout = (3, 3))","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"EditURL = \"../../../examples/change_expectations.jl\"","category":"page"},{"location":"examples/change_expectations.html#Changing-expectations-via-function-overloading","page":"Experimentations (advanced)","title":"Changing expectations via function overloading","text":"","category":"section"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"In this tutorial we will illustrate how to experiment with different expectations of the agents in the model.","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"import BeforeIT as Bit\nusing Random, Plots","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Import standard parameters and initial conditions","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"par = Bit.AUSTRIA2010Q1.parameters\ninit = Bit.AUSTRIA2010Q1.initial_conditions","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Set the seed, initialise the model and run one simulation","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Random.seed!(1234)\nT = 40\nmodel = Bit.init_model(par, init, T)\ndata = Bit.run_one_sim!(model)","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Now we can experiment with changing expectations of the agents in the model. We will change the function estimate_next_value to make the agents expect the last value of the time series (so to represent backward looking expectations)","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"import BeforeIT: estimate_next_value\nfunction estimate_next_value(data)\n return data[end]\nend","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Run the model again, with the same seed","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Random.seed!(1234)\nmodel = Bit.init_model(par, init, T)\ndata_back = Bit.run_one_sim!(model)","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Plot the results, comparing the two cases as different lines","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"p1 = plot(data.real_gdp, title = \"gdp\", titlefont = 10, label = \"forward looking\")\nplot!(p1, data_back.real_gdp, titlefont = 10, label = \"backward looking\")\n\np2 = plot(data.real_household_consumption, title = \"consumption\", titlefont = 10)\nplot!(p2, data_back.real_household_consumption, titlefont = 10, label = \"backward looking\")\n\nplot(p1, p2, layout = (2, 1), legend = true)","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Plot all time series","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"p1 = plot(data.real_gdp, title = \"gdp\", titlefont = 10)\nplot!(p1, data_back.real_gdp, titlefont = 10)\np2 = plot(data.real_household_consumption, title = \"household cons.\", titlefont = 10)\nplot!(p2, data_back.real_household_consumption, titlefont = 10)\np3 = plot(data.real_government_consumption, title = \"gov. cons.\", titlefont = 10)\nplot!(p3, data_back.real_government_consumption, titlefont = 10)\np4 = plot(data.real_capitalformation, title = \"capital form.\", titlefont = 10)\nplot!(p4, data_back.real_capitalformation, titlefont = 10)\np5 = plot(data.real_exports, title = \"exports\", titlefont = 10)\nplot!(p5, data_back.real_exports, titlefont = 10)\np6 = plot(data.real_imports, title = \"imports\", titlefont = 10)\nplot!(p6, data_back.real_imports, titlefont = 10)\np7 = plot(data.wages, title = \"wages\", titlefont = 10)\nplot!(p7, data_back.wages, titlefont = 10)\np8 = plot(data.euribor, title = \"euribor\", titlefont = 10)\nplot!(p8, data_back.euribor, titlefont = 10)\np9 = plot(data.nominal_gdp ./ data.real_gdp, title = \"gdp deflator\", titlefont = 10)\nplot!(p9, data_back.nominal_gdp ./ data_back.real_gdp, titlefont = 10)\n\nplot(p1, p2, p3, p4, p5, p6, p7, p8, p9, layout = (3, 3), legend = false)","category":"page"},{"location":"examples/change_expectations.html","page":"Experimentations (advanced)","title":"Experimentations (advanced)","text":"Note that, importantly, once the function estimate_next_value has been changed, the model will use the new expectations in all the simulations, unless the function is changed again. To restore the original expectations you could close the Julia session.","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"EditURL = \"../../../examples/scenario_analysis_via_overload.jl\"","category":"page"},{"location":"examples/scenario_analysis_via_overload.html#Scenario-analysis-via-function-overloading","page":"Shocked simulations (advanced)","title":"Scenario analysis via function overloading","text":"","category":"section"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"In this tutorial we will illustrate how to perform a scenario analysis by running the model multiple times under a specific shock and comparing the results with the unshocked model.","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"import BeforeIT as Bit\nusing Plots, StatsPlots\n\nparameters = Bit.AUSTRIA2010Q1.parameters\ninitial_conditions = Bit.AUSTRIA2010Q1.initial_conditions","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"Initialise the model and the data collector","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"T = 20\nmodel = Bit.init_model(parameters, initial_conditions, T);\ndata = Bit.init_data(model);\nnothing #hide","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"Simulate the model for T quarters","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"data_vec_baseline = Bit.run_n_sims(model, 4)","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"Now, apply a shock to the model and simulate it again Here, we do this by overloading the centralbankrate function with the wanted behaviour","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"import BeforeIT: central_bank_rate\n\nfunction central_bank_rate(cb::Bit.CentralBank, model::Bit.Model)\n gamma_EA = model.rotw.gamma_EA\n pi_EA = model.rotw.pi_EA\n taylor_rate = Bit.taylor_rule(cb.rho, cb.r_bar, cb.r_star, cb.pi_star, cb.xi_pi, cb.xi_gamma, gamma_EA, pi_EA)\n if model.agg.t < 10\n return 0.01\n else\n return taylor_rate\n end\nend\n\ndata_vec_shocked = Bit.run_n_sims(model, 4)","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"Finally, we can plot baseline and shocked simulations","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"Te = T + 1\nStatsPlots.errorline(\n 1:Te,\n data_vec_baseline.real_gdp,\n errortype = :sem,\n label = \"baseline\",\n titlefont = 10,\n xlabel = \"quarters\",\n ylabel = \"GDP\",\n)\nStatsPlots.errorline!(\n 1:Te,\n data_vec_shocked.real_gdp,\n errortype = :sem,\n label = \"shock\",\n titlefont = 10,\n xlabel = \"quarters\",\n ylabel = \"GDP\",\n)","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"Note that, importantly, once the function central_bank_rate has been changed, the model will use the new interest rate in all the simulations, unless the function is changed again. To restore the original interest rate, you could close and restart the Julia session.","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"EditURL = \"../../../examples/get_parameters_and_initial_conditions.jl\"","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"In this tutorial we illustrate how to calibrate the model to the Italian data for a specific quarter","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"import BeforeIT as Bit\nusing Dates, FileIO","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"We start from loading the calibration object for italy, which contains 4 datasets: calibration_data, figaro, data, and ea. These are saved within BeforeIT.jl for the Italian case, and would need to be appropriately generated for other countries.","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"cal = Bit.ITALY_CALIBRATION\nfieldnames(typeof(cal))","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"These are essentially 4 dictionaries with well defined keys, such as","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"println(keys(cal.calibration))\nprintln(keys(cal.figaro))\nprintln(keys(cal.data))\nprintln(keys(cal.ea))","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"The object also contains two time variables related to the data","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"println(cal.max_calibration_date)\nprintln(cal.estimation_date)","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"We can calibrate the model on a specific quarter as follows","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"calibration_date = DateTime(2010, 03, 31)\nparameters, initial_conditions = Bit.get_params_and_initial_conditions(cal, calibration_date; scale = 0.01)","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"In general, we might want to repeat this operation for multiple quarters. In the following, we loop over all quarters from 2010Q1 to 2019Q4 and save the parameters and initial conditions in separate files. We can then load these files later to run the model for each quarter.","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"start_calibration_date = DateTime(2010, 03, 31)\nend_calibration_date = DateTime(2019, 12, 31)\n\nfor calibration_date in collect(start_calibration_date:Dates.Month(3):end_calibration_date)\n params, init_conds = Bit.get_params_and_initial_conditions(cal, calibration_date; scale = 0.0005)\n save(\n \"data/italy/parameters/\" *\n string(year(calibration_date)) *\n \"Q\" *\n string(Dates.quarterofyear(calibration_date)) *\n \".jld2\",\n params,\n )\n save(\n \"data/italy/initial_conditions/\" *\n string(year(calibration_date)) *\n \"Q\" *\n string(Dates.quarterofyear(calibration_date)) *\n \".jld2\",\n init_conds,\n )\nend","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"CurrentModule = BeforeIT ","category":"page"},{"location":"index.html#Behavioural-agent-based-economic-forecasting-in-Julia","page":"Home","title":"Behavioural agent-based economic forecasting in Julia","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"Welcome to BeforeIT.jl, a Julia implementation of the agent-based model presented in Economic forecasting with an agent-based model, the first ABM matching the performance of traditional economic forecasting tools.","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"With BeforeIT.jl, you can perform economic forecasting and explore different counterfactual scenarios. Thanks to its modular design, the package is also a great starting point for anyone looking to extend its capabilities or integrate it with other tools.","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"Developed in Julia, a language known for its efficiency, BeforeIT.jl is both fast and user-friendly, making it accessible whether you’re an expert programmer or just starting out.","category":"page"},{"location":"index.html#Julia-installation","page":"Home","title":"Julia installation","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"To run this software, you will need a working Julia installation on your machine. If you don't have it installed already, simply follow the short instructions available here.","category":"page"},{"location":"index.html#BeforeIT.jl-Installation","page":"Home","title":"BeforeIT.jl Installation","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"To install BeforeIT.jl, simply open a Julia REPL by writing julia in your terminal, and then execute the following","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"using Pkg\nPkg.add(\"BeforeIT\")","category":"page"},{"location":"index.html#Quick-example","page":"Home","title":"Quick example","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"To check that the installation worked, try running the model in your terminal following","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"using BeforeIT\n\nparameters = BeforeIT.AUSTRIA2010Q1.parameters\ninitial_conditions = BeforeIT.AUSTRIA2010Q1.initial_conditions\n\nT = 20\nmodel = BeforeIT.initialise_model(parameters, initial_conditions, T)\ndata = BeforeIT.run_one_sim!(model)","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"To plot the results of the simulation, you can use the Plots package","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"using Plots\n\nplot(data.real_gdp)","category":"page"},{"location":"index.html#License","page":"Home","title":"License","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"BeforeIT.jl is released under the GNU Affero General Public License v3 or later (AGPLv3+).","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"Copyright 2024 - Banca d'Italia and the authors.","category":"page"},{"location":"index.html#Main-developers-and-maintainers","page":"Home","title":"Main developers and maintainers","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"Aldo Glielmo \nMitja Devetak \nAdriano Meligrana ","category":"page"},{"location":"index.html#Other-collaborators-and-contributors","page":"Home","title":"Other collaborators and contributors","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"Sebastian Poledna \nMarco Benedetti\nSara Corbo for the logo design\nAndrea Gentili for suggesting the name of the pakege\nArnau Quera-Bofarull for help in the deployment of the documentation\nSteven Hoekstra for fixing a bug in a script","category":"page"},{"location":"index.html#Disclaimer","page":"Home","title":"Disclaimer","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"This package is an outcome of a research project. All errors are those of the authors. All views expressed are personal views, not those of Bank of Italy.","category":"page"},{"location":"index.html#Reproducibility","page":"Home","title":"Reproducibility","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"
The documentation of BeforeIT.jl was built using these direct dependencies,","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"using Pkg # hide\nPkg.status() # hide","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"
","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"
and using this machine and Julia version.","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"using InteractiveUtils # hide\nversioninfo() # hide","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"
","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"
A more complete overview of all dependencies and their versions is also provided.","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"using Pkg # hide\nPkg.status(; mode = PKGMODE_MANIFEST) # hide","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"
","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"using TOML\nusing Markdown\nversion = TOML.parse(read(\"../../Project.toml\", String))[\"version\"]\nname = TOML.parse(read(\"../../Project.toml\", String))[\"name\"]\nlink_manifest = \"https://github.com/BeforeIT/\" * name * \".jl/tree/gh-pages/v\" * version *\n \"/assets/Manifest.toml\"\nlink_project = \"https://github.com/BeforeIT/\" * name * \".jl/tree/gh-pages/v\" * version *\n \"/assets/Project.toml\"\nMarkdown.parse(\"\"\"You can also download the\n[manifest]($link_manifest)\nfile and the\n[project]($link_project)\nfile.\n\"\"\")","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"EditURL = \"../../../examples/multithreading_speedup.jl\"","category":"page"},{"location":"examples/multithreading_speedup.html#Multithreading-speedup-for-large-models","page":"Multithreading within the model","title":"Multithreading speedup for large models","text":"","category":"section"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"In this tutorial we illustrate how to make use of multi threading in BeforeIT.jl to allow for faster executions of single simulation runs.","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"import BeforeIT as Bit\nusing FileIO, Plots, StatsPlots","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"First, we initialise the model, this time we use the Italy 2010Q1 scenario, and we want to simulate the model for a large number of epochs","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"parameters = Bit.ITALY2010Q1.parameters\ninitial_conditions = Bit.ITALY2010Q1.initial_conditions\nT = 50\nmodel = Bit.init_model(parameters, initial_conditions, T);\nnothing #hide","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"The model is in scale 1:2000, so it has around 30,000 households","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"model.prop.H","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Note that the households number is actually the sum of active and inactive households, the owners of firms and of the bank","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"length(model.w_act) + length(model.w_inact) + length(model.firms) + 1","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Let's fist check how many threads we have available in this Julia session","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Threads.nthreads()","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Then we need to first compile the code not to count compilation time, we can do that just by executing the function one time","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Bit.run_one_sim!(model; multi_threading = false);\nnothing #hide","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Let's now compare the performance of single threading and multi threading","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"model = Bit.init_model(parameters, initial_conditions, T);\n@time data = Bit.run_one_sim!(model; multi_threading = false);\n\nmodel = Bit.init_model(parameters, initial_conditions, T);\n@time data = Bit.run_one_sim!(model; multi_threading = true);\nnothing #hide","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Is the speedup in line to what we would expect? Yes!","category":"page"}] }