Skip to contents

Decompose an origin footprint by the area and item of the product supplied to final demand. This adds the missing FABIO-viewer style phase between origin product and final-demand area: origin product -> supplied product area -> supplied product -> final-demand area.

Unlike compute_footprint_paths(), this does not show the first direct intermediate input. It shows the downstream product row in Y whose final demand carries the origin footprint.

Usage

compute_fp_product_paths(
  z_mat,
  x_vec,
  y_mat,
  extensions,
  labels,
  fd_labels,
  origin_area = NULL,
  origin_item = NULL,
  output_tol = 1e-08,
  value_added_floor = 0.001,
  max_column_sum = 100,
  conserve_extensions = TRUE,
  min_value = 0
)

Arguments

z_mat

Inter-industry flow matrix from build_io_model().

x_vec

Numeric vector of total output per sector.

y_mat

Final demand matrix from build_io_model().

extensions

Numeric vector of environmental extensions per sector.

labels

Tibble with area_code and item_cbs_code mapping sectors.

fd_labels

Tibble labelling Y columns, from build_io_model().

origin_area

Optional vector limiting origin sectors. Each value is matched against labels$area_code – the LEGACY numeric area code – and a value that matches no area_code is then resolved through the polity vocabulary of polity_area_crosswalk, so a polity_area_code (206, the Sudan aggregation bucket) or a polity_code ("SDN-2011-2025") selects the area codes it covers. Legacy codes keep their legacy meaning. Values that resolve to no sector are dropped with a warning, and a call in which nothing resolves aborts instead of returning an empty table.

origin_item

Optional item code vector limiting origin sectors.

output_tol

Minimum output considered valid when computing extension intensities.

value_added_floor

Minimum non-intermediate leakage share used when constructing technical coefficients from z_mat.

max_column_sum

Maximum allowed column sum in A. Must match the value used by compute_footprint() (default 100) so the path decomposition and the footprint it decomposes share an identical A cap.

conserve_extensions

If TRUE, rescale positive paths within each origin area/item so their sum does not exceed the corresponding positive extension total.

min_value

Drop paths with values less than or equal to this value before returning.

Value

A tibble with origin_area, origin_item, product_area, product_item, target_area, role-specific polity metadata, target_fd, and value.

Examples

# Same two-sector economy as [compute_footprint_paths()], decomposed by the
# product that reaches final demand instead of by the first intermediate
# use. The path totals of the two functions agree with each other and with
# [compute_footprint()] under a shared `max_column_sum`.
z_mat <- matrix(c(0, 50, 0, 0), nrow = 2, byrow = TRUE)
labels <- tibble::tibble(
  area_code = c(1L, 1L),
  item_cbs_code = c(10L, 20L)
)

compute_fp_product_paths(
  z_mat = z_mat,
  x_vec = c(100, 200),
  y_mat = matrix(c(10, 100), nrow = 2),
  extensions = c(200, 0),
  labels = labels,
  fd_labels = tibble::tibble(area_code = 2L, fd_col = "food"),
  conserve_extensions = FALSE
) |>
  dplyr::select(origin_item, product_area, product_item, value)
#>  Computing final-product footprint paths for 1 origin sector.
#>   Final demand: 1 column.
#> Decomposing final-product paths...
#>  Final-product paths complete: 2 non-zero flows.
#> # A tibble: 2 × 4
#>   origin_item product_area product_item value
#>         <int>        <int>        <int> <dbl>
#> 1          10            1           10  20.0
#> 2          10            1           20  50.0