diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 40f106f..72c6a92 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.3","generation_timestamp":"2024-05-24T07:26:50","documenter_version":"1.4.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.3","generation_timestamp":"2024-05-24T07:39:08","documenter_version":"1.4.1"}} \ No newline at end of file diff --git a/dev/api.html b/dev/api.html index a977b5f..92347a8 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.initialise_modelFunction
initialise_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

Functions to run an entire simulation

BeforeIT.one_epoch!Method
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())

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.initialise_data(model), then iteratively updates the model and data for each epoch using BeforeIT.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.initialise_modelFunction
initialise_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

Functions to run an entire simulation

BeforeIT.one_epoch!Method
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())

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.initialise_data(model), then iteratively updates the model and data for each epoch using BeforeIT.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
 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.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

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.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

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.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-063b9bec.svg b/dev/examples/basic_example-063b9bec.svg deleted file mode 100644 index 9e0b154..0000000 --- a/dev/examples/basic_example-063b9bec.svg +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dev/examples/basic_example-37d098c5.svg b/dev/examples/basic_example-37d098c5.svg new file mode 100644 index 0000000..8826849 --- /dev/null +++ b/dev/examples/basic_example-37d098c5.svg @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/examples/basic_example-ba607665.svg b/dev/examples/basic_example-ba607665.svg new file mode 100644 index 0000000..4f52703 --- /dev/null +++ b/dev/examples/basic_example-ba607665.svg @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/examples/basic_example-c407c741.svg b/dev/examples/basic_example-c407c741.svg deleted file mode 100644 index 79e579a..0000000 --- a/dev/examples/basic_example-c407c741.svg +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dev/examples/basic_example.html b/dev/examples/basic_example.html index f40de2a..4dd47e4 100644 --- a/dev/examples/basic_example.html +++ b/dev/examples/basic_example.html @@ -1,5 +1,5 @@ -Essentials · BeforeIT.jl

We start by importing the BeforeIT library and other useful libraries.

import BeforeIT as Bit
+Essentials · BeforeIT.jl

Essential use of BeforeIT

We start by importing the BeforeIT library and other useful libraries.

import BeforeIT as Bit
 using FileIO, Plots, StatsPlots

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.

parameters = Bit.AUSTRIA2010Q1.parameters
 initial_conditions = Bit.AUSTRIA2010Q1.initial_conditions
Dict{String, Any} with 21 entries:
   "sb_inact" => 2.23847
@@ -22,7 +22,7 @@
   "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.initialise_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, 5, 6, 7, 8, 9, 10  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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, 1, 1, 1, 1, 1, 1, 1  …  1, 1, 9, 2, 2, 4, 10, 3, 2, 3], [10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621  …  11.988103388298951, 11.988103388298951, 107.89293049469056, 23.976206776597902, 23.976206776597902, 47.952413553195804, 119.88103388298951, 35.96431016489685, 23.976206776597902, 35.96431016489685], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621  …  11.988103388298951, 11.988103388298951, 107.89293049469056, 23.976206776597902, 23.976206776597902, 47.952413553195804, 119.88103388298951, 35.96431016489685, 23.976206776597902, 35.96431016489685], [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, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534  …  79.20833333333334, 79.20833333333334, 712.8750000000001, 158.41666666666669, 158.41666666666669, 316.83333333333337, 792.0833333333334, 237.625, 158.41666666666669, 237.625], [7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355  …  4.057486672347064, 4.057486672347064, 36.51738005112358, 8.114973344694128, 8.114973344694128, 16.229946689388257, 40.57486672347065, 12.172460017041193, 8.114973344694128, 12.172460017041193], [94.08074124608, 94.08074124608, 94.08074124608, 94.08074124608, 94.08074124608, 94.08074124608, 94.08074124608, 94.08074124608, 94.08074124608, 94.08074124608  …  24.993752380711378, 24.993752380711378, 224.9437714264024, 49.987504761422755, 49.987504761422755, 99.97500952284551, 249.93752380711373, 74.98125714213411, 49.987504761422755, 74.98125714213411], [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, 12.38429205306701, 12.38429205306701, 12.38429205306701, 12.38429205306701, 12.38429205306701, 12.38429205306701, 12.38429205306701, 12.38429205306701  …  13.530111496595204, 13.530111496595204, 121.77100346935683, 27.060222993190408, 27.060222993190408, 54.120445986380815, 135.30111496595205, 40.59033448978561, 27.060222993190408, 40.59033448978561], [1.2548454674764367, 1.2548454674764367, 1.2548454674764367, 1.2548454674764367, 1.2548454674764367, 1.2548454674764367, 1.2548454674764367, 1.2548454674764367, 1.2548454674764367, 1.2548454674764367  …  3.5771064837982873, 3.5771064837982873, 32.19395835418458, 7.154212967596575, 7.154212967596575, 14.30842593519315, 35.77106483798288, 10.731319451394864, 7.154212967596575, 10.731319451394864], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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, 1.3061857958470844, 1.3061857958470844, 1.3061857958470844, 1.3061857958470844, 1.3061857958470844, 1.3061857958470844, 1.3061857958470844, 1.3061857958470844  …  2.631055234104207, 2.631055234104207, 18.95720987207682, 4.671824563850785, 4.671824563850785, 8.75336322334394, 20.9979792018234, 6.712593893597363, 4.671824563850785, 6.712593893597363], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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, 11.889212387273577, 11.889212387273577, 11.889212387273577, 11.889212387273577, 11.889212387273577, 11.889212387273577, 11.889212387273577, 11.889212387273577  …  23.948487711601803, 23.948487711601803, 172.55301286833676, 42.52405335619368, 42.52405335619368, 79.67518464537744, 191.1285785129287, 61.09961900078557, 42.52405335619368, 61.09961900078557], [6.447669663541781, 6.447669663541781, 6.447669663541781, 6.447669663541781, 6.447669663541781, 6.447669663541781, 6.447669663541781, 6.447669663541781, 6.447669663541781, 6.447669663541781  …  12.98756660038165, 12.98756660038165, 93.57767278300274, 23.06132987320929, 23.06132987320929, 43.20885641886457, 103.6514360558304, 33.13509314603694, 23.06132987320929, 33.13509314603694]), Bank{Float64}(89460.0, 6476.292527744358, 0.0, 126431.00000000012, 0.028359903595743693, 3695.3696336675216, 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.initialise_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.initialise_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, 5, 6, 7, 8, 9, 10  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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, 1, 1, 1, 1, 1, 1, 1  …  1, 1, 4, 1, 1, 33, 1, 6, 1, 1], [10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621  …  11.988103388298951, 11.988103388298951, 47.952413553195804, 11.988103388298951, 11.988103388298951, 395.6074118138654, 11.988103388298951, 71.9286203297937, 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, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621  …  11.988103388298951, 11.988103388298951, 47.952413553195804, 11.988103388298951, 11.988103388298951, 395.6074118138654, 11.988103388298951, 71.9286203297937, 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, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534  …  79.20833333333334, 79.20833333333334, 316.83333333333337, 79.20833333333334, 79.20833333333334, 2613.875, 79.20833333333334, 475.25, 79.20833333333334, 79.20833333333334], [7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355  …  4.057486672347064, 4.057486672347064, 16.229946689388257, 4.057486672347064, 4.057486672347064, 133.89706018745312, 4.057486672347064, 24.344920034082385, 4.057486672347064, 4.057486672347064], [94.08074124607998, 94.08074124607998, 94.08074124607998, 94.08074124607998, 94.08074124607998, 94.08074124607998, 94.08074124607998, 94.08074124607998, 94.08074124607998, 94.08074124607998  …  24.993752380711374, 24.993752380711374, 99.9750095228455, 24.993752380711374, 24.993752380711374, 824.7938285634751, 24.993752380711374, 149.96251428426822, 24.993752380711374, 24.993752380711374], [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.384292053067005, 12.384292053067005, 12.384292053067005, 12.384292053067005, 12.384292053067005, 12.384292053067005, 12.384292053067005, 12.384292053067005, 12.384292053067005, 12.384292053067005  …  13.530111496595199, 13.530111496595199, 54.120445986380794, 13.530111496595199, 13.530111496595199, 446.4936793876416, 13.530111496595199, 81.18066897957118, 13.530111496595199, 13.530111496595199], [1.2548454674764369, 1.2548454674764369, 1.2548454674764369, 1.2548454674764369, 1.2548454674764369, 1.2548454674764369, 1.2548454674764369, 1.2548454674764369, 1.2548454674764369, 1.2548454674764369  …  3.5771064837982878, 3.5771064837982878, 14.308425935193151, 3.5771064837982878, 3.5771064837982878, 118.0445139653435, 3.5771064837982878, 21.462638902789728, 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, 1.3061857958470848, 1.3061857958470848, 1.3061857958470848, 1.3061857958470848, 1.3061857958470848, 1.3061857958470848, 1.3061857958470848  …  2.631055234104208, 2.631055234104208, 8.753363223343941, 2.631055234104208, 2.631055234104208, 67.93567378599468, 2.631055234104208, 12.834901882837096, 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, 11.88921238727358, 11.88921238727358, 11.88921238727358, 11.88921238727358, 11.88921238727358, 11.88921238727358, 11.88921238727358  …  23.94848771160181, 23.94848771160181, 79.67518464537746, 23.94848771160181, 23.94848771160181, 618.3665883385419, 23.94848771160181, 116.82631593456121, 23.94848771160181, 23.94848771160181], [6.447669663541784, 6.447669663541784, 6.447669663541784, 6.447669663541784, 6.447669663541784, 6.447669663541784, 6.447669663541784, 6.447669663541784, 6.447669663541784, 6.447669663541784  …  12.987566600381651, 12.987566600381651, 43.20885641886458, 12.987566600381651, 12.987566600381651, 335.34799133086614, 12.987566600381651, 63.35638296451986, 12.987566600381651, 12.987566600381651]), Bank{Float64}(89460.0, 6476.292527744359, 0.0, 126431.00000000009, 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.initialise_data(model);

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

for t in 1:T
     println(t)
     Bit.one_epoch!(model; multi_threading = true)
     Bit.update_data!(data, model)
@@ -51,12 +51,12 @@
 p8 = plot(data.euribor, title = "euribor", titlefont = 10)
 p9 = plot(data.nominal_gdp ./ data.real_gdp, title = "gdp deflator", titlefont = 10)
 
-plot(p1, p2, p3, p4, p5, p6, p7, p8, p9, layout = (3, 3), legend = false)
Example block output

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

model = Bit.initialise_model(parameters, initial_conditions, T)
+plot(p1, p2, p3, p4, p5, p6, p7, p8, p9, layout = (3, 3), legend = false)
Example block output

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

model = Bit.initialise_model(parameters, initial_conditions, T)
 data_vector = Bit.run_n_sims(model, 4)
