new_Y: Reconstruct an economy given a new final demand matrix

View source: R/reconstruct.R

new_YR Documentation

Reconstruct an economy given a new final demand matrix

Description

When the final demand matrix changes from Y to Y_prime, this function calculates new resource (R_prime), use (U_prime), feed (U_feed), energy industry own use (U_eiou), ratio (r_eiou), and make (V_prime) matrices that would be required to meet the new final demand (Y_prime).

Usage

new_Y(
  .sutmats = NULL,
  Y_prime = "Y_prime",
  L_ixp = "L_ixp",
  L_pxp = "L_pxp",
  Z = "Z",
  Z_feed = "Z_feed",
  D = "D",
  O = "O",
  R_prime = "R_prime",
  U_prime = "U_prime",
  U_feed_prime = "U_feed_prime",
  U_eiou_prime = "U_EIOU_prime",
  r_eiou_prime = "r_EIOU_prime",
  V_prime = "V_prime"
)

Arguments

.sutmats

A data frame of supply-use table matrices with matrices arranged in columns.

Y_prime

A new final demand matrix or name of a column in .sutmats containing same. Default is "Y_prime".

L_ixp, L_pxp, Z, Z_feed, D, O

Input matrices that describe the structure of the energy conversion chain. Values can be string names (the default) for columns in a data frame .sutmats or names of items in a list .sutmats

R_prime, U_prime, U_feed_prime, U_eiou_prime, r_eiou_prime, V_prime

The new names for new matrices. Defaults are each argument name as a string.

Details

Note that inputs L_ixp, L_pxp, Z, and D can be conveniently calculated by the function calc_io_mats().

Internally, this function uses matsindf::matsindf_apply(), and documentation assumes that .sutmats is not NULL and is a data frame. But .sutmats can also be a named list of matrices. Or matrices can be supplied individually to the Y_prime, L_ixp, L_pxp, Z, Z_feed, D, and O arguments. If .sutmats is present, output is a data frame with columns named by string values of output arguments, and input arguments should be character strings that name columns in .sutmats. If .sutmats is NULL (the default), output is a list with items named by output strings, and input arguments should be single matrices or vectors.

Value

A list or data frame containing R_prime, U_prime, U_feed, U_eiou, r_eiou, and V_prime matrices.

Examples

library(dplyr)
library(matsbyname)
library(tidyr)
UKEnergy2000mats %>%
  spread(key = matrix.name, value = matrix) %>%
  select(Country, Year, Energy.type, Last.stage, R, U, U_feed, V, Y, r_EIOU, S_units) %>%
  calc_io_mats() %>%
  mutate(
    # Give new Y matrices that are double the existing Y matrices
    Y_prime = matsbyname::hadamardproduct_byname(2, Y)
  ) %>%
  # Should give U_prime and V_prime matrices that are double the existing U and V matrices
  new_Y()

MatthewHeun/Recca documentation built on Feb. 9, 2024, 6:18 p.m.