Skip to contents

Construct a multi-regional input-output (MRIO) model from supply-use tables, bilateral trade, and commodity balance sheets. Uses the industry technology assumption to derive symmetric product-by-product tables.

The resulting matrices follow the FABIO methodology (Bruckner et al., 2019). Rows and columns of Z represent (country, item) pairs. Each entry Z[i,j] gives the intermediate flow from sector i to sector j.

Usage

build_io_model(
  supply_use = NULL,
  bilateral_trade = NULL,
  cbs = NULL,
  years = NULL,
  endogenize_losses = FALSE,
  method = c("mass", "value"),
  prices = NULL,
  trade_recovery = .cbs_trade_recovery_choices()
)

Arguments

supply_use

Tibble from build_supply_use(). By default, this function calls build_supply_use() internally. Must have columns: year, area_code, proc_group, proc_cbs_code, item_cbs_code, type, value.

bilateral_trade

Tibble from get_bilateral_trade(). By default, this function calls get_bilateral_trade() internally. Must have columns: year, item_cbs_code, bilateral_trade (list-column of matrices).

cbs

Tibble from get_wide_cbs(). By default, this function calls get_wide_cbs() internally. Must have columns: year, area_code, item_cbs_code, production, export, stock_withdrawal, stock_addition, plus final demand columns (food, other_uses). import is read only when bilateral_trade is NULL, by get_bilateral_trade(), which balances the trade matrices against it. year, area_code and item_cbs_code must hold no NA, here and in supply_use: a row with a missing code cannot be placed in the model.

years

Numeric vector of years to compute, or NULL. If NULL, computes all years in the intersection of available data across inputs. If specified, must be a subset of available years.

endogenize_losses

Logical. If TRUE and cbs contains a losses column, losses are moved from final demand to the diagonal of Z (self-use), following the FABIO convention. The losses column is removed from Y and fd_labels. get_wide_cbs() emits no losses column, so TRUE with such a cbs warns and builds the same model as FALSE. Defaults to FALSE.

method

Co-product allocation method. "mass" (default) splits a multi-output process's inputs across its products by physical mass; "value" splits them by economic value (mass times export price), so high-value co-products (e.g. oil over cake, meat over hides) carry a larger share of upstream pressures. A process whose co-products lack usable prices falls back to mass.

prices

Optional tibble of item prices as from build_cbs_prices() (year, element, item_cbs_code, price). Used only when method = "value"; built automatically when NULL.

trade_recovery

One of "byproduct_residual" (default), "pass_through", "net_import" or "none", selecting the CBS every internally built input is derived from — the wide CBS, the processing coefficients, the supply-use tables, the bilateral trade matrices and the prices. See build_commodity_balances() for what each method does. It has no effect on an input supplied directly, so a cbs built with one method and the rest left to build under another is the caller's to avoid; pass the same value everywhere.

Value

A tibble with one row per year and list-columns:

  • Z: Inter-industry flow matrix (product-by-product).

  • Y: Final demand matrix.

  • X: Total output vector.

  • labels: Tibble mapping row/column indices to area_code, item_cbs_code, and reporting polity metadata.

  • fd_labels: Tibble mapping each Y column to its area_code (consuming polity), fd_col (demand category, e.g. "food"), and reporting polity metadata. Pass to compute_footprint() as fd_labels to get a target_fd column in the footprint output.

Examples

su <- build_supply_use(example = TRUE)
btd <- get_bilateral_trade(example = TRUE)
cbs <- get_wide_cbs(example = TRUE)
build_io_model(su, btd, cbs)
#> Warning: no non-missing arguments to min; returning Inf
#> Warning: no non-missing arguments to max; returning -Inf
#> ℹ Building IO model for 0 years.
#>   Year range: Inf--Inf.
#>   Final demand columns: food, other_uses, and stock_addition.
#> ✔ IO model complete.
#> # A tibble: 0 × 6
#> # ℹ 6 variables: year <int>, Z <list>, Y <list>, X <list>, labels <list>,
#> #   fd_labels <list>