4-element Vector{BeforeIT.Data}:
- BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72421.99999999999, 71943.25251333995, 71802.2948056499, 72590.78641826069, 73553.1714052182, 75817.75837188585, 76896.71363655945, 78086.08095534786, 78537.66288421038, 79950.13414549813, 80521.12522473493, 80623.56464726607, 81510.16192998199, 81896.41161872032, 82714.35755758049, 83274.52452529906, 84867.43460404426], [72421.99999999999, 72311.60938219195, 72668.75070479405, 73289.40785729449, 73958.59004418142, 75355.95067976421, 75990.48114030664, 76353.7181565578, 76350.31878303878, 77226.94611041374, 77133.35359484755, 77237.20899521167, 77491.26891546587, 77784.70748350862, 78481.54279087755, 79100.21953518408, 79655.69690225497], [64900.92049553803, 64498.07795474416, 64405.6601132791, 65143.71766827925, 66014.23981591653, 68055.01022286115, 69026.55441738055, 70102.14150105772, 70519.70306318245, 71829.75442841949, 72316.35666834518, 72399.98150487871, 73218.62390292919, 73584.96254131773, 74316.04442457281, 74817.84605744481, 76246.4685677805], [64900.92049553803, 64828.314762399976, 65182.859007749976, 65770.66772664057, 66378.10452422278, 67640.48560642262, 68213.0722312231, 68546.90476019228, 68555.6663087524, 69383.15530869135, 69273.78491075903, 69359.03327032314, 69608.54867833652, 69890.54432701135, 70513.0039424618, 71067.44928331055, 71564.14728969563], [40512.94792630534, 40052.41186923123, 39682.01538918591, 39895.9953860805, 40292.37334114131, 41431.7605366674, 41980.827248964146, 42587.48786971915, 42777.09191031244, 43307.1351206111, 43823.86107806695, 43919.105559413125, 44222.93947635193, 44264.43061646154, 44792.15011176073, 45145.98908411511, 45989.90599524427], [40512.94792630534, 40257.48434664503, 40160.86799991307, 40279.95868340193, 40514.461374172126, 41179.39874010617, 41486.08061970774, 41642.671856714085, 41585.711670321725, 41832.0472617264, 41980.05632672956, 42074.41273300459, 42042.50873821217, 42042.083644095655, 42499.96191101878, 42882.954517520324, 43165.650400675666], [14866.888022051655, 14802.346716742035, 14966.001014616275, 15303.355646992119, 15889.671322011593, 16622.552607857346, 16761.92223902814, 16999.686150182315, 16853.531656440642, 17044.2687175315, 17034.918083930574, 17383.222877966346, 17804.337010520823, 17672.13978836334, 17586.40760028513, 17793.363640347667, 18214.32272227963], [14866.888022051655, 14878.136257772696, 15146.599418898617, 15450.63676725092, 15977.253798713418, 16521.3042615352, 16564.38195525915, 16622.54308553649, 16384.14573764935, 16463.722491631805, 16318.206636579025, 16653.091739492556, 16926.48664259812, 16784.889555909413, 16686.442854359084, 16901.435081665015, 17095.775038033524], [15944.236265986641, 15829.511073327756, 15751.025615229715, 15876.934477868157, 16074.19714866816, 16718.727192809314, 16976.71712231941, 17052.967134662922, 17350.594167888623, 17764.67764268042, 17695.28493185822, 17385.046075975097, 17454.908940291025, 17983.06536963609, 18409.644380528982, 18285.31507652909, 18318.865663141052], [15944.236265986641, 15910.559801745283, 15941.097103875392, 16029.735781720463, 16162.796715565646, 16616.89304490096, 16776.645467649618, 16674.642015619338, 16867.364613924074, 17159.593509667735, 16950.789818214333, 16654.83835943249, 16594.287271186622, 17080.204758497763, 17467.551412818917, 17368.72645107749, 17193.897961736595], [15944.236265986641, 15829.511073327754, 15751.025615229715, 15877.397753231799, 16072.322334385395, 16541.16784690391, 16797.9548412653, 17107.381625093654, 17198.35084452633, 17530.87752281586, 17667.96511137595, 17697.956282885036, 17833.524942055894, 17896.500048988837, 18108.770986301854, 18278.152384899175, 18628.405394138113], [15944.236265986641, 15910.559801745283, 15941.097103875392, 16030.203515695413, 16160.911567470752, 16440.415217013342, 16599.989911064396, 16727.84930448759, 16719.361403178707, 16933.756874740644, 16924.61942668633, 16954.605693630325, 16954.235450821732, 16997.985549967467, 17182.0748781407, 17361.922803940284, 17484.428753748216], [3173.2320350842083, 3137.7769629965615, 3086.128928764757, 3071.689742280631, 3105.537318469131, 3182.399589786145, 3250.4994478002895, 3332.1468737985124, 3342.7751665348387, 3397.0739333559554, 3427.223639446761, 3435.89980639244, 3434.891377076939, 3424.517350126077, 3480.488251687243, 3526.689245902446, 3601.005127188676], [3173.2320350842083, 3153.842704492343, 3123.3700033444106, 3101.252010633158, 3122.654768184068, 3163.015521442164, 3212.192112033372, 3258.2222099704736, 3249.675890677305, 3281.3659212496036, 3283.029789912347, 3291.5849428637107, 3265.5326046969453, 3252.585492901713, 3302.3781568730237, 3349.906771290024, 3379.866191232066], [34195.564496956766, 33819.742734368774, 34292.66259383969, 34292.507564364, 34872.39081392424, 35343.87021613833, 35027.928990133005, 35640.98303958859, 35526.93628965858, 34942.543047555824, 36078.442686163726, 37496.359881539414, 36781.096632626424, 37150.57545442275, 36827.10222753701, 36356.95328375044, 37688.13589766423], [34195.564496956766, 33992.9033033422, 34706.48056278089, 34622.54229969054, 35064.60437794973, 35128.589898101214, 34615.12269417971, 34850.277290565326, 34537.479363235216, 33752.36224098768, 34560.51153155591, 35921.4355926935, 34967.58910395676, 35285.38781430246, 34942.51644670589, 34534.487020714296, 35373.69479685295], [33097.63671130043, 32560.759880329708, 32889.40980722191, 32778.00665704389, 33575.461220527264, 34299.15218158658, 33850.681963885705, 34195.04323880515, 33970.4911400895, 33108.490382880795, 34111.381555285, 35560.16974762765, 34753.12012980877, 35173.79961016361, 34900.946762531166, 34307.09655944322, 35343.79567428493], [33097.63671130043, 32727.474327313215, 33286.29438067419, 33093.4656747691, 33760.52622221968, 34090.23526487937, 33451.749596489935, 33436.41609187743, 33024.38260209125, 31980.77939359986, 32676.21071823168, 34066.56942941128, 33039.60284048837, 33407.8582892968, 33114.92983402496, 32587.383535792957, 33173.321295043716], [29576.147776884878, 29392.567475922056, 29301.217401506805, 29612.918621453882, 29936.662545274878, 30801.591662170642, 31216.99960142791, 31749.30820814555, 31941.01871643675, 32582.85348446844, 32830.95094513693, 32894.519337589954, 33201.52523975186, 33324.66243366975, 33692.568459120295, 33974.17980976812, 34608.047683513214], [34346.71094688275, 34133.51957455536, 34134.216049022696, 34548.17276351483, 35081.028099425464, 36220.85787398481, 36758.85893431148, 37288.24801320299, 37508.591020480344, 38158.51311653438, 38402.042992620285, 38422.08356351568, 38915.2583695684, 39154.49232805497, 39506.0230453524, 39722.08373200026, 40498.32705150799], [28335.329312139664, 28159.450819705682, 28160.025396800414, 28501.53116264348, 28941.12584296408, 29881.461937208118, 30325.301734218443, 30762.036823870534, 30943.81526788186, 31479.9876148471, 31680.894748194176, 31697.427806535707, 32104.28686676903, 32301.649956552123, 32591.65556009767, 32769.901177765176, 33410.285933051215], [978.0617717704339, 971.9909042667844, 970.2266627496517, 982.6262833104773, 996.5491712160963, 1032.5606867057163, 1050.6958816410877, 1064.5852797091002, 1070.093326265381, 1088.3878274165795, 1083.362730587946, 1083.3786037731263, 1101.840293608993, 1105.8077795929612, 1117.4529201001094, 1121.582515676405, 1140.0938327592685], [0.0019383188997990075, -0.0014262802518201223, 0.0020696001106859097, 0.0031147290841186948, 0.005841441916769163, 0.0060497907290455455, 0.0008174462587426934, 0.0052335571398896, 0.003481312582061191, 0.002107338569109718, -0.0028406727276556465, -0.0015911159746135883, -0.00020295352258381527, 0.003600346429016188, -0.0003512804423229099, 0.003840166117179189, 0.0032366932784573255], [2.3548476e6, 2.367070956736385e6, 2.358160417460875e6, 2.3610812342637135e6, 2.3793961121688844e6, 2.3799105124987597e6, 2.3840348129749955e6, 2.3959771362487166e6, 2.4020283588521807e6, 2.388581076992966e6, 2.408184103562669e6, 2.4296595664818445e6, 2.416380529268975e6, 2.409208147404784e6, 2.398851105576774e6, 2.412284779952419e6, 2.4434580466468553e6], [0.0016459319014481277, 0.0020019069880284793, 0.0015309292768383772, 0.0016108952565793728, 0.0023886619522354717, 0.0023719169847620397, 0.00238552956357766, 0.002821734616712173, 0.0029411374947374692, 0.0022211064854392986, 0.002798720645816926, 0.003432153868230146, 0.0026358279914851196, 0.0022313550010583205, 0.0016352561431750047, 0.0021531372747642893, 0.00333908670759779], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.90462950861706; 514.8676749589413 256.6403403674295 … 136.14688123301966 501.77066681198926; … ; 603.287635058351 300.21562015826873 … 155.46720178093898 568.7606475431421; 618.715718889874 307.58440422155576 … 158.39848458935674 579.1282054248265], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.90462950861706; 517.5038505278131 257.9543653648579 … 136.84396729909162 504.3397843490971; … ; 573.0466147720853 285.16670131447046 … 147.67409194461416 540.2503627621215; 580.7201785053608 288.69554251101835 … 148.67118037788606 543.5637475563392])
- BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72421.99999999999, 72143.30504954397, 71686.21682744843, 71827.09814854483, 72513.16138217413, 72331.0101434581, 73234.80278877319, 74522.99402946213, 75005.21147395704, 74543.89870076797, 75190.25481547597, 75851.05743526889, 76272.12795011481, 76909.9619353516, 77895.38860417585, 78671.315038205, 78249.77059840503], [72421.99999999999, 72555.0927809187, 72491.08761726732, 72719.1630134652, 73383.69415966909, 72796.32048393588, 73895.99566242329, 74897.36081786611, 75104.58608309361, 74846.71656545924, 75395.64982254656, 76040.59425690204, 75863.53079473709, 76696.98255202753, 77129.15100914455, 77582.3405227042, 77689.88699638791], [64900.92049553803, 64656.013796747866, 64242.53270300501, 64398.86615250494, 65011.52474491381, 64849.521600819004, 65667.74753072539, 66836.53030567174, 67272.5151193799, 66852.02600396764, 67439.10287258313, 68050.24877054855, 68440.59840620824, 69055.52811071626, 69933.12275032871, 70633.14478594229, 70232.37864718777], [64900.92049553803, 65025.06471869845, 64963.82809736366, 65198.67524010795, 65791.99910469375, 65266.70301327335, 66260.6220253997, 67172.28408911082, 67361.64465803794, 67123.59736148502, 67623.32428592109, 68220.29291099211, 68073.95551092394, 68864.29925788572, 69245.20798734402, 69655.43525376762, 69729.86014988729], [40512.94792630534, 40331.95224880606, 40105.41628333834, 39952.91547392726, 40331.90934350665, 40210.523836967666, 40631.83776465183, 41287.77885391624, 41518.687660406074, 41306.055304869646, 41595.387192791575, 41788.967600146614, 41951.83887087491, 41976.91706255052, 42579.808482555105, 42958.16812025303, 42880.08718572454], [40512.94792630534, 40562.16353600797, 40555.707559800605, 40449.11527962898, 40816.10074260217, 40469.20088987017, 40998.678126751016, 41495.18830345824, 41573.69588286204, 41473.85188761147, 41709.0120882988, 41893.389982194785, 41727.09881856231, 41860.67441095043, 42160.96147975814, 42363.53778653058, 42573.27660360073], [14866.888022051655, 14570.495625714231, 14753.0839361379, 14785.409348880954, 15014.869961815244, 14984.697158469544, 15150.063929179061, 15504.549946623045, 15624.494814637477, 15541.319652914763, 15710.122860750529, 15878.795670448048, 15966.401010808, 16127.553313986542, 16349.439558746424, 16570.48916240046, 16615.068582142536], [14866.888022051655, 14653.66275168109, 14918.727024104506, 14969.038432243404, 15195.126017439328, 15081.094741234328, 15286.844720877349, 15582.437163109153, 15645.195750407785, 15604.452777339502, 15753.03774119592, 15918.473646794091, 15880.86745864459, 16082.892826932522, 16188.614181633775, 16341.1191512538, 16496.186387672304], [15944.236265986641, 16101.989782318076, 15603.576445913752, 15796.880133627148, 15878.978823662861, 15954.12287571629, 16109.043456485806, 16601.983909361636, 16603.87043353726, 16248.714688581698, 16441.31691942372, 16513.716850989076, 16610.27777594889, 16893.60441465575, 16980.26038985611, 17564.942374493687, 17243.625499218786], [15944.236265986641, 16193.898544171007, 15778.768602144415, 15993.07129414746, 16069.608652450646, 16056.756840492957, 16254.482296069615, 16685.38409313343, 16625.868946734707, 16314.721446636122, 16486.22918116832, 16554.98137004944, 16521.294913772486, 16846.822575738985, 16813.229784870713, 17321.807063958022, 17120.245927847456], [15944.236265986641, 15876.070463667538, 15787.337333263957, 15789.635458840738, 15924.789083282274, 15881.407763436178, 16064.96595512891, 16357.92983805125, 16480.97011729631, 16392.127407536445, 16528.250474802946, 16657.07306694999, 16716.841249625, 16818.034097036525, 17039.40262479653, 17194.07222610165, 17151.356446555772], [15944.236265986641, 15966.689697633756, 15964.59270020771, 15985.7366432935, 16115.968871991598, 15983.573946917022, 16210.006845531787, 16440.104014467015, 16502.80579952976, 16458.716747587252, 16573.40021038329, 16698.695804899497, 16627.287516628792, 16771.461527754524, 16871.790252331983, 16956.0705292594, 17028.63706791299], [3173.2320350842083, 3153.2582223786007, 3140.921010586224, 3127.9418738641843, 3134.3576526641787, 3126.399954854806, 3162.3564686746104, 3222.562090440952, 3251.0205761484513, 3233.709828659385, 3254.1268612727463, 3270.6126728240583, 3264.44522897681, 3244.778485862441, 3304.5267752311456, 3325.00542655254, 3353.6638739330465], [3173.2320350842083, 3171.256746967135, 3176.1863054564205, 3166.7897059096463, 3171.9861468716704, 3146.512299816919, 3190.9074783231185, 3238.750653929875, 3255.3278621716613, 3246.8460493617213, 3263.016063887101, 3278.7852883651044, 3246.957280622746, 3235.793031916655, 3272.020965909925, 3278.9804405502205, 3329.668130618617], [34195.564496956766, 34455.62680525961, 34779.02730817566, 33659.45900198045, 34601.64191838655, 35181.41992653426, 36101.99901695786, 35105.88485917554, 34359.00737618417, 34449.649405899916, 35498.63376711861, 36993.93650730681, 37040.09262278965, 38254.82507747561, 38520.05785640999, 38155.42791800972, 37835.380736071005], [34195.564496956766, 34652.29653622764, 35169.515527773576, 34077.49650484323, 35017.04048701799, 35407.74440965762, 36427.942196505755, 35282.23952044443, 34404.52971871521, 34589.59337789867, 35595.604340652215, 37086.37705306026, 36841.6652694779, 38148.889658328975, 38141.14561242155, 37627.27749100135, 37564.665447218395], [33097.63671130043, 33316.75941255418, 33554.88714611713, 32367.565809871045, 33314.23866519659, 33999.753654229404, 34758.141378501714, 33977.20353961405, 33100.84881080774, 33001.84035149799, 34055.20592460875, 35324.35919362227, 35296.482330306506, 36342.93793331728, 36534.17768339182, 36577.71253695142, 36324.39140475212], [33097.63671130043, 33506.928587169015, 33931.631096555786, 32769.55849739786, 33714.18173984058, 34218.476397318926, 35071.951677780795, 34147.8882622789, 33144.70421562593, 33135.90292402644, 34148.23352876894, 35412.62779519716, 35107.39566572003, 36242.296919923865, 36174.80004953962, 36071.400970039045, 36064.48736995124], [29576.147776884878, 29464.540781796586, 29313.79249839215, 29329.98733433057, 29595.64961708608, 29522.64041591506, 29871.21504181157, 30418.36676041635, 30602.87701281988, 30420.795704378714, 30687.723753446346, 30945.3464729908, 31115.315738635196, 31383.111393595897, 31772.219551151455, 32050.12883271276, 31890.159465922134], [34346.71094688275, 34217.10200562151, 33960.380886950916, 34095.09947343532, 34435.71133335435, 34348.94964821869, 34801.328001330156, 35402.35734682011, 35651.40804197058, 35425.849721382365, 35738.42512568975, 36078.884123098964, 36293.32094709008, 36628.33010992942, 37098.98740317268, 37509.090223075116, 37273.88333225773], [28335.329312139664, 28228.404604323696, 28016.614967459725, 28127.755027374194, 28408.752798408277, 28337.176194645628, 28710.379021225453, 29206.215855705905, 29411.677551104327, 29225.596580997917, 29483.464853439564, 29764.33651605058, 29941.24248046255, 30217.61814176873, 30605.90071758313, 30944.227099743664, 30750.186257867943], [978.0617717704339, 974.3710093296486, 968.3593176619762, 973.779344738982, 980.1637944734739, 977.9315366852078, 995.2044875835824, 1015.8061984353028, 1018.2300645894054, 1005.380578206538, 1012.9539934469889, 1026.0181744588206, 1031.961720482949, 1044.0866071909604, 1061.9157960045184, 1073.9257301543844, 1068.3358490078328], [0.0019383188997990075, 0.0002454012519179649, 0.00482168136325023, 0.005076763359300518, 0.006454663565718111, 0.00451520228484692, 0.006796208227305867, 0.004048548427804999, 0.006552114197106995, 0.0035799786050523252, -0.0014466925120728558, 2.0826749794977673e-5, 0.000891627145259033, 0.0038818466028693877, 0.007094863432017373, 0.004541643334072365, 0.005728775336880654], [2.3548476e6, 2.3644921223779563e6, 2.3793912055160613e6, 2.3688081593653103e6, 2.390111739664444e6, 2.3961310636347667e6, 2.4011831979231387e6, 2.3794556314625978e6, 2.3721485124606546e6, 2.377723112243535e6, 2.4052124744404787e6, 2.432226095020015e6, 2.42356168896165e6, 2.4418911806970974e6, 2.4215586445235633e6, 2.423659296038412e6, 2.403894091167763e6], [0.0016459319014481277, 0.001932553135598579, 0.002519911553711209, 0.002012371461595026, 0.0028960988233302397, 0.003033018919841073, 0.0031718220849779174, 0.0021398797167179193, 0.0018297603294648325, 0.002007598824852387, 0.0029629312285297483, 0.0038487621554579568, 0.003233896208103556, 0.003827461418613976, 0.0028879164658861625, 0.0028636619020895836, 0.001980984267286104], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.90462950861706; 516.1284266331544 257.26877317555807 … 136.4802628314415 502.99934796449156; … ; 551.3124501034315 279.9033355341213 … 146.84181528347995 537.5011405227943; 548.8368117948372 279.7121235348762 … 146.61596685009744 536.4980043262601], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.90462950861706; 519.074442951029 258.7372410311243 … 137.2592803406922 505.87042463943885; … ; 543.6811399117896 276.02889160176454 … 144.8092193547616 530.0610075620366; 544.9098388624263 277.7107600796876 … 145.5669174406808 532.6593165851963])
- BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72421.99999999999, 73067.62333205971, 72978.30359141833, 74184.60612415081, 73961.6832271891, 74890.84674527706, 76163.28648907688, 77055.2167742286, 78336.29732536721, 79107.96483227276, 79322.09034523214, 81038.096394088, 81510.53214676432, 81645.42103390413, 82312.96875132924, 82096.5577873883, 81496.79137076896], [72421.99999999999, 72962.47182657497, 73017.50794765171, 73659.52796168286, 73569.36753903882, 74136.81287235602, 74829.09798572975, 75214.88508082856, 75999.30956404634, 76340.43238957466, 75610.43082391913, 76587.23782507212, 77117.69308954131, 77354.15219730716, 77581.19626178384, 77467.7903453505, 77480.69288509272], [64900.92049553803, 65496.09665886717, 65419.1185792724, 66515.29919387902, 66327.88732304999, 67176.43384646822, 68325.3242278372, 69132.57494315026, 70297.36408493611, 70995.39027446395, 71160.85755236578, 72746.14551225828, 73188.90553225328, 73326.82083572779, 73931.92099981276, 73764.02695695547, 73228.99225491848], [64900.92049553803, 65401.84132588945, 65454.26209868901, 66044.50433627369, 65976.06365404605, 66500.07206417245, 67128.43703619378, 67481.4619615723, 68200.19986951162, 68511.67012968233, 67831.08052140895, 68750.70608903248, 69244.54307614031, 69472.77614890551, 69681.93420923784, 69605.06419926959, 69620.32447848305], [40512.94792630534, 40760.49449071688, 40722.99200211562, 41266.75028820363, 41052.50491090466, 41462.81125314963, 42137.295443975134, 42577.19925075044, 43201.840806814675, 43630.812390196916, 43912.8155789079, 44453.05850014284, 44593.5327471588, 44541.782563754685, 44882.4695471571, 44513.51242578092, 44158.109604967045], [40512.94792630534, 40701.83612515707, 40744.86862306696, 40974.664496495185, 40834.74970291488, 41045.34549451367, 41399.15640435319, 41560.315871822975, 41913.01076660087, 42104.42134920418, 41858.03589090744, 42011.56141237615, 42190.257891848545, 42200.67437885176, 42302.39452510694, 42003.751936421446, 41982.0323124512], [14866.888022051655, 14625.116142242252, 14951.189743088838, 15171.88125194333, 15152.65183145132, 15351.484319133433, 15501.415171749335, 15796.814800253098, 15787.843164024875, 15933.769832685393, 16428.472346826336, 16836.316804601345, 16941.37714357882, 16947.41622995093, 17097.366016035885, 17243.194702459343, 17187.775691205752], [14866.888022051655, 14604.069159870101, 14959.221606532565, 15064.494774543708, 15072.277470415005, 15196.918845790418, 15229.869511613895, 15419.534972245396, 15316.848267511807, 15376.33892114647, 15659.747070660025, 15911.615111757877, 16028.357178680773, 16056.663041254329, 16114.521545892025, 16270.989041386845, 16340.775474822362], [15944.236265986641, 16441.663641628893, 15843.205082114364, 16316.887771190459, 16149.938341491421, 16452.207795321574, 17000.244375381757, 16891.257762619112, 17706.828319264, 17763.196551388355, 16970.728346031756, 17530.872217785145, 17822.864023955375, 17795.685312464553, 18038.57695807838, 17988.03425355117, 17828.55907564159], [15944.236265986641, 16418.002468516253, 15851.716141228533, 16201.39694505123, 16064.274063752318, 16286.55975552571, 16702.443011426934, 16487.839041560717, 17178.584803974332, 17141.764526860567, 16176.629688583149, 16568.02343055052, 16862.338173688106, 16860.347251367977, 17001.626845652674, 16973.83305507059, 16949.98155251281], [15944.236265986641, 16081.842991779002, 16072.203731447462, 16319.474850757855, 16266.098422038123, 16449.20099163375, 16742.21124724647, 16963.95951412534, 17238.070738666913, 17429.005300419845, 17490.0762719446, 17821.924636943473, 17892.90758578661, 17922.663871816556, 18056.967293311787, 17988.20300096374, 17829.239075934314], [15944.236265986641, 16058.699636015697, 16080.837809927434, 16203.965713286178, 16179.81799523444, 16283.583225655426, 16448.929972286103, 16558.804436424736, 16723.81155460408, 16819.264704575402, 16671.67615363308, 16843.09036619571, 16928.6068847606, 16980.651840180504, 17018.960009900136, 16973.992288167938, 16950.628042920056], [3173.2320350842083, 3193.721819514691, 3192.4652931470305, 3232.7363742682023, 3209.0958632587317, 3224.037704238152, 3283.1727599392157, 3336.5598740869036, 3378.6338173711406, 3414.9002760878493, 3434.1052102115063, 3473.412343465429, 3453.700993650906, 3457.47661244912, 3473.6261126095333, 3447.9068390050047, 3401.1644101170486], [3173.2320350842083, 3189.125739306979, 3194.180303505671, 3209.855087114056, 3192.073824319095, 3191.5766793970447, 3225.6598616290544, 3256.871864108291, 3277.839854026335, 3295.4325673345006, 3273.4156816678524, 3282.6419801358393, 3267.571027163103, 3275.752255438275, 3273.944231030607, 3253.506984130481, 3233.557673615443], [34195.564496956766, 35201.47014140527, 35069.06020541791, 34991.14353303771, 34854.04640568708, 35076.00748943171, 35011.8696959726, 34979.81414794875, 34755.83211406753, 34495.0604983986, 35175.01015333059, 35760.642662617356, 36012.98501185815, 36232.45533601253, 36673.37326070335, 36921.901876514574, 36405.048476191485], [34195.564496956766, 35150.81175932239, 35087.899502324035, 34743.47644536415, 34669.16974247672, 34722.84687070055, 34398.550127157, 34144.38128174413, 33718.96980300202, 33288.27684210603, 33529.09208965288, 33796.559473219604, 34072.14076804392, 34328.08391520431, 34565.19928367101, 34840.171510343454, 34611.03600530737], [33097.63671130043, 33961.12108393345, 33608.143441318956, 33562.05672022445, 33247.4582623457, 33451.66411175903, 33487.53819800166, 33189.869187343065, 33116.047078803516, 32714.874440396015, 33164.93607986451, 33542.79379105895, 33860.226779786695, 33871.91840827857, 34378.81703064516, 34570.08547091769, 34082.701477237126], [33097.63671130043, 33912.247686290626, 33626.1979255009, 33324.504699771474, 33071.10344052033, 33114.858094174066, 32900.92106882113, 32397.186086544923, 32128.104077042262, 31570.369249742227, 31613.0739158845, 31700.52160283223, 32035.400922720022, 32091.616389371215, 32402.545938538577, 32620.95519787192, 32403.132460001183], [29576.147776884878, 29847.37687541684, 29869.829705458174, 30315.53710859754, 30233.71288561221, 30607.94103110635, 31143.24593411888, 31527.775628457242, 32043.39400607377, 32410.817224974653, 32499.2419265341, 33124.90477009218, 33328.47293444158, 33384.373095086274, 33667.01760856318, 33544.3960873312, 33276.68583113159], [34346.71094688275, 34661.688661963766, 34563.01584757005, 35197.099003471965, 35096.85872161526, 35560.06477322569, 36157.93264529581, 36569.42389147106, 37203.002938534046, 37529.73807094831, 37610.44848442056, 38544.416226153866, 38777.242638332165, 38856.34670473711, 39170.08043510056, 39125.027151903785, 38862.79724308307], [28335.329312139664, 28595.17944150455, 28513.776401361192, 29036.88194883406, 28954.185780308806, 29336.32123520158, 29829.54991920728, 30169.021724454367, 30691.71139251502, 30961.26114908768, 31027.845578327266, 31798.349734310523, 31990.426730324445, 32055.685956309146, 32314.509823896416, 32277.34179293275, 32061.007517624166], [978.0617717704339, 987.0311214865327, 986.273026244167, 1002.6630818094847, 997.3157158224897, 1008.4280421362229, 1024.1456484226185, 1035.3754232219417, 1050.9671403281611, 1054.8349785410542, 1051.1671414112313, 1076.8245160122124, 1083.1899594796737, 1086.101035904455, 1094.8229561490605, 1094.6037177205499, 1089.509180703804], [0.0019383188997990075, 0.0046633492485237404, -0.00042786739586797573, 0.006157796329917309, 0.004650116358121847, 0.005298394590136812, 0.003953537359985493, 0.004018759099435387, -0.00026036444820998206, 0.003349850731872328, 0.0016039169664965325, 0.0035549956284031126, 0.00380807489088153, 0.003373303613524614, 0.0034977199890184885, 0.0030286453820580483, -0.0024563908842689663], [2.3548476e6, 2.39974891340143e6, 2.401885931924561e6, 2.4039638915118272e6, 2.4140409254983105e6, 2.416257590542997e6, 2.4179419160790024e6, 2.41256093172698e6, 2.4192492988905828e6, 2.420608262051027e6, 2.420132669270518e6, 2.42968216239189e6, 2.425692173818862e6, 2.440150478448571e6, 2.4336696791487793e6, 2.4335551567230043e6, 2.41233866274669e6], [0.0016459319014481277, 0.003506581694407797, 0.0033247509584167353, 0.0033050132970091034, 0.003579352958720608, 0.0035262678121409682, 0.0034244978020218303, 0.0030442999908646007, 0.00308563026535896, 0.002989315500675111, 0.0027854884035241, 0.003048964131412273, 0.0027491023359905464, 0.0032092613135744482, 0.002790701139782955, 0.0026489696509198303, 0.0015389562097308713], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.90462950861706; 522.8345413532829 260.61149529236974 … 138.25356624267056 509.53487508824173; … ; 606.6906395175063 297.93754304673314 … 152.94773814896263 560.9540056992729; 598.6944285245204 294.5352867207061 … 151.284894782972 556.1637569360029], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.90462950861706; 522.0821309608867 260.23644968630066 … 138.0546057459951 508.8016042253182; … ; 572.4842128989817 281.13923095931284 … 144.32424004188348 529.3263015903387; 569.1912327871421 280.0208168982598 … 143.82969284650048 528.7564396116081])
- BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72421.99999999999, 73284.18903191136, 73494.04045368037, 74609.1331842776, 74893.64957603379, 75127.64346223083, 75771.90813735819, 77055.4040433568, 77601.7192836265, 77682.07748797882, 77530.16582720431, 77696.29675928701, 77892.10592756662, 77800.281405414, 78308.01449198452, 79579.4298928172, 80021.87318854156], [72421.99999999999, 72680.38784041224, 72469.06377138542, 73409.38534384682, 73383.44669205137, 74121.1792170094, 74758.01032610849, 75773.22696814293, 75868.94611663731, 75206.79381632783, 75104.11219276265, 75385.62517823881, 75497.22646085835, 75620.645278003, 75967.07006805086, 76532.60173467099, 76838.84363645743], [64900.92049553803, 65684.671550669, 65878.97853318333, 66917.89224856228, 67161.28845204631, 67383.69472440187, 67963.78366417658, 69127.22474907318, 69618.97721509082, 69670.32144659516, 69523.08508965683, 69692.61713665404, 69870.296384749, 69809.33549525843, 70301.02454060085, 71483.1570393092, 71896.39533448478], [64900.92049553803, 65143.48410669998, 64960.204487926145, 65841.82296207028, 65807.0057847384, 66480.97401700841, 67054.36573878342, 67976.97002071506, 68064.45114601449, 67450.32663373603, 67347.58692762173, 67619.9733100705, 67722.05637824233, 67853.57200793728, 68199.44154858172, 68746.30788125543, 69036.57286446098], [40512.94792630534, 40910.22811409094, 40986.64653028982, 41338.32855644459, 41569.15665273197, 41606.30350253988, 41986.82503912271, 42654.53274372654, 42961.708157110836, 43194.34944250753, 43149.20664431276, 43078.50092789847, 43186.24910817292, 42970.01197561709, 42998.084834449386, 43402.09743718169, 43570.598558091966], [40512.94792630534, 40573.1616225858, 40415.030699677205, 40673.5899608344, 40730.929905643905, 41048.91537053776, 41425.00270872396, 41944.775073684395, 42002.41375242653, 41817.99248424818, 41798.992976048205, 41797.35533924009, 41858.43982632488, 41766.17326442676, 41712.69753934268, 41740.377407617256, 41837.49113025609], [14866.888022051655, 15040.56007712565, 15062.082613634117, 15210.037529635492, 15318.427698214799, 15078.848602801667, 14973.640391948791, 15355.850933491858, 15209.581979088609, 15277.076567690809, 15561.376475659832, 15502.876282804968, 15568.057132948998, 15615.801572644546, 15885.416973333313, 16077.533745190032, 16180.109411262281], [14866.888022051655, 14916.638284234861, 14852.020908352, 14965.453402998071, 15009.537240627551, 14876.841441676532, 14773.279313641035, 15100.33452576205, 14869.966365184944, 14790.283482317705, 15074.433960409302, 15041.82399144332, 15089.39989393544, 15178.312598936927, 15410.537377332434, 15461.979165390096, 15536.513299850862], [15944.236265986641, 16134.200699688412, 16165.895563663176, 16471.652780454155, 16401.69223918395, 16879.424324012598, 17053.171161854723, 17192.23031304635, 17486.915099257807, 17371.384665044945, 16619.47174446652, 16895.684208716826, 17021.004106867025, 16842.063761010995, 16819.02111828402, 17289.513910109483, 17516.31609906876], [15944.236265986641, 16001.268211316132, 15940.43965051861, 16206.781322922732, 16070.958150752855, 16653.29534832364, 16824.984049494724, 16906.15714461831, 17096.448785661498, 16817.85795456265, 16099.41958930891, 16393.21010156088, 16497.67439645708, 16370.220086791272, 16316.232304670335, 16627.556694621337, 16819.569702547677], [15944.236265986641, 16130.9944854485, 16169.074436954641, 16402.049083336013, 16467.94925200421, 16492.570808155775, 16657.45217024732, 16939.71819480829, 17065.333712926753, 17111.76671684845, 17084.290995693656, 17102.7130292032, 17154.844607299376, 17135.988848153636, 17206.88537085853, 17454.680884455443, 17533.38119264461], [15944.236265986641, 15998.088413633512, 15943.574189997706, 16138.29688402057, 16135.879115291162, 16271.624401943309, 16434.560141900954, 16657.84674660011, 16684.28091388502, 16566.51254604093, 16549.693838319603, 16594.08192831771, 16627.399821780313, 16655.910631241837, 16692.50172030257, 16786.399982194085, 16835.9559980025], [3173.2320350842083, 3205.7661239077497, 3205.8236132361544, 3234.6105597940605, 3242.963183524212, 3239.70443360736, 3282.5366992897107, 3341.032361285753, 3365.434486703701, 3383.519593130676, 3380.37882856522, 3378.200243708666, 3382.3823698523747, 3373.6422049418843, 3344.481027238353, 3359.8688581334754, 3353.439204502135], [3173.2320350842083, 3179.3532587201435, 3161.1139411207932, 3182.5965922257383, 3177.57002428933, 3196.303010013522, 3238.613339609716, 3285.438660177156, 3290.287510223621, 3275.7061685620133, 3274.600899995994, 3277.7332765067213, 3278.3872603396308, 3279.126962862849, 3244.5009132939917, 3231.230803570535, 3220.049474123062], [34195.564496956766, 34719.19474354916, 35030.463101697096, 35031.194697872816, 36752.89040438733, 37430.101659559456, 38574.67469035813, 38634.70153263118, 38073.314381835975, 37651.8725163314, 38050.77380150309, 37479.535520591766, 37442.09232433104, 37092.20010795767, 36886.6548897275, 37368.978412979595, 36695.45533708052], [34195.564496956766, 34433.13725378267, 34541.91453874448, 34467.87760259607, 36011.781893884756, 36928.660947735625, 38058.51006946297, 37991.83255766611, 37223.173197488395, 36452.12260926722, 36860.09895785325, 36364.901989644684, 36290.89353428264, 36053.03292321229, 35783.9630434094, 35938.24617698377, 35235.820438383416], [33097.63671130043, 33519.99460254281, 33751.04735560466, 33442.080380130144, 35148.51741848423, 35867.034626682536, 36816.403145926924, 36781.91147953887, 36129.800333666506, 35812.605703596, 35850.6628387379, 35260.30018072586, 35325.29674475317, 34719.79601181611, 34281.16332380966, 34558.69361264392, 33940.60621696214], [33097.63671130043, 33243.81753150715, 33280.342025907536, 32904.31694550511, 34439.76049885769, 35386.53389126388, 36323.76581521496, 36169.87233358776, 35323.05598412393, 34671.46271406793, 34728.83329085703, 34211.66624365098, 34239.18119014155, 33747.09359536407, 33256.36019670391, 33235.5577099418, 32590.550934580806], [29576.147776884878, 29933.31277315688, 30022.673095241633, 30497.36423575896, 30621.21452894244, 30694.895284441678, 31011.507689296817, 31565.59999760336, 31781.73680957006, 31856.992364760004, 31788.472225502792, 31818.735108181674, 31919.78728828173, 31887.881404784996, 32106.104911970026, 32619.838406405725, 32810.3697975513], [34346.71094688275, 34761.48581816895, 34863.331156833716, 35412.15740435251, 35529.228138345316, 35671.551554171914, 35922.60186875392, 36511.26230414819, 36783.80201935858, 36766.178232985425, 36691.641575861395, 36827.68761269607, 36905.40827751006, 36877.71252615843, 37145.86469214997, 37800.064391084474, 38015.62775853338], [28335.329312139664, 28677.510040491517, 28761.53034783435, 29214.30070138118, 29310.881646369773, 29428.29553390363, 29635.406874159722, 30121.039612494395, 30345.879265789463, 30331.340004915768, 30269.84879754218, 30382.083976662645, 30446.201924819852, 30423.353500226607, 30644.573515758355, 31184.27479702163, 31362.110136590083], [978.0617717704339, 989.8729593430497, 992.9742811078394, 1008.3706084508008, 1010.84578475858, 1017.2478857881681, 1029.6741061258415, 1050.3624473217596, 1053.4383861622025, 1047.150848849658, 1042.971288292654, 1046.1944157762534, 1045.1008189572515, 1043.7415643150855, 1049.0549364808544, 1063.2542418190535, 1070.3977784001142], [0.0019383188997990075, 0.006414673312415076, 0.006320522524018823, 0.0022862715419234014, 0.00032326736917265286, -0.001378396459711384, 0.00023841232564958403, 0.004426010496363819, 4.1611591686807614e-5, 0.0015099881185653974, 0.005155004202961111, 0.00357124129162667, 0.005818147670599405, 0.005642650562109219, 0.0030695911697176115, 0.004475336831616827, 0.005972607773589322], [2.3548476e6, 2.3608323161872006e6, 2.3622316693795295e6, 2.3637113142703427e6, 2.3923354779372253e6, 2.4036451792209335e6, 2.4276249853337617e6, 2.4255304137606057e6, 2.4254529636333627e6, 2.407069626303901e6, 2.427295341776751e6, 2.4088202038650988e6, 2.3899681565654394e6, 2.4049251686690953e6, 2.4052433368454534e6, 2.4122885031660665e6, 2.3938917686431627e6], [0.0016459319014481277, 0.0019212588962536443, 0.0019823672192701572, 0.0019496820656905172, 0.0030038821978382183, 0.003214857759974596, 0.003963604082032556, 0.0036868686364490825, 0.0034117323199277004, 0.002448298808739745, 0.0032118228294169653, 0.0023073368264930824, 0.0015002423735614152, 0.0021342232067692586, 0.002059673918151571, 0.0022979947206205084, 0.0015148083882716055], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.90462950861706; 524.3398748326108 261.3618420616289 … 138.65162280825814 511.00191646689734; … ; 582.8447301636168 290.62181472770635 … 149.12007294086857 545.7157980788633; 583.975037281982 293.07605678400273 … 149.6337492900609 547.2717268266156], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.90462950861706; 520.0197473213881 259.2084363443263 … 137.5092479500408 506.791682716659; … ; 560.5295698504373 279.494884946021 … 143.41076793839503 524.8221794368176; 560.7462658563447 281.41837229624014 … 143.6817685752729 525.5029027526664])

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()
1

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. Since we are saving the initial data point, we effectively have T+1 data points in our time series.

