# Leontief’s Input-Output Model in R

## Common variables

Let `X` be the input-output matrix, `w` the wage vector, `c` the household consumption vector, `d` the total final demand vector, and `e` the employment coefficient.

    library(leontief)

    X <- transaction_matrix
    w <- wage_demand_matrix[, "wage"]
    c <- wage_demand_matrix[, "household_consumption"]
    d <- wage_demand_matrix[, "final_total_demand"]
    e <- employment_matrix[, "employees"]

## Input requirement matrix

Let `A` be the direct coefficients matrix.

    A <- input_requirement(X, d)
    A_aug <- augmented_input_requirement(X, w, c, d)
    rownames(A_aug) <- c(rownames(X), "wage_over_demand")
    colnames(A_aug) <- c(rownames(X), "consumption_over_demand")
    kable(A_aug)

| agriculture_fishing | mining | manufacturing_industry | electricity_gas_water | construction | retail_hotels_restaurants | transport_communications_information | financial_services | real_estate | business_services | personal_services | public_administration | consumption_over_demand
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
agriculture_fishing | 0.147 | 0.000 | 0.125 | 0.003 | 0.000 | 0.007 | 0.000 | 0.000 | 0.000 | 0.001 | 0.002 | 0.002 | 0.110
mining | 0.008 | 0.071 | 0.030 | 0.002 | 0.005 | 0.002 | 0.001 | 0.002 | 0.000 | 0.002 | 0.001 | 0.001 | 0.001
manufacturing_industry | 0.185 | 0.052 | 0.137 | 0.050 | 0.194 | 0.077 | 0.061 | 0.010 | 0.002 | 0.026 | 0.047 | 0.027 | 0.261
electricity_gas_water | 0.007 | 0.056 | 0.028 | 0.308 | 0.004 | 0.014 | 0.008 | 0.005 | 0.006 | 0.006 | 0.014 | 0.035 | 0.210
construction | 0.002 | 0.001 | 0.001 | 0.009 | 0.123 | 0.008 | 0.005 | 0.002 | 0.129 | 0.004 | 0.011 | 0.028 | 0.001
retail_hotels_restaurants | 0.049 | 0.027 | 0.037 | 0.023 | 0.053 | 0.070 | 0.057 | 0.015 | 0.004 | 0.031 | 0.040 | 0.018 | 0.522
transport_communications_information | 0.036 | 0.034 | 0.057 | 0.027 | 0.019 | 0.099 | 0.144 | 0.041 | 0.004 | 0.044 | 0.019 | 0.037 | 0.311
financial_services | 0.028 | 0.006 | 0.015 | 0.018 | 0.028 | 0.036 | 0.020 | 0.109 | 0.039 | 0.019 | 0.009 | 0.003 | 0.438
real_estate | 0.003 | 0.003 | 0.005 | 0.002 | 0.003 | 0.048 | 0.015 | 0.010 | 0.014 | 0.024 | 0.023 | 0.009 | 0.699
business_services | 0.029 | 0.091 | 0.065 | 0.041 | 0.056 | 0.094 | 0.073 | 0.090 | 0.019 | 0.123 | 0.042 | 0.047 | 0.051
personal_services | 0.001 | 0.001 | 0.003 | 0.001 | 0.001 | 0.004 | 0.005 | 0.003 | 0.001 | 0.003 | 0.034 | 0.003 | 0.451
public_administration | 0.001 | 0.001 | 0.002 | 0.002 | 0.000 | 0.004 | 0.003 | 0.001 | 0.000 | 0.001 | 0.002 | 0.003 | 0.034
wage_over_demand | 0.146 | 0.090 | 0.104 | 0.064 | 0.241 | 0.251 | 0.154 | 0.255 | 0.030 | 0.299 | 0.554 | 0.541 | 0.000

## Output allocation matrix

Let `B` be the output allocation matrix.

    B <- output_allocation(X, d)
    rownames(B) <- rownames(X)
    colnames(B) <- rownames(X)
    kable(B)