Te = T + 1
+ BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72421.99999999999, 73003.0553964065, 72959.51277555547, 73038.69221234652, 74383.58881412305, 75919.26398138897, 77474.04396336185, 77632.46735403416, 78540.46636117369, 79011.86944859763, 79409.1116428227, 79796.13289027876, 80608.4081991731, 81718.72766943157, 82905.87533660061, 82549.02965801125, 84791.97286779646], [72421.99999999999, 72238.15719467199, 72010.55630576874, 72002.6425072185, 72633.58807011602, 73401.91676544565, 74891.1550734796, 75149.46144490446, 75819.73364313925, 76069.3325444362, 76399.66705481603, 76573.47408899084, 76817.01708400842, 77797.59687898002, 78836.27218248806, 78327.87168430557, 79895.87055643821], [64900.92049553803, 65431.9490504837, 65387.97918232334, 65473.10080114352, 66700.35254968335, 68098.7358911105, 69526.50366207119, 69667.75725967751, 70509.85274761732, 70943.92185211141, 71316.4162817805, 71653.39970849769, 72376.86423983959, 73387.37818248718, 74455.80663354232, 74120.96056632514, 76134.55438851818], [64900.92049553803, 64746.37801660114, 64537.502753262874, 64544.368580944, 65131.11303800607, 65840.70342063277, 67208.57594493736, 67439.49556907952, 68067.30978597954, 68301.84908971979, 68613.66846638378, 68759.59457222244, 68972.64120463985, 69866.01268367626, 70800.99225171903, 70330.77326782547, 71738.35324932488], [40512.94792630534, 40747.04929091611, 40754.41160874903, 40656.17367228377, 41238.808504655026, 41940.157896155564, 42505.16188520415, 42604.66355858929, 42918.36307962802, 43049.64943769247, 43171.970539162125, 43466.6678467317, 44006.7740091462, 44531.93344492288, 45172.06712541541, 45028.29536444016, 46252.591431001696], [40512.94792630534, 40320.11723225953, 40224.33456879618, 40079.46815540043, 40268.59522622008, 40549.497157637496, 41088.09231222744, 41241.99101992032, 41431.621275750076, 41446.40699999734, 41535.84024624248, 41711.21636524774, 41936.92924092944, 42395.14619469084, 42954.70453072585, 42725.76620319599, 43581.850178587134], [14866.888022051655, 14982.301655506402, 14997.650261743553, 15141.853682260384, 15501.348564140642, 15891.164897371165, 16447.201174122118, 16463.245334448013, 16651.356282469467, 16842.07881983689, 16996.540827732573, 16787.667096637306, 16833.953360062653, 17025.06576189566, 17263.19848720484, 17612.031611305236, 17569.27189566037], [14866.888022051655, 14825.322806718325, 14802.581562597215, 14927.06734686176, 15136.652910800405, 15364.242248038076, 15898.871811033907, 15936.68297153271, 16074.534015728268, 16214.851052464475, 16352.406335472764, 16109.677811160767, 16042.173660794339, 16208.147639547022, 16415.799352603528, 16711.437528283175, 16554.777836519355], [15944.236265986638, 16123.761282059822, 16040.6345849471, 16137.104934046809, 16168.285021704916, 16608.45418042813, 16951.479434739253, 16963.17290474114, 17249.10249399797, 17222.086829274274, 17343.537723217138, 17697.84205223242, 17855.368513341444, 18167.5266273571, 18435.381996465378, 17870.743746540385, 18795.507762702684], [15944.236265986638, 15954.82265417808, 15832.000187734291, 15908.201016107907, 15787.89855113537, 16057.747499414063, 16386.338057586385, 16420.62079998866, 16651.573606197137, 16580.70691489597, 16686.25275102414, 16983.094302089517, 17015.54687374022, 17295.789510584462, 17530.443855284408, 16956.92037666826, 17710.207752717044], [15944.236265986638, 16066.1174302441, 16050.561730741238, 16040.954921655672, 16298.442888973055, 16623.62662933163, 16934.268038509163, 16981.156724337343, 17183.72763950203, 17286.784024759138, 17333.17371936709, 17441.89036485121, 17655.450832296392, 17922.8637239515, 18190.43737290813, 18105.054462870616, 18581.85556807624], [15944.236265986638, 15897.782772680523, 15841.798214941015, 15813.414886187395, 15914.994232668872, 16072.416857007094, 16369.700468038223, 16438.02942299704, 16588.46341237619, 16642.994676372517, 16676.281521940757, 16737.479518617893, 16825.032257916424, 17062.86633038779, 17297.522835706543, 17179.249576648028, 17508.89237451977], [3173.2320350842083, 3190.6190277619726, 3192.288171198737, 3173.539160136928, 3205.547707102458, 3251.0971822829542, 3288.039654584644, 3304.8686358047844, 3344.5489812846345, 3356.078062420323, 3342.086249403131, 3376.0386049570816, 3436.662039548847, 3488.39027341757, 3537.1499034987105, 3526.9027964982733, 3622.8007025959446], [3173.2320350842083, 3157.1889371513375, 3150.7673002630786, 3128.52268720347, 3130.1317321298443, 3143.296605573106, 3178.4204755814776, 3199.165331101381, 3228.6899310135964, 3231.09198601388, 3215.4279457419993, 3239.6933946106974, 3275.019721909048, 3321.0059430405563, 3363.521721594787, 3346.554051956993, 3413.611055349193], [34195.564496956766, 35206.07933004721, 35522.81014559867, 36118.19146252572, 36829.98463860828, 37146.260387074326, 37575.4458383296, 38034.73552924805, 37285.43666020686, 38777.089364928695, 38233.516887318576, 38870.55649461735, 38581.983867987976, 38968.131930770156, 39566.52201379828, 40702.25093104099, 41086.545114641645], [34195.564496956766, 34837.20344364151, 35060.778544368426, 35605.85696582202, 35963.496458259935, 35914.55672894841, 36322.72690663048, 36818.228102778914, 35993.82595138916, 37332.96435828653, 36784.543991178674, 37300.72426765236, 36767.292397079866, 37098.31400386576, 37624.318977754454, 38620.934751103836, 38714.10440241564], [33097.63671130043, 34056.13616212288, 34355.99382548292, 35014.63153876974, 35354.83791498548, 35666.77337964026, 36005.24436903339, 36433.34997299279, 35563.792155127994, 36879.03500313427, 36336.454334607435, 37026.60059994021, 36669.67155136533, 36973.93009551426, 37531.29428628378, 38664.29199531546, 38911.94333620938], [33097.63671130043, 33699.308942125244, 33909.13855772729, 34517.95097697324, 34523.05507629939, 34484.12686859235, 34804.87401399871, 35268.06144931653, 34331.82120592484, 35505.596781207634, 34959.37626910168, 35531.2386571598, 34944.92508853566, 35199.80046970811, 35688.99453388063, 36687.187174945626, 36665.06961380051], [29576.147776884867, 29818.144021235472, 29788.901835267025, 29797.93876917163, 30321.64584320217, 30959.852096942435, 31550.563720968315, 31622.331179096833, 31997.273114381744, 32179.25665843111, 32322.295465274725, 32479.992560148487, 32863.5191060058, 33356.36110063102, 33852.75221225831, 33696.69535091431, 34541.92086263552], [34346.71094688274, 34627.74061706304, 34610.3908060022, 34682.46726154648, 35362.684275577645, 36103.002895188845, 36918.89942599511, 36985.00294962322, 37438.83758475443, 37684.73181888118, 37906.016148947434, 38079.41651656506, 38411.64437939283, 38918.54041219983, 39476.73923144089, 39303.69178676516, 40435.139395400176], [28335.329312139656, 28567.173003471726, 28552.859766589372, 28612.32135831667, 29173.486388822817, 29784.234006404986, 30457.331844529308, 30511.86589041195, 30886.27011967236, 31089.127799719605, 31271.682815649376, 31414.734548518067, 31688.815694583307, 32106.994484360763, 32567.49701659169, 32424.73643788317, 33358.157417833376], [978.0617717704338, 986.0644121851648, 988.6865410539931, 992.694770425427, 1016.022430903496, 1035.8808989791537, 1057.0405151078112, 1060.423130957394, 1073.742048481196, 1079.9333747990659, 1088.1046675583011, 1093.9906317841696, 1101.7007544409946, 1112.4766696563686, 1126.3151898431086, 1120.5734286456159, 1157.4941304825406], [0.0019383188997990075, 0.004562322144607167, 0.006542977789195437, 0.0075472776918728, 0.002477308427112579, 0.005468034149789247, 0.003292656013065498, 0.006529366434709916, 0.005724972718548882, 0.008087259298567684, 0.002398058769145006, 0.006727797780851308, 0.006193270041902732, 0.010289001577674428, 0.008897942927170721, 0.004191469057549968, 0.0064783486927566525], [2.3548476e6, 2.368544668566294e6, 2.3779166237078514e6, 2.396172935888878e6, 2.390251263907863e6, 2.3712469101110045e6, 2.396779217307933e6, 2.40730361766056e6, 2.3972577482591323e6, 2.4044243760462375e6, 2.379762545515814e6, 2.396036339371717e6, 2.375051102777692e6, 2.388034944508816e6, 2.3819597996722134e6, 2.404005971934799e6, 2.4070592588056256e6], [0.0016459319014481277, 0.0022008892947757673, 0.002577293628883667, 0.0033148360952601945, 0.0028832004360239178, 0.0020131908897890096, 0.002998794627968848, 0.0033585248568235937, 0.0028307957888343994, 0.0031008578383656497, 0.0019174588981933321, 0.0026025186996954074, 0.0016905024059118922, 0.002339171971795323, 0.0021199590300171696, 0.0029695657278242197, 0.003023310072740414], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 522.3224713656203 260.35624948394695 … 138.118159156182 509.03583094221995; … ; 586.6105401239043 298.8830328152101 … 154.92638454695864 563.6880922228241; 594.9914648275882 302.7849512886018 … 158.55301293335125 577.7491185667725], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 516.8497755051014 257.62833589239597 … 136.67100970480928 503.7023474381135; … ; 556.6141153426287 283.59960062466826 … 147.00419883287967 534.8638105198548; 560.6351574124652 285.3013847467546 … 149.3977621844843 544.3884277003104])
+ BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72421.99999999999, 72681.7502593896, 73176.401246266, 73867.17982239214, 74152.98398991907, 74533.44252612938, 75595.20394112085, 76168.92970118487, 76664.59420812697, 76210.06990865905, 76309.04530150053, 77447.36481863567, 79021.47723135659, 78694.5421320678, 80007.17686016408, 80040.1440126773, 80524.604590613], [72421.99999999999, 71944.73435173799, 72378.94295622608, 72477.6393562904, 72293.1223988456, 72264.38551735468, 72122.57329744275, 72034.61672907104, 72059.74110667387, 71296.92574729073, 71574.87222671723, 72698.28356119142, 73367.419228534, 73029.56280267685, 73906.21000763217, 73743.27243868243, 74010.32507249503], [64900.92049553803, 65147.595667819725, 65596.38990341072, 66218.72285209103, 66474.50961288961, 66804.3023119489, 67749.04535911873, 68257.53299902841, 68715.23035030387, 68322.40207935528, 68424.45516176303, 69447.11833366095, 70852.28907917404, 70556.37043731457, 71742.37936190375, 71755.81252147754, 72186.15068201914], [64900.92049553803, 64486.97846775119, 64881.53669890396, 64973.06009309853, 64807.23500622964, 64770.54719156665, 64636.84513042093, 64552.63645880591, 64587.85519278798, 63917.763541834356, 64179.43791638064, 65188.61310453866, 65782.7438603023, 65477.23319024288, 66271.64666533892, 66110.6810476532, 66346.43541399196], [40512.94792630534, 40546.10112587102, 40795.575660388924, 41197.40361514666, 41347.03181298516, 41646.01305604716, 42257.46335488314, 42622.976763479746, 42800.31585449521, 42430.633822323136, 42389.29460664661, 43004.00358420117, 43932.50252971409, 43747.784590558964, 44389.85127066646, 44534.95316358483, 44828.02810644356], [40512.94792630534, 40134.95085202138, 40350.99558466418, 40422.425342533425, 40309.98984601154, 40378.16369058658, 40316.27456882514, 40309.477986029815, 40229.51809261453, 39695.19713951782, 39759.485042224005, 40366.993172096736, 40789.092330169166, 40598.51542019835, 41004.89229799209, 41031.32527680147, 41201.53025754307], [14866.888022051655, 14923.626548726328, 14902.551432859242, 15158.437779022603, 15183.194009278683, 15337.765328399691, 15408.528404866669, 15673.18405380608, 15756.188580932307, 15659.895529285457, 15742.310526559959, 15810.468101069293, 16406.817854913257, 16372.799333591598, 16603.987158152337, 16654.26462561381, 16590.51663557148], [14866.888022051655, 14772.296261178071, 14740.14711971346, 14873.28728664585, 14802.378054906369, 14870.830450071133, 14700.70403079129, 14822.471717395625, 14809.794295494425, 14650.326526402214, 14765.665853110579, 14840.968391091552, 15232.895232309904, 15194.171600636444, 15337.846053726102, 15344.050022673982, 15248.377009260328], [15944.236265986638, 16006.229444184786, 16217.030293458309, 16332.041802053584, 16324.51854050429, 16425.563053757473, 16777.61246276652, 16648.017163825487, 16724.971066168204, 16723.6035968761, 16690.697471290452, 17159.52542800319, 17353.736922949316, 17388.01802643642, 17961.770521891198, 17860.56506371237, 17837.54277512359], [15944.236265986638, 15843.92122128447, 16040.301115375, 16024.81424804944, 15915.076554590687, 15925.511832359336, 16006.89622511554, 15744.392633582056, 15720.386933410951, 15645.458996464236, 15655.215370109141, 16107.301368635868, 16112.061386552925, 16136.307805751365, 16592.0913147574, 16455.44909556314, 16394.52122730856], [15944.236265986638, 15988.459382171843, 16082.137725476556, 16249.345614855936, 16320.524647713939, 16409.62300438605, 16652.860067070258, 16779.524856062617, 16860.78230481237, 16740.219598980977, 16745.965039340594, 16990.185159753837, 17377.886204616763, 17286.71797387633, 17561.013102803503, 17608.80618088389, 17711.96245861743], [15944.236265986638, 15826.331353313866, 15906.878573177104, 15943.673686757367, 15911.18283427351, 15910.057053485561, 15887.874602928467, 15868.762324010813, 15848.040680191463, 15661.003790868814, 15707.054167277169, 15948.345064979201, 16134.482765325385, 16042.300034056903, 16221.893750744128, 16223.496440876032, 16279.100107334363], [3173.2320350842083, 3168.915166862178, 3183.583932350774, 3218.3997805389413, 3231.0554512939107, 3249.1664361699454, 3308.113087971733, 3339.4865582908137, 3338.983901908825, 3298.424077424485, 3290.7958030277723, 3333.3430910627258, 3431.408619424528, 3414.3207343669797, 3456.2365750237836, 3488.2610941254734, 3511.2165897129935], [3173.2320350842083, 3136.7813660161514, 3148.890023444989, 3157.857375347561, 3150.016016207826, 3150.2505183645603, 3156.14769488951, 3158.2252139039997, 3138.4280842563417, 3085.7798295299735, 3086.6365605192323, 3128.942111953002, 3185.888236291104, 3168.5342304994115, 3192.680409111528, 3213.834649780343, 3227.166187598885], [34195.564496956766, 34947.25815895453, 34904.742178347464, 34013.98711460353, 34009.83761997212, 34179.83185492719, 35646.64271742536, 36342.48224725091, 36476.792210114625, 36854.94783401501, 36595.17647512706, 37302.38994423175, 37929.38617769391, 36815.53055266503, 36891.70925640321, 37144.81389603114, 38078.072664107116], [34195.564496956766, 34592.881921452885, 34524.3589463523, 33374.13851576916, 33156.8228482856, 33139.27899166753, 34009.136402326454, 34369.87745441647, 34285.816421684765, 34478.96691725099, 34324.83095513032, 35015.00313182211, 35215.50437019158, 34165.2931419003, 34078.52293813147, 34222.578739805016, 34997.632715270454], [33097.63671130043, 33741.46501834736, 33643.49831878863, 32834.69048843437, 32711.59799282069, 33055.73076700225, 34495.04299882112, 35117.730527176755, 35093.6735035833, 35459.01087384127, 35108.433778123355, 35829.022238869315, 36600.96625391388, 35629.59037118457, 35840.14134694835, 36154.45273626471, 36809.555590632626], [33097.63671130043, 33399.315904199124, 33276.859809879585, 32217.02603670756, 31891.144904948236, 32049.39944733, 32910.437929615946, 33211.6030623524, 32985.77463653072, 33173.02383234511, 32930.324993856644, 33631.982502454404, 33982.134090689484, 33064.72516580994, 33107.14259697419, 33310.130696161104, 33831.73613688725], [29576.147776884867, 29688.560687096116, 29874.84914653091, 30191.75309697532, 30300.764812010013, 30462.27519249627, 30878.82611730193, 31130.62412708181, 31313.947989335647, 31125.473463167877, 31157.463422849447, 31610.335390176788, 32301.7284365901, 32105.46997910206, 32610.80368168373, 32663.509954672845, 32852.9200473079], [34346.71094688274, 34477.255795483405, 34730.670921565186, 35029.041709627934, 35176.45297210262, 35343.21946863073, 35856.04788222919, 36100.42230553203, 36365.1105878157, 36167.18724057725, 36233.56057571283, 36789.367440253576, 37482.85100361203, 37384.29627344702, 38047.47206022645, 38011.68504866964, 38244.85790154545], [28335.329312139656, 28443.026124239765, 28652.088385290303, 28898.238141811544, 29019.849398068312, 29157.42832388347, 29580.501205662662, 29782.105073073977, 30000.467455870137, 29837.184769756896, 29891.94140457762, 30350.47062343254, 30922.580283967625, 30841.274660881525, 31388.381029793913, 31358.857482135227, 31551.22028459118], [978.0617717704338, 981.779185240251, 990.8698353146735, 997.9280454877489, 997.2918287770918, 998.8076508218927, 1014.1713595876192, 1026.4865664145927, 1036.1717731525475, 1029.741375610151, 1033.4311632007611, 1047.4155032305223, 1067.709638971889, 1066.6041847654847, 1084.1036199935645, 1080.6175181350654, 1088.3727331657506], [0.0019383188997990075, 0.002003187887466229, 0.0038246573762215075, -0.0003853963558357876, 0.009765006193145576, 0.008358820314166904, 0.007302032593850871, 0.005333006759770997, 0.0002858164323726875, -0.0005991376864442621, 0.001744836390646043, 0.0022773252141152778, 0.0022467779062247395, 0.007297941709985212, 0.008682890489419837, 0.004702835113359782, 0.008520747111577798], [2.3548476e6, 2.385478058633289e6, 2.3854534076825483e6, 2.3659523243698883e6, 2.346245709072582e6, 2.3307909749712e6, 2.3487793503114977e6, 2.3523112434698064e6, 2.3692186257596873e6, 2.377647134138092e6, 2.371415762831886e6, 2.3557617517176345e6, 2.371353771453956e6, 2.3599404777855733e6, 2.346778264196656e6, 2.3569834813029217e6, 2.3654632738179658e6], [0.0016459319014481277, 0.0028494550935198168, 0.0027252529204677143, 0.0017105573341589372, 0.000988742399005824, 0.00045946378614272277, 0.0013521291874683877, 0.0015223140655247372, 0.002123139334631543, 0.002302123606431169, 0.0019139476409490955, 0.0011752260886521392, 0.0017907918548316312, 0.0013522823297358862, 0.0009028361747306631, 0.0013716458873442188, 0.0018195055802070004], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 520.0525686081813 259.22479640463666 … 137.51792690980534 506.82366910803887; … ; 572.8638673093445 284.6670224421107 … 151.0625362191737 556.4427232047899; 574.8732930230894 284.862593330389 … 152.07781122059765 560.2547040787667], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 514.7790712789154 256.596175080492 … 136.12345168929826 501.684316998687; … ; 527.7958549222394 262.2718643151388 … 139.17823238704386 512.666585498821; 528.3671929646996 261.8177790572314 … 139.77502034281386 514.9312186389516])
+ BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72421.99999999999, 73041.96209095372, 73530.5075830757, 73016.19850768395, 74374.91451347814, 75157.76410832818, 75638.0964386291, 75735.9528568456, 76038.04293851422, 75549.06748396684, 76262.4163572957, 76940.24193803295, 77333.01757496825, 78136.05095755265, 79142.42268278466, 80053.17808928996, 80831.77714573246], [72421.99999999999, 72867.58556913042, 73052.06562817807, 72527.8111845105, 73487.67229226344, 74161.19797621429, 74372.1703054554, 74402.06521594283, 74040.35679052715, 73421.49667427072, 73641.87844646176, 74287.24286562689, 74636.7738002418, 75217.15981368028, 75557.38086119376, 75617.83171714355, 75971.61989658535], [64900.92049553803, 65461.92670857429, 65895.18014491646, 65427.289960026, 66654.01256073249, 67365.28297694892, 67814.36417384427, 67902.51426445335, 68161.23495426944, 67719.78679388751, 68357.92544911275, 68992.6969179492, 69361.22668174419, 70089.93171170467, 71000.34350083089, 71822.85862208041, 72524.68557758315], [64900.92049553803, 65305.64636280431, 65466.41907902493, 64989.66297232811, 65858.87545645333, 66472.04246758073, 66679.38088031462, 66706.5918372967, 66370.48982675555, 65812.69983146939, 66009.00256282363, 66613.73947883004, 66942.92229491813, 67471.61560229372, 67784.12655713141, 67843.51310413842, 68164.00728003052], [40512.94792630534, 40835.07548225776, 41143.04756002845, 40895.848348828906, 41550.27314504715, 41907.79828690954, 42055.80491454868, 42095.299578871716, 42334.45971484134, 42059.998272624805, 42453.68922011542, 42643.79578522487, 42698.315882976436, 43115.18700597659, 43587.55082805345, 44030.731244140006, 44437.037423057634], [40512.94792630534, 40737.5879801816, 40875.34153225728, 40622.30611693787, 41054.60660373495, 41352.11527877747, 41351.93285800931, 41353.90268967576, 41222.24061389419, 40875.52799971649, 40994.890674645074, 41173.38254226694, 41209.62357533209, 41504.5535534808, 41613.09531706134, 41591.20855749756, 41765.17992853642], [14866.888022051655, 14845.938256957565, 15057.135361119732, 15071.396594055639, 15383.160797518214, 15536.555238548866, 15675.632382842843, 15703.91702726676, 15807.712918571751, 15839.422115040295, 16021.810689626573, 16155.133352553308, 16234.767599043922, 16414.984130288798, 16665.577083995388, 16972.445912861655, 17300.745019698912], [14866.888022051655, 14810.495848205877, 14959.162893444423, 14970.58774356089, 15199.650136099994, 15330.54585356851, 15413.275268877587, 15427.334241333787, 15392.40963210603, 15393.361121083408, 15471.267390347088, 15598.083456174792, 15668.736524016756, 15801.777406663408, 15910.649589969273, 16032.08753855579, 16260.506337682324], [15944.236265986638, 16394.122569825457, 16347.228947211057, 16108.96215343434, 16422.29960557988, 16294.43098479667, 16486.136086064478, 16732.21524376209, 16697.000211704435, 16680.583668079533, 16571.1140482118, 16740.293097897847, 17046.143481592928, 17036.647510517418, 17214.816047154756, 17565.915998415676, 17805.42272013034], [15944.236265986638, 16354.98410762872, 16240.862210032943, 16001.213283101282, 16226.392723873607, 16078.37242778437, 16210.213879014484, 16437.521716095434, 16258.33339774092, 16210.834350413488, 16001.69552382828, 16163.066136533509, 16451.823491418167, 16400.2176048553, 16435.008790970405, 16592.676413722333, 16734.839375768745], [15944.236265986638, 16079.860430480225, 16194.058591273177, 16074.026161128386, 16363.60013795686, 16532.13611039994, 16630.521649448474, 16650.144786349796, 16711.681665682743, 16596.58957415126, 16723.293667438375, 16863.19820254214, 16924.173553721947, 17103.59481549348, 17324.441647187046, 17507.453534236804, 17660.00686361334], [15944.236265986638, 16041.47222111393, 16088.688489735647, 15966.510969021712, 16168.39350103579, 16312.925665084194, 16352.18291598458, 16356.896711796173, 16272.629137725135, 16129.205651431575, 16148.645929498718, 16281.733314178848, 16334.106089428606, 16464.663991328238, 16539.668503587196, 16537.453062400586, 16598.16691144412], [3173.2320350842083, 3198.463116312635, 3222.5854503592986, 3203.2439841566543, 3254.4819510592183, 3280.2906226278933, 3295.328650905813, 3296.1029240251664, 3314.0989267045643, 3297.074213671486, 3305.26473425148, 3322.8536048828514, 3309.096729572126, 3356.0741002483514, 3396.8348921099678, 3418.531976047915, 3443.491226856705], [3173.2320350842083, 3190.827274428918, 3201.6170097300483, 3181.818276069034, 3215.658191542327, 3236.79509589442, 3240.175985080034, 3238.050826076241, 3227.0302797078234, 3204.223843865162, 3191.6888477903367, 3208.277314122092, 3193.723868964075, 3230.702842687405, 3242.962989577186, 3229.12821020218, 3236.445069521717], [34195.564496956766, 34218.04098228635, 34795.159869971925, 34241.24554077041, 34923.57869236743, 36238.43267483192, 36049.35818382325, 36552.36415758082, 37080.20921886662, 36676.4006732301, 37485.57013302247, 37366.604326228786, 39451.81283723249, 39256.43420705035, 40021.871248448646, 40423.339937568926, 39483.39002330328], [34195.564496956766, 34136.35063882775, 34568.75772946779, 34012.21430395492, 34506.96411560493, 35757.9235070422, 35446.01374817807, 35908.59135277129, 36106.03080161184, 35643.54028096064, 36197.48666629116, 36078.15547138522, 38076.31103865151, 37789.95034022147, 38208.936069813724, 38183.684768074476, 37109.3795657986], [33097.63671130043, 33251.215200373095, 33812.06415525523, 33301.25412940534, 33904.39772703441, 34819.45307675783, 34628.83512865024, 35347.8431506357, 35881.339125469836, 35707.33724500847, 36269.767733680696, 35965.58462387179, 38098.022225877554, 37687.20189628096, 38347.392524867915, 38939.25500369565, 38194.8180404578], [33097.63671130043, 33171.833005713255, 33592.0587370241, 33078.51026304442, 33499.941287049835, 34357.75909095735, 34049.26544862413, 34725.28478393336, 34938.65765482574, 34701.76707790382, 35023.46180865002, 34725.44474073341, 36769.72082917682, 36279.33909154123, 36610.30890662132, 36781.82556070603, 35898.2853112008], [29576.147776884867, 29831.80520876445, 30051.468848671837, 29816.894299321102, 30342.8425976249, 30676.824178042152, 30877.13406397458, 30909.848353254278, 31013.20347237592, 30786.826562935265, 31057.766387244203, 31345.34508881136, 31496.468711088095, 31843.092424223636, 32237.068827590094, 32597.4411630471, 32880.71850951724], [34346.71094688274, 34643.60532205404, 34851.43588405263, 34623.10936385732, 35306.095404497544, 35671.588388959186, 35911.64068415244, 35967.977765079835, 36114.982490591035, 35901.395535046766, 36256.06396334475, 36590.947574787046, 36808.036834571554, 37173.20138648203, 37675.610047457376, 38130.72199131343, 38531.04514011643], [28335.329312139656, 28580.261058425665, 28751.716992720634, 28563.352314937238, 29126.801735379973, 29428.32592184468, 29626.364122560753, 29672.84105431213, 29794.116925944858, 29617.912085502234, 29910.506236015928, 30186.778320004723, 30365.872489331032, 30667.125725703645, 31081.60252611762, 31457.060508775485, 31787.318863648186], [978.0617717704338, 986.5161777558503, 992.2754121919645, 987.2862968475637, 1005.0745586099879, 1016.8704099476581, 1025.5894257172577, 1024.6881461192118, 1033.0489913025053, 1031.5646959054382, 1044.0950985238367, 1056.4042543507594, 1056.7211360845668, 1073.637900999079, 1087.6646257834561, 1094.6954677198985, 1112.9219279494669], [0.0019383188997990075, 0.005485446913817693, 0.007838121590065139, 0.009190650031783543, 0.0036002185043286783, 0.003465823409048996, 0.0016273978773713171, 0.0013628471074669246, 0.008105636337917499, 0.0044776715783059196, 0.003595827017176534, 0.004986403334994893, 0.0032454095280660678, 0.007218201777426492, 0.006336694118628694, 0.008168172394664053, 0.0048728387023082576], [2.3548476e6, 2.3451057285341593e6, 2.3337626746702176e6, 2.325518774423045e6, 2.3315381326124487e6, 2.365187138255981e6, 2.3660365304423515e6, 2.3692828812342673e6, 2.382274732950323e6, 2.376776132772435e6, 2.3671758574892166e6, 2.352853113287524e6, 2.372688312051525e6, 2.3532311970336614e6, 2.368403475563104e6, 2.3640848109760685e6, 2.3454383108431934e6], [0.0016459319014481277, 0.0012430491599961264, 0.0008551341810887072, 0.0006552817302776346, 0.0009439813153419778, 0.0023731701247019558, 0.0022701457395186897, 0.0022683103780065787, 0.002825740697865913, 0.0024922684844698767, 0.0019929797212539543, 0.001364728500550215, 0.0021673703506496947, 0.0013659608727127253, 0.0020444172825368045, 0.0019011517705180394, 0.001096420791867878], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 522.5617734907577 260.4755317419579 … 138.18143801324464 509.26904579088847; … ; 559.7627206881937 281.81107455153165 … 150.03362003015457 550.6652393348324; 555.5999755677304 284.25220044971627 … 151.47949506186714 555.9304865417539], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 521.3142371172721 259.8536862172074 … 137.85155094762484 508.0532437733205; … ; 528.7490668680049 266.19733182480735 … 141.72100723721204 520.1556314735843; 522.1935190449084 267.16102119590687 … 142.3715156010823 522.5041574469915])
+ BeforeIT.Data{Float64, Vector{Float64}, Matrix{Float64}}([72421.99999999999, 73875.95876494507, 74309.80763616267, 73977.07148892975, 73725.24343037003, 75559.70485973563, 75717.83110150801, 77335.26572546198, 78127.96832237339, 79373.77391280657, 79708.53503952197, 80053.84747825257, 81049.9504826482, 79615.0265287118, 80732.97813585919, 81008.30843932695, 82046.4698803325], [72421.99999999999, 73293.28256516301, 73613.0659706757, 72642.78012092212, 71943.74537348174, 73566.90864102652, 73921.65770174118, 74943.45634697808, 75335.02538277194, 75720.91940691802, 75294.30666886819, 76195.97244267676, 77074.56985403849, 76018.66297650384, 76782.36978663722, 76534.88916495875, 77299.20626669396], [64900.92049553803, 66215.774232928, 66609.81158343749, 66288.58903120288, 66063.89119693174, 67744.13269369667, 67908.37056372089, 69374.59647064791, 70099.7693789245, 71214.03171115987, 71494.83636222071, 71820.49180608403, 72732.51952330499, 71411.32039700398, 72420.71209896373, 72674.73232224108, 73628.58791914865], [64900.92049553803, 65693.51562078018, 65985.26641858321, 65092.97138425432, 64467.52218786949, 65957.46277853046, 66297.45267220677, 67228.9930527185, 67593.82099502815, 67936.69609014777, 67535.47950201893, 68359.39042108515, 69165.09662592979, 68185.53399601331, 68876.85831726251, 68661.50757291359, 69368.3885850156], [40512.94792630534, 41249.41467847444, 41497.03637386007, 41474.00537112897, 41280.45288046868, 42030.89829186698, 41952.672491655714, 42725.403154347034, 43061.28554140087, 43800.04419711423, 44137.66134666439, 44219.71109441185, 44654.21984331325, 44123.68508270735, 44666.5271983016, 44806.902931169694, 45243.224503389654], [40512.94792630534, 40924.071324697325, 41107.952951958905, 40725.957276636924, 40282.951303366724, 40922.38396745998, 40957.473959389, 41404.0005703455, 41521.917297153566, 41784.32564278041, 41693.334439462415, 42088.71895742744, 42463.9961665105, 42130.53354160569, 42480.80385011283, 42332.588048429396, 42625.4212784381], [14866.888022051655, 14883.383196566756, 14694.940816807564, 14797.38564138275, 15052.586431041269, 15148.501699055, 15506.906471847558, 15806.177875534098, 16076.490389678307, 16014.069027936992, 16153.885468599648, 16262.727795480172, 16158.39708518189, 16329.098206494662, 16155.337099878054, 16235.687665774496, 16677.658050797934], [14866.888022051655, 14765.99462651153, 14557.15849890594, 14530.491811538042, 14688.855472277219, 14748.978210165977, 15139.052658390272, 15317.327619107818, 15501.783005222165, 15277.086756304441, 15259.289431971602, 15479.010665712094, 15365.851520634404, 15591.481500318183, 15364.787672556402, 15339.124837393792, 15712.677603245014], [15944.236265986638, 16676.840501610866, 16948.154920897334, 16269.447479233284, 15762.69855270324, 16597.484526498716, 16280.446784839018, 16827.814272582047, 17187.555469361927, 17789.8222090864, 17475.277027642573, 17767.775464100796, 18386.006991927265, 17893.65752563709, 18101.435838975907, 17480.94535723351, 17947.263910078622], [15944.236265986638, 16545.30653291115, 16789.246076127696, 15976.00272808438, 15381.808432354212, 16159.745860553832, 15894.243099051397, 16307.367053335032, 16573.12938446632, 16971.11813326909, 16507.502828779103, 16911.528580785256, 17484.200444262082, 17085.36667218011, 17215.655514632825, 16515.61723963931, 16908.823218493068], [15944.236265986638, 16257.306650117629, 16360.16745362563, 16297.50165345661, 16220.90935424784, 16598.944064397674, 16638.922836166523, 16958.826158558786, 17099.722377459606, 17400.64536067682, 17518.28469533776, 17583.524075918718, 17799.85565863035, 17511.23372495043, 17732.073287888914, 17823.993779507822, 18051.73987574984], [15944.236265986638, 16129.081638680254, 16206.771681494238, 16003.550901708475, 15828.947020168274, 16161.166904898433, 16244.215405112021, 16434.327030332952, 16488.43617728338, 16599.851563459368, 16548.128748185958, 16736.156451416206, 16926.79897005757, 16720.21768855063, 16864.36744576992, 16839.721933130622, 17007.25413492507], [3173.2320350842083, 3227.569530451634, 3249.750696135014, 3242.5401346392528, 3230.109631279919, 3294.5935707289673, 3289.727834482377, 3336.6441269654747, 3339.159671041706, 3407.9461858736167, 3456.7536164529397, 3463.5872092637906, 3497.7053124020263, 3456.047959410568, 3498.699336096786, 3516.767465938849, 3546.998679040843], [3173.2320350842083, 3202.112968127757, 3219.2804690617745, 3184.0558877639937, 3152.0572063042605, 3207.7026329980713, 3211.6891275779435, 3233.44907564348, 3219.7903513512665, 3251.1093496338644, 3265.319915199482, 3296.6734749577863, 3326.14802136475, 3299.931639943859, 3327.4930815059847, 3322.565467789671, 3341.766963511895], [34195.564496956766, 35328.14703084121, 36041.40391714216, 37727.33143631166, 38415.9222180406, 38779.4238638186, 39403.65543827963, 39741.28391738018, 38843.71120480736, 39118.44234197223, 39917.818907516164, 39530.066414139685, 39541.052449116876, 38673.362907811825, 38906.353914672785, 39220.35801062872, 38603.814236926126], [34195.564496956766, 35049.50603854262, 35703.47345290696, 37046.86042468257, 37487.63920939047, 37756.66326168292, 38468.92452057901, 38512.1735665602, 37455.11412124134, 37318.175436064696, 37707.18527049337, 37625.07294814555, 37601.622097771855, 36926.41288007042, 37002.50036978762, 37054.54182643109, 36370.17172991861], [33097.63671130043, 34261.82664254752, 34871.728392544384, 36291.0984391265, 36786.416651883905, 36996.60352150334, 37425.85008511382, 37765.413494380955, 37041.07428287542, 37348.60386330288, 37976.107710901415, 37726.43328987977, 37689.72588689177, 37404.77719393939, 37096.67591596948, 36735.58552547958, 36425.49082085922], [33097.63671130043, 33991.59595749895, 34544.765009223665, 35636.53212001932, 35897.50904390693, 36020.86265883593, 36538.036535668354, 36597.41246237, 35716.918425311844, 35629.78656150016, 35873.00530183888, 35908.35870939341, 35841.100375141, 35715.131617670835, 35281.37762045278, 34706.982786935005, 34317.88756340032], [29576.147776884867, 30175.342798236026, 30392.90829015156, 30294.074308336563, 30161.24138199365, 30870.273144955758, 30983.99568172094, 31593.018149747688, 31885.67266303018, 32412.606259166954, 32595.445800680238, 32734.20620896859, 33143.43780017443, 32588.84182972385, 32979.7269782893, 33169.77402268105, 33617.65208872113], [34346.71094688274, 35042.55471783, 35211.46816538893, 34993.91037328061, 34898.979247157215, 35838.578217852395, 35889.33573159697, 36723.05966267075, 37144.42513836208, 37719.317840581105, 37815.894349681825, 37995.939666320155, 38486.839861367174, 37743.56459307155, 38344.43910224563, 38411.23449078842, 38908.23253378641], [28335.329312139656, 28909.386095337435, 29048.73621154603, 28869.255512699943, 28790.939288336023, 29566.089092262497, 29607.962995974623, 30295.768072242954, 30643.38591352461, 31117.66055547545, 31197.33418691625, 31345.8678659036, 31750.850418892813, 31137.66362702513, 31633.37272473317, 31688.477544924517, 32098.490696914985], [978.0617717704338, 997.8767168619914, 1005.4351278969906, 1000.6043495856359, 1003.6705677807821, 1035.2813308885197, 1035.0391504029774, 1058.5186582294168, 1069.6715775323448, 1082.1076114117004, 1083.4962118586186, 1090.345930795234, 1102.2418617633784, 1078.9139742085622, 1096.5460184288156, 1093.7238087716532, 1102.7032966411462], [0.0019383188997990075, 0.0061588449453913174, 0.00883140264351523, 0.0029867999421708813, -0.000862529096721798, 0.0020563716913439833, 0.00010698026935251903, 0.004736802076538815, 0.0033070463529492056, 0.0031536965056262467, -0.0020192488254826557, 0.0033073193049075744, -0.0011468648386668834, -0.001144710086843248, 0.0023152025649320063, 0.0024193030170760466, -0.002412536725246217], [2.3548476e6, 2.374479932273651e6, 2.389389693411018e6, 2.4314535053508678e6, 2.4517775940343644e6, 2.4474411792014292e6, 2.4447882236594833e6, 2.440226251322359e6, 2.421440659032087e6, 2.409080190923497e6, 2.422515519639493e6, 2.406041260669669e6, 2.4048697118622237e6, 2.409753812922386e6, 2.4175012620639605e6, 2.415841071923976e6, 2.3966027922043293e6], [0.0016459319014481277, 0.0024854371305578072, 0.003121714349551156, 0.0046907143350542, 0.005145825843019477, 0.004638086448577811, 0.004190550005049748, 0.003805471196438202, 0.0028424262640317686, 0.0022022763024717546, 0.002541445829268468, 0.0017602967599404046, 0.0015557647845435133, 0.001614079048592627, 0.0018639439126214605, 0.0017139210315558252, 0.0007483928504041212], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 528.5794988935187 263.4751201230412 … 139.7727100731345 515.1336945829798; … ; 581.1196193712752 292.6635908015402 … 153.61956254748674 561.0217398834419; 593.8804697832718 299.0002731382249 … 154.93903838327188 565.9535238768561], [518.0834390395164 258.24326637797435 … 136.99722836422484 504.9046295086171; 524.4104742358761 261.3970329577852 … 138.67029146632112 511.07071998938665; … ; 549.0291862281608 276.50219978844456 … 145.1364239008547 530.0411464988279; 559.5181486600751 281.6999173860837 … 145.97416201111508 533.2070745191952])

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()
1

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. Since we are saving the initial data point, we effectively have T+1 data points in our time series.

Te = T + 1
 
 p1 = errorline(1:Te, data_vector.real_gdp, errorstyle = :ribbon, title = "gdp", titlefont = 10)
 p2 = errorline(
@@ -80,4 +80,4 @@
     title = "gdp deflator",
     titlefont = 10,
 )
-plot(p1, p2, p3, p4, p5, p6, p7, p8, p9, layout = (3, 3), legend = false)
Example block output
+plot(p1, p2, p3, p4, p5, p6, p7, p8, p9, layout = (3, 3), legend = false)
Example block output
diff --git a/dev/examples/change_expectations-8f0b7ae4.svg b/dev/examples/change_expectations-7002fb18.svg similarity index 86% rename from dev/examples/change_expectations-8f0b7ae4.svg rename to dev/examples/change_expectations-7002fb18.svg index f16bd2a..13a0fcd 100644 --- a/dev/examples/change_expectations-8f0b7ae4.svg +++ b/dev/examples/change_expectations-7002fb18.svg @@ -1,290 +1,290 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/examples/change_expectations-2d24e30b.svg b/dev/examples/change_expectations-8091118d.svg similarity index 86% rename from dev/examples/change_expectations-2d24e30b.svg rename to dev/examples/change_expectations-8091118d.svg index f4c16c8..07d1e42 100644 --- a/dev/examples/change_expectations-2d24e30b.svg +++ b/dev/examples/change_expectations-8091118d.svg @@ -1,86 +1,86 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/examples/change_expectations.html b/dev/examples/change_expectations.html index 230cca5..49a53ca 100644 --- a/dev/examples/change_expectations.html +++ b/dev/examples/change_expectations.html @@ -1,5 +1,5 @@ -Experimentations (advanced) · BeforeIT.jl