| agriculture_fishing | mining | manufacturing_industry | electricity_gas_water | construction | retail_hotels_restaurants | transport_communications_information | financial_services | real_estate | business_services | personal_services | public_administration
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
agriculture_fishing | 0.147 | 0.000 | 0.524 | 0.002 | 0.001 | 0.020 | 0.000 | 0.000 | 0.000 | 0.002 | 0.003 | 0.002
mining | 0.003 | 0.071 | 0.054 | 0.001 | 0.004 | 0.002 | 0.001 | 0.001 | 0.000 | 0.002 | 0.001 | 0.000
manufacturing_industry | 0.044 | 0.029 | 0.137 | 0.010 | 0.086 | 0.050 | 0.035 | 0.002 | 0.000 | 0.012 | 0.021 | 0.005
electricity_gas_water | 0.008 | 0.153 | 0.138 | 0.308 | 0.009 | 0.044 | 0.024 | 0.006 | 0.008 | 0.015 | 0.031 | 0.033
construction | 0.001 | 0.001 | 0.002 | 0.004 | 0.123 | 0.012 | 0.007 | 0.001 | 0.077 | 0.004 | 0.011 | 0.012
retail_hotels_restaurants | 0.018 | 0.024 | 0.058 | 0.007 | 0.037 | 0.070 | 0.050 | 0.006 | 0.001 | 0.022 | 0.028 | 0.005
transport_communications_information | 0.015 | 0.034 | 0.100 | 0.010 | 0.015 | 0.113 | 0.144 | 0.017 | 0.002 | 0.035 | 0.015 | 0.013
financial_services | 0.029 | 0.013 | 0.064 | 0.015 | 0.053 | 0.098 | 0.047 | 0.109 | 0.044 | 0.036 | 0.017 | 0.002
real_estate | 0.003 | 0.006 | 0.019 | 0.002 | 0.005 | 0.115 | 0.033 | 0.009 | 0.014 | 0.040 | 0.038 | 0.006
business_services | 0.015 | 0.111 | 0.142 | 0.018 | 0.055 | 0.133 | 0.090 | 0.047 | 0.011 | 0.123 | 0.041 | 0.020
personal_services | 0.000 | 0.002 | 0.006 | 0.000 | 0.001 | 0.005 | 0.007 | 0.002 | 0.000 | 0.003 | 0.034 | 0.001
public_administration | 0.002 | 0.003 | 0.009 | 0.002 | 0.000 | 0.013 | 0.009 | 0.001 | 0.000 | 0.002 | 0.004 | 0.003

## Leontief inverse matrix

Let `I` be the identity matrix. Leontief inverse is the same as solving `I - A`.

    L <- leontief_inverse(A)
    rownames(L) <- rownames(X)
    colnames(L) <- rownames(X)
    kable(L)

| agriculture_fishing | mining | manufacturing_industry | electricity_gas_water | construction | retail_hotels_restaurants | transport_communications_information | financial_services | real_estate | business_services | personal_services | public_administration
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
agriculture_fishing | 1.214 | 0.014 | 0.181 | 0.021 | 0.043 | 0.029 | 0.017 | 0.005 | 0.007 | 0.009 | 0.014 | 0.011
mining | 0.020 | 1.080 | 0.042 | 0.007 | 0.016 | 0.007 | 0.005 | 0.003 | 0.003 | 0.004 | 0.004 | 0.003
manufacturing_industry | 0.283 | 0.088 | 1.225 | 0.106 | 0.286 | 0.128 | 0.106 | 0.029 | 0.043 | 0.051 | 0.077 | 0.055
electricity_gas_water | 0.030 | 0.094 | 0.059 | 1.454 | 0.025 | 0.033 | 0.023 | 0.013 | 0.013 | 0.016 | 0.027 | 0.055
construction | 0.007 | 0.005 | 0.007 | 0.018 | 1.145 | 0.022 | 0.013 | 0.006 | 0.151 | 0.011 | 0.019 | 0.035
retail_hotels_restaurants | 0.087 | 0.048 | 0.074 | 0.050 | 0.090 | 1.100 | 0.085 | 0.029 | 0.019 | 0.048 | 0.055 | 0.032
transport_communications_information | 0.090 | 0.066 | 0.110 | 0.067 | 0.067 | 0.150 | 1.195 | 0.067 | 0.018 | 0.071 | 0.041 | 0.059
financial_services | 0.052 | 0.018 | 0.037 | 0.039 | 0.051 | 0.058 | 0.037 | 1.129 | 0.053 | 0.031 | 0.019 | 0.011
real_estate | 0.014 | 0.011 | 0.016 | 0.010 | 0.014 | 0.061 | 0.027 | 0.017 | 1.018 | 0.032 | 0.030 | 0.014
business_services | 0.087 | 0.137 | 0.126 | 0.094 | 0.120 | 0.152 | 0.124 | 0.129 | 0.045 | 1.162 | 0.070 | 0.073
personal_services | 0.003 | 0.003 | 0.005 | 0.003 | 0.003 | 0.006 | 0.008 | 0.005 | 0.001 | 0.004 | 1.036 | 0.004
public_administration | 0.003 | 0.002 | 0.003 | 0.003 | 0.001 | 0.005 | 0.004 | 0.001 | 0.001 | 0.002 | 0.002 | 1.004

## Equilibrium output

The required output is given by `L * d`.

    eq <- equilibrium_output(L, d)
    rownames(eq) <- rownames(X)
    colnames(eq) <- "output"
    kable(eq)

| output
--- | ---
agriculture_fishing | 25832
mining | 31674
manufacturing_industry | 81363
electricity_gas_water | 23428
construction | 28817
retail_hotels_restaurants | 47168
transport_communications_information | 50606
financial_services | 21588
real_estate | 18686
business_services | 51363
personal_services | 23148
public_administration | 9746

## Multipliers

### Output multiplier

The output multiplier is the column sum of `L`.

    out <- output_multiplier(L)

### Income multiplier

Let `W` be a matrix where each column is `w` with the same dimension as `L`. The income multiplier is the column sum of the element-wise multiplication of `L` and `W` element-wise divided by `w`.

    inc <- income_multiplier(L, w / d)

### Employment multiplier

Let `E` be a matrix where each column is `e` with the same dimension as `L`. The employment multiplier is the column sum of the element-wise multiplication of `L` and `E` element-wise divided by `e`.

    emp <- employment_multiplier(L, e / d)

### Summary of multipliers

    sm <- round(cbind(out, inc, emp), 4)
    rownames(sm) <- rownames(X)
    colnames(sm) <- c("output_multiplier", "income_multiplier", "employment_multiplier")
    kable(sm)

| output_multiplier | income_multiplier | employment_multiplier
--- | --- | --- | ---
agriculture_fishing | 1.89 | 0.291 | 94.3
mining | 1.57 | 0.187 | 21.4
manufacturing_industry | 1.88 | 0.250 | 46.2
electricity_gas_water | 1.87 | 0.177 | 22.3
construction | 1.86 | 0.400 | 55.3
retail_hotels_restaurants | 1.75 | 0.393 | 78.3
transport_communications_information | 1.65 | 0.278 | 41.3
financial_services | 1.44 | 0.354 | 24.9
real_estate | 1.37 | 0.109 | 14.5
business_services | 1.44 | 0.393 | 29.1
personal_services | 1.40 | 0.639 | 90.8
public_administration | 1.36 | 0.607 | 53.9

## Linkages

### Backward and forward linkage

    bl <- backward_linkage(A)
    fl <- forward_linkage(A)
    bfl <- cbind(bl, fl)
    rownames(bfl) <- rownames(X)
    colnames(bfl) <- c("backward_linkage", "forward_linkage")
    kable(bfl)

| backward_linkage | forward_linkage
--- | --- | ---
agriculture_fishing | 0.496 | 0.288
mining | 0.343 | 0.123
manufacturing_industry | 0.506 | 0.869
electricity_gas_water | 0.486 | 0.491
construction | 0.487 | 0.322
retail_hotels_restaurants | 0.462 | 0.424
transport_communications_information | 0.393 | 0.561
financial_services | 0.288 | 0.330
real_estate | 0.217 | 0.159
business_services | 0.283 | 0.770
personal_services | 0.243 | 0.059
public_administration | 0.211 | 0.019

### Power of dispersion

    bl <- power_dispersion(L)
    bl_cv <- power_dispersion_cv(L)
    bl_t <- cbind(bl, bl_cv)
    rownames(bl_t) <- rownames(X)
    colnames(bl_t) <- c("power_dispersion", "power_dispersion_cv")
    kable(bl_t)

| power_dispersion | power_dispersion_cv
--- | --- | ---
agriculture_fishing | 1.165 | 2.14
mining | 0.965 | 2.40
manufacturing_industry | 1.161 | 2.10
electricity_gas_water | 1.154 | 2.59
construction | 1.147 | 2.07
retail_hotels_restaurants | 1.079 | 2.05
transport_communications_information | 1.014 | 2.38
financial_services | 0.884 | 2.68
real_estate | 0.845 | 2.60
business_services | 0.888 | 2.64
personal_services | 0.860 | 2.65
public_administration | 0.836 | 2.66

### Sensitivity of dispersion

    sl <- sensitivity_dispersion(L)
    sl_cv <- sensitivity_dispersion_cv(L)
    sl_t <- cbind(sl, sl_cv)
    rownames(sl_t) <- rownames(X)
    colnames(sl_t) <- c("power_dispersion", "power_dispersion_cv")
    kable(sl_t)