In this tutorial we will illustrate how to experiment with different expectations of the agents in the model.

import BeforeIT as Bit
+Experimentations (advanced) · BeforeIT.jl

Changing expectations via function overloading

In this tutorial we will illustrate how to experiment with different expectations of the agents in the model.

import BeforeIT as Bit
 using Random, Plots

Import standard parameters and initial conditions

par = Bit.AUSTRIA2010Q1.parameters
 init = Bit.AUSTRIA2010Q1.initial_conditions
Dict{String, Any} with 21 entries:
   "sb_inact" => 2.23847
@@ -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 estimatenextvalue 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 need to 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 estimatenextvalue 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 need to 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 846cca7..59bd6f6 100644 --- a/dev/examples/get_parameters_and_initial_conditions.html +++ b/dev/examples/get_parameters_and_initial_conditions.html @@ -36,4 +36,4 @@ ".jld2", init_conds, ) -end +end diff --git a/dev/examples/multithreading_speedup.html b/dev/examples/multithreading_speedup.html index c32b863..ca849da 100644 --- a/dev/examples/multithreading_speedup.html +++ b/dev/examples/multithreading_speedup.html @@ -1,10 +1,10 @@ -Multithreading within the model · BeforeIT.jl

In this tutorial we illustrate how to make use of multi threading in BeforeIT to allow for faster executions of single simulation runs.

import BeforeIT as Bit
+Multithreading within the model · BeforeIT.jl

Multithreading speedup for large models

In this tutorial we illustrate how to make use of multi threading in BeforeIT to allow for faster executions of single simulation runs.

import BeforeIT as Bit
 using FileIO, Plots, StatsPlots

We then initialise the model, this time we will use the Italy 2010Q1 scenario, and we want to simulate the model for a large number of epochs

parameters = Bit.ITALY2010Q1.parameters
 initial_conditions = Bit.ITALY2010Q1.initial_conditions
 T = 50
 model = Bit.initialise_model(parameters, initial_conditions, T);

The model is in scale 1:2000, so it has around 30,000 households

println(model.prop.H)
29915

Note that households are the sum of active and inactive households and the owners of firms and of the bank

println(length(model.w_act) + length(model.w_inact) + length(model.firms) + 1)
29915

Let's fist check how many threads we have available in this Julia session

println(Threads.nthreads())
1

Let's now compare the performance of single threading and multi threading

@time data = Bit.run_one_sim!(model; multi_threading = false);
 
 model = Bit.initialise_model(parameters, initial_conditions, T);
-@time data = Bit.run_one_sim!(model; multi_threading = true);
 12.680765 seconds (111.88 M allocations: 25.252 GiB, 29.56% gc time, 0.08% compilation time: 73% of which was recompilation)