| power_dispersion | power_dispersion_cv
--- | --- | ---
agriculture_fishing | 0.965 | 2.60
mining | 0.736 | 3.12
manufacturing_industry | 1.526 | 1.54
electricity_gas_water | 1.136 | 2.63
construction | 0.887 | 2.68
retail_hotels_restaurants | 1.058 | 2.09
transport_communications_information | 1.234 | 1.94
financial_services | 0.947 | 2.52
real_estate | 0.779 | 2.84
business_services | 1.430 | 1.61
personal_services | 0.667 | 3.39
public_administration | 0.636 | 3.46

### Multiplier product matrix

    mp <- multiplier_product_matrix(L)
    rownames(mp) <- rownames(X)
    colnames(mp) <- rownames(X)
    kable(mp)

| agriculture_fishing | mining | manufacturing_industry | electricity_gas_water | construction | retail_hotels_restaurants | transport_communications_information | financial_services | real_estate | business_services | personal_services | public_administration
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
agriculture_fishing | 0.152 | 0.116 | 0.240 | 0.179 | 0.140 | 0.167 | 0.194 | 0.149 | 0.123 | 0.225 | 0.105 | 0.100
mining | 0.126 | 0.096 | 0.199 | 0.148 | 0.116 | 0.138 | 0.161 | 0.124 | 0.102 | 0.187 | 0.087 | 0.083
manufacturing_industry | 0.151 | 0.116 | 0.240 | 0.178 | 0.139 | 0.166 | 0.194 | 0.149 | 0.122 | 0.225 | 0.105 | 0.100
electricity_gas_water | 0.151 | 0.115 | 0.238 | 0.177 | 0.138 | 0.165 | 0.192 | 0.148 | 0.122 | 0.223 | 0.104 | 0.099
construction | 0.150 | 0.114 | 0.237 | 0.176 | 0.138 | 0.164 | 0.191 | 0.147 | 0.121 | 0.222 | 0.103 | 0.099
retail_hotels_restaurants | 0.141 | 0.107 | 0.223 | 0.166 | 0.129 | 0.154 | 0.180 | 0.138 | 0.114 | 0.209 | 0.097 | 0.093
transport_communications_information | 0.132 | 0.101 | 0.209 | 0.156 | 0.122 | 0.145 | 0.169 | 0.130 | 0.107 | 0.196 | 0.091 | 0.087
financial_services | 0.115 | 0.088 | 0.182 | 0.136 | 0.106 | 0.126 | 0.148 | 0.113 | 0.093 | 0.171 | 0.080 | 0.076
real_estate | 0.110 | 0.084 | 0.174 | 0.130 | 0.101 | 0.121 | 0.141 | 0.108 | 0.089 | 0.163 | 0.076 | 0.073
business_services | 0.116 | 0.088 | 0.183 | 0.136 | 0.107 | 0.127 | 0.148 | 0.114 | 0.094 | 0.172 | 0.080 | 0.076
personal_services | 0.112 | 0.086 | 0.177 | 0.132 | 0.103 | 0.123 | 0.143 | 0.110 | 0.091 | 0.166 | 0.078 | 0.074
public_administration | 0.109 | 0.083 | 0.172 | 0.128 | 0.100 | 0.120 | 0.139 | 0.107 | 0.088 | 0.162 | 0.075 | 0.072

### Induced effects (labor/consumption)

    bli <- backward_linkage(A_aug)
    fli <- forward_linkage(A_aug)
    bfli <- cbind(bli, fli)
    rownames(bfli) <- c(rownames(X), "wage")
    # wie = with induced effect
    colnames(bfli) <- c("backward_linkage_wie", "forward_linkage_wie")
    kable(bfli)

| backward_linkage_wie | forward_linkage_wie
--- | --- | ---
agriculture_fishing | 0.643 | 0.398
mining | 0.433 | 0.123
manufacturing_industry | 0.609 | 1.130
electricity_gas_water | 0.550 | 0.702
construction | 0.728 | 0.323
retail_hotels_restaurants | 0.713 | 0.947
transport_communications_information | 0.547 | 0.872
financial_services | 0.543 | 0.768
real_estate | 0.247 | 0.858
business_services | 0.582 | 0.821
personal_services | 0.797 | 0.510
public_administration | 0.752 | 0.053
wage | 3.090 | 2.729

## References

Schuschny, Andres Ricardo. Topicos sobre el modelo de insumo-producto: teoria y aplicaciones. Cepal, 2005.

Pino Arriagada, Andres y Fuentes Navarro, Silvia. Derivacion y analisis de los multiplicadores de empleo para la economia nacional. Universidad del Bio-Bio, 2018.