- 12.311659 seconds (111.85 M allocations: 25.233 GiB, 28.75% gc time)

Is the speedup in line to what we would expect?

+@time data = Bit.run_one_sim!(model; multi_threading = true);
 12.437048 seconds (111.87 M allocations: 25.251 GiB, 27.35% gc time, 0.02% compilation time)
+ 12.626472 seconds (111.85 M allocations: 25.233 GiB, 29.39% gc time)

Is the speedup in line to what we would expect?

diff --git a/dev/examples/scenario_analysis_via_overload-c08775a6.svg b/dev/examples/scenario_analysis_via_overload-40928178.svg similarity index 86% rename from dev/examples/scenario_analysis_via_overload-c08775a6.svg rename to dev/examples/scenario_analysis_via_overload-40928178.svg index 64f2530..a5f97cb 100644 --- a/dev/examples/scenario_analysis_via_overload-c08775a6.svg +++ b/dev/examples/scenario_analysis_via_overload-40928178.svg @@ -1,50 +1,50 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/examples/scenario_analysis_via_overload.html b/dev/examples/scenario_analysis_via_overload.html index e7c8aad..18ee4a5 100644 --- a/dev/examples/scenario_analysis_via_overload.html +++ b/dev/examples/scenario_analysis_via_overload.html @@ -1,5 +1,5 @@ -Shocked simulations (advanced) · BeforeIT.jl

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.

import BeforeIT as Bit
+Shocked simulations (advanced) · BeforeIT.jl

Scenario analysis via function overloading

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.

import BeforeIT as Bit
 using Plots, StatsPlots
 
 
@@ -66,9 +66,9 @@
     titlefont = 10,
     xlabel = "quarters",
     ylabel = "GDP",
-)
Example block output

Note that, importantly, once the function centralbankrate 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 redefine the function centralbankrate

function central_bank_rate(cb::Bit.CentralBank, model::Bit.Model)
+)
Example block output

Note that, importantly, once the function centralbankrate 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 redefine the function centralbankrate

function central_bank_rate(cb::Bit.CentralBank, model::Bit.Model)
     gamma_EA = model.rotw.gamma_EA
     pi_EA = model.rotw.pi_EA
     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)
     return taylor_rate
-end
central_bank_rate (generic function with 2 methods)
+end
central_bank_rate (generic function with 2 methods)
diff --git a/dev/examples/scenario_analysis_via_shock-70fc6778.svg b/dev/examples/scenario_analysis_via_shock-92f31aca.svg similarity index 86% rename from dev/examples/scenario_analysis_via_shock-70fc6778.svg rename to dev/examples/scenario_analysis_via_shock-92f31aca.svg index c89fec6..ffc4c92 100644 --- a/dev/examples/scenario_analysis_via_shock-70fc6778.svg +++ b/dev/examples/scenario_analysis_via_shock-92f31aca.svg @@ -1,50 +1,50 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/examples/scenario_analysis_via_shock.html b/dev/examples/scenario_analysis_via_shock.html index a13dd61..c4764a8 100644 --- a/dev/examples/scenario_analysis_via_shock.html +++ b/dev/examples/scenario_analysis_via_shock.html @@ -1,5 +1,5 @@ -Shocked simulations · BeforeIT.jl

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.

import BeforeIT as Bit
+Shocked simulations · BeforeIT.jl

Scenario analysis via custom shocks

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.

import BeforeIT as Bit
 using Plots, StatsPlots
 
 
@@ -59,4 +59,4 @@
     titlefont = 10,
     xlabel = "quarters",
     ylabel = "GDP",
-)
Example block output

Note that, importantly, once the function centralbankrate 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 centralbankrate

+)
Example block output

Note that, importantly, once the function centralbankrate 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 centralbankrate

diff --git a/dev/index.html b/dev/index.html index 520bc07..9739647 100644 --- a/dev/index.html +++ b/dev/index.html @@ -7,8 +7,6 @@ T = 20 model = BeforeIT.initialise_model(parameters, initial_conditions, T) -data = BeforeIT.run_one_sim!(model) +data = BeforeIT.run_one_sim!(model)

To plot the results of the simulation, install the Plots package via Pkg.add("Plots") and then run

using Plots
 
-plot(data.real_gdp)

To plot the results of the simulation, install the Plots package via Pkg.add("Plots") and then run

using Plots
-
-plot(data.real_gdp)

License

BeforeIT.jl is released under the GNU Affero General Public License v3 or later (AGPLv3+).

Copyright 2024- Banca d'Italia and the authors.

Original authors

Other collaborators for the project

Disclaimer

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.

+plot(data.real_gdp)

License

BeforeIT.jl is released under the GNU Affero General Public License v3 or later (AGPLv3+).

Copyright 2024- Banca d'Italia and the authors.

Original authors

Other collaborators for the project

Disclaimer

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.

diff --git a/dev/objects.inv b/dev/objects.inv index 6fa03d0..d47d538 100644 Binary files a/dev/objects.inv and b/dev/objects.inv differ diff --git a/dev/search_index.js b/dev/search_index.js index ca8adbd..41d34ce 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","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\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.initialise_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 centralbankrate 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 centralbankrate","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.initialise_model","page":"API","title":"BeforeIT.initialise_model","text":"initialise_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#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.one_epoch!-Tuple{Any}","page":"API","title":"BeforeIT.one_epoch!","text":"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())\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.initialise_data(model), then iteratively updates the model and data for each epoch using BeforeIT.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.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#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.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","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, StatsPlots","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.initialise_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.initialise_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 println(t)\n Bit.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":"p1 = plot(data.real_gdp, title = \"gdp\", titlefont = 10)\np2 = plot(data.real_household_consumption, title = \"household cons.\", titlefont = 10)\np3 = plot(data.real_government_consumption, title = \"gov. cons.\", titlefont = 10)\np4 = plot(data.real_capitalformation, title = \"capital form.\", titlefont = 10)\np5 = plot(data.real_exports, title = \"exports\", titlefont = 10)\np6 = plot(data.real_imports, title = \"imports\", titlefont = 10)\np7 = plot(data.wages, title = \"wages\", titlefont = 10)\np8 = plot(data.euribor, title = \"euribor\", titlefont = 10)\np9 = plot(data.nominal_gdp ./ data.real_gdp, title = \"gdp deflator\", titlefont = 10)\n\nplot(p1, p2, p3, p4, p5, p6, p7, p8, p9, layout = (3, 3), legend = false)","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.initialise_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. Since we are saving the initial data point, we effectively have T+1 data points in our time series.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"Te = T + 1\n\np1 = errorline(1:Te, data_vector.real_gdp, errorstyle = :ribbon, title = \"gdp\", titlefont = 10)\np2 = errorline(\n 1:Te,\n data_vector.real_household_consumption,\n errorstyle = :ribbon,\n title = \"household cons.\",\n titlefont = 10,\n)\np3 =\n errorline(1:Te, data_vector.real_government_consumption, errorstyle = :ribbon, title = \"gov. cons.\", titlefont = 10)\np4 = errorline(1:Te, data_vector.real_capitalformation, errorstyle = :ribbon, title = \"capital form.\", titlefont = 10)\np5 = errorline(1:Te, data_vector.real_exports, errorstyle = :ribbon, title = \"exports\", titlefont = 10)\np6 = errorline(1:Te, data_vector.real_imports, errorstyle = :ribbon, title = \"imports\", titlefont = 10)\np7 = errorline(1:Te, data_vector.wages, errorstyle = :ribbon, title = \"wages\", titlefont = 10)\np8 = errorline(1:Te, data_vector.euribor, errorstyle = :ribbon, title = \"euribor\", titlefont = 10)\np9 = errorline(\n 1:Te,\n data_vector.nominal_gdp ./ data.real_gdp,\n errorstyle = :ribbon,\n title = \"gdp deflator\",\n 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":"EditURL = \"../../../examples/change_expectations.jl\"","category":"page"},{"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.initialise_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 'estimatenextvalue' to make the agents expect the last value of the time series (in way representing 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.initialise_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 estimatenextvalue 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 need to 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","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\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.initialise_model(parameters, initial_conditions, T);\ndata = Bit.initialise_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\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 centralbankrate 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 redefine the function centralbankrate","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"function 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 return taylor_rate\nend","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 oject for italy, which contains 4 datasets: calibration_data, figaro, data, and ea These are saved within BeforeIT 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\n\nfieldnames(typeof(cal))","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"These are essentually 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 sgeneral, 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/\" *\n \"italy/\" *\n \"/parameters/\" *\n string(year(calibration_date)) *\n \"Q\" *\n string(Dates.quarterofyear(calibration_date)) *\n \".jld2\",\n params,\n )\n save(\n \"data/\" *\n \"italy/\" *\n \"/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)\n\nplot(data.real_gdp)","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"To plot the results of the simulation, install the Plots package via Pkg.add(\"Plots\") and then run","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#Original-authors","page":"Home","title":"Original authors","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"Aldo Glielmo \nMitja Devetak ","category":"page"},{"location":"index.html#Other-collaborators-for-the-project","page":"Home","title":"Other collaborators for the project","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","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":"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","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 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":"We then initialise the model, this time we will 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.initialise_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":"println(model.prop.H)","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Note that households are the sum of active and inactive households and 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":"println(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":"println(Threads.nthreads())","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":"@time data = Bit.run_one_sim!(model; multi_threading = false);\n\nmodel = Bit.initialise_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?","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\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.initialise_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 centralbankrate 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 centralbankrate","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.initialise_model","page":"API","title":"BeforeIT.initialise_model","text":"initialise_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#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.one_epoch!-Tuple{Any}","page":"API","title":"BeforeIT.one_epoch!","text":"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())\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.initialise_data(model), then iteratively updates the model and data for each epoch using BeforeIT.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.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#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.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, StatsPlots","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.initialise_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.initialise_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 println(t)\n Bit.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":"p1 = plot(data.real_gdp, title = \"gdp\", titlefont = 10)\np2 = plot(data.real_household_consumption, title = \"household cons.\", titlefont = 10)\np3 = plot(data.real_government_consumption, title = \"gov. cons.\", titlefont = 10)\np4 = plot(data.real_capitalformation, title = \"capital form.\", titlefont = 10)\np5 = plot(data.real_exports, title = \"exports\", titlefont = 10)\np6 = plot(data.real_imports, title = \"imports\", titlefont = 10)\np7 = plot(data.wages, title = \"wages\", titlefont = 10)\np8 = plot(data.euribor, title = \"euribor\", titlefont = 10)\np9 = plot(data.nominal_gdp ./ data.real_gdp, title = \"gdp deflator\", titlefont = 10)\n\nplot(p1, p2, p3, p4, p5, p6, p7, p8, p9, layout = (3, 3), legend = false)","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.initialise_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. Since we are saving the initial data point, we effectively have T+1 data points in our time series.","category":"page"},{"location":"examples/basic_example.html","page":"Essentials","title":"Essentials","text":"Te = T + 1\n\np1 = errorline(1:Te, data_vector.real_gdp, errorstyle = :ribbon, title = \"gdp\", titlefont = 10)\np2 = errorline(\n 1:Te,\n data_vector.real_household_consumption,\n errorstyle = :ribbon,\n title = \"household cons.\",\n titlefont = 10,\n)\np3 =\n errorline(1:Te, data_vector.real_government_consumption, errorstyle = :ribbon, title = \"gov. cons.\", titlefont = 10)\np4 = errorline(1:Te, data_vector.real_capitalformation, errorstyle = :ribbon, title = \"capital form.\", titlefont = 10)\np5 = errorline(1:Te, data_vector.real_exports, errorstyle = :ribbon, title = \"exports\", titlefont = 10)\np6 = errorline(1:Te, data_vector.real_imports, errorstyle = :ribbon, title = \"imports\", titlefont = 10)\np7 = errorline(1:Te, data_vector.wages, errorstyle = :ribbon, title = \"wages\", titlefont = 10)\np8 = errorline(1:Te, data_vector.euribor, errorstyle = :ribbon, title = \"euribor\", titlefont = 10)\np9 = errorline(\n 1:Te,\n data_vector.nominal_gdp ./ data.real_gdp,\n errorstyle = :ribbon,\n title = \"gdp deflator\",\n 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":"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.initialise_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 'estimatenextvalue' to make the agents expect the last value of the time series (in way representing 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.initialise_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 estimatenextvalue 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 need to 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\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.initialise_model(parameters, initial_conditions, T);\ndata = Bit.initialise_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\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 centralbankrate 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 redefine the function centralbankrate","category":"page"},{"location":"examples/scenario_analysis_via_overload.html","page":"Shocked simulations (advanced)","title":"Shocked simulations (advanced)","text":"function 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 return taylor_rate\nend","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 oject for italy, which contains 4 datasets: calibration_data, figaro, data, and ea These are saved within BeforeIT 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\n\nfieldnames(typeof(cal))","category":"page"},{"location":"examples/get_parameters_and_initial_conditions.html","page":"Calibration","title":"Calibration","text":"These are essentually 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 sgeneral, 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/\" *\n \"italy/\" *\n \"/parameters/\" *\n string(year(calibration_date)) *\n \"Q\" *\n string(Dates.quarterofyear(calibration_date)) *\n \".jld2\",\n params,\n )\n save(\n \"data/\" *\n \"italy/\" *\n \"/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, install the Plots package via Pkg.add(\"Plots\") and then run","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#Original-authors","page":"Home","title":"Original authors","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"Aldo Glielmo \nMitja Devetak ","category":"page"},{"location":"index.html#Other-collaborators-for-the-project","page":"Home","title":"Other collaborators for the project","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","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":"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 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":"We then initialise the model, this time we will 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.initialise_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":"println(model.prop.H)","category":"page"},{"location":"examples/multithreading_speedup.html","page":"Multithreading within the model","title":"Multithreading within the model","text":"Note that households are the sum of active and inactive households and 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":"println(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":"println(Threads.nthreads())","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":"@time data = Bit.run_one_sim!(model; multi_threading = false);\n\nmodel = Bit.initialise_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?","category":"page"}